correct generate icml (#16)

This commit is contained in:
DmitryZagorulko 2017-08-09 12:03:12 +03:00 committed by Alex Lushpai
parent 9bbe23195c
commit ee33a5fb40
4 changed files with 35 additions and 23 deletions

View File

@ -32,7 +32,7 @@ foreach ($customerRecords as $record) {
$customers[$record['id_customer']] = array( $customers[$record['id_customer']] = array(
'externalId' => $record['id_customer'], 'externalId' => $record['id_customer'],
'firstName' => $record['firstname'], 'firstName' => $record['firstname'],
'lastname' => $record['lastname'], 'lastName' => $record['lastname'],
'email' => $record['email'] 'email' => $record['email']
); );
} }

View File

@ -26,7 +26,7 @@ class RetailcrmCatalog
$currencies = Currency::getCurrencies(); $currencies = Currency::getCurrencies();
$types = Category::getCategories($id_lang, true, false); $types = Category::getCategories($id_lang, false, false);
foreach ($types AS $category) { foreach ($types AS $category) {
$categories[] = array( $categories[] = array(
'id' => $category['id_category'], 'id' => $category['id_category'],
@ -126,6 +126,11 @@ class RetailcrmCatalog
} }
} }
if (!empty($combinations[0]['reference'])) {
$articleCombination = $combinations[0]['reference'];
} else {
$articleCombination = null;
}
$pictures = array(); $pictures = array();
$covers = Image::getImages($id_lang, $product['id_product'], $offer['id_product_attribute']); $covers = Image::getImages($id_lang, $product['id_product'], $offer['id_product_attribute']);
foreach($covers as $cover) { foreach($covers as $cover) {
@ -140,7 +145,8 @@ class RetailcrmCatalog
} }
$offerPrice = Combination::getPrice($offer['id_product_attribute']); $offerPrice = Combination::getPrice($offer['id_product_attribute']);
$offerPrice = $offerPrice > 0 ? $offerPrice : $price; //$offerPrice = $offerPrice > 0 ? $offerPrice : $price;
$offerPrice = $offerPrice != 0 ? $offerPrice + $price : $price;
$item = array( $item = array(
'id' => $product['id_product'] . '#' . $offer['id_product_attribute'], 'id' => $product['id_product'] . '#' . $offer['id_product_attribute'],
@ -155,9 +161,12 @@ class RetailcrmCatalog
'purchasePrice' => $purchasePrice, 'purchasePrice' => $purchasePrice,
'price' => round($offerPrice, 2), 'price' => round($offerPrice, 2),
'vendor' => $vendor, 'vendor' => $vendor,
'article' => $article, 'article' => ($articleCombination) ? $articleCombination : $article,
'weight' => $weight, 'weight' => $weight,
'size' => $size 'size' => $size,
'width' => $width,
'height' => $height,
'depth' => $depth
); );
if (!empty($combinations)) { if (!empty($combinations)) {
@ -197,7 +206,10 @@ class RetailcrmCatalog
'vendor' => $vendor, 'vendor' => $vendor,
'article' => $article, 'article' => $article,
'weight' => $weight, 'weight' => $weight,
'size' => $size 'size' => $size,
'width' => $width,
'height' => $height,
'depth' => $depth
); );
$items[] = $item; $items[] = $item;

View File

@ -33,7 +33,10 @@ class RetailcrmIcml
'color' => 'Цвет', 'color' => 'Цвет',
'weight' => 'Вес', 'weight' => 'Вес',
'size' => 'Размер', 'size' => 'Размер',
'tax' => 'Наценка' 'tax' => 'Наценка',
'width' => 'Ширина',
'height' => 'Высота',
'depth' => 'Глубина'
); );
} }
@ -75,14 +78,14 @@ class RetailcrmIcml
foreach ($categories as $category) { foreach ($categories as $category) {
$e = $this->eCategories->appendChild( $e = $this->eCategories->appendChild(
$this->dd->createElement( $this->dd->createElement(
'category', $category['name'] 'category', htmlspecialchars($category['name'])
) )
); );
$e->setAttribute('id', $category['id']); $e->setAttribute('id', $category['id']);
if ($category['parentId'] > 0) { if ($category['parentId'] > 0) {
$e->setAttribute('parentId', $category['parentId']); $e->setAttribute('parentId', htmlspecialchars($category['parentId']));
} }
} }
} }

View File

@ -20,8 +20,7 @@ class RetailCRM extends Module
{ {
$this->name = 'retailcrm'; $this->name = 'retailcrm';
$this->tab = 'export'; $this->tab = 'export';
$this->version = '2.1.1'; $this->version = '2.2';
$this->version = '2.1';
$this->author = 'Retail Driver LCC'; $this->author = 'Retail Driver LCC';
$this->displayName = $this->l('RetailCRM'); $this->displayName = $this->l('RetailCRM');
$this->description = $this->l('Integration module for RetailCRM'); $this->description = $this->l('Integration module for RetailCRM');
@ -454,9 +453,7 @@ class RetailCRM extends Module
'properties' => $arProp 'properties' => $arProp
); );
unset($arAttr); unset($arAttr, $count, $arProp);
unset($count);
unset($arProp);
} }
$deliveryCode = $params['order']->id_carrier; $deliveryCode = $params['order']->id_carrier;