diff --git a/intaro.intarocrm/classes/general/ICMLLoader.php b/intaro.intarocrm/classes/general/ICMLLoader.php
index d8d74fbb..351afa4a 100644
--- a/intaro.intarocrm/classes/general/ICMLLoader.php
+++ b/intaro.intarocrm/classes/general/ICMLLoader.php
@@ -23,14 +23,24 @@ class ICMLLoader {
protected $logFile = '/bitrix/catalog_export/i_crm_load_log.txt';
protected $fpLog;
+
protected $measurement = array (
- 'mm' => 1,
- 'cm' => 10,
+ 'mm' => 1, // 1 mm = 1 mm
+ 'cm' => 10, // 1 cm = 10 mm
'm' => 1000,
- 'mg' => 0.001,
+ 'mg' => 0.001, // 0.001 g = 1 mg
'g' => 1,
'kg' => 1000,
);
+
+ protected $measurementLink = array (
+ 'mm' => 'mm',
+ 'cm' => 'mm',
+ 'm' => 'mm',
+ 'mg' => 'g',
+ 'g' => 'g',
+ 'kg' => 'g',
+ );
public function Load()
{
@@ -375,6 +385,7 @@ class ICMLLoader {
if (array_key_exists($key, $this->propertiesUnitProduct[$id])) {
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
+ $resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]];
}
}
}
@@ -424,6 +435,7 @@ class ICMLLoader {
if (array_key_exists($key, $this->propertiesUnitSKU[$id])) {
$offer[$key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
+ $offer[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitSKU[$id][$key]];
}
}
@@ -447,7 +459,7 @@ class ICMLLoader {
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
foreach ($resPropertiesProduct as $key => $propProduct) {
- if ($this->propertiesProduct[$id][$key] != "") {
+ if ($this->propertiesProduct[$id][$key] != "" || $this->propertiesProduct[$id][str_replace("_UNIT", "", $key)] != "") {
$product[$key] = $propProduct;
}
}
@@ -513,12 +525,20 @@ class ICMLLoader {
$offer .= "" . $this->PrepareValue($arOffer["PRODUCT_NAME"]) . "\n";
foreach ($this->propertiesProduct[$iblock['IBLOCK_DB']['ID']] as $key => $propProduct) {
- if ($propProduct != "" && $arOffer[$key] != null)
- $offer .= "<" . $key . ">" . $this->PrepareValue($arOffer[$key]) . "" . $key . ">\n";
+ if ($propProduct != "" && $arOffer[$key] != null) {
+ if ($key === "manufacturer")
+ $offer .= "" . $this->PrepareValue($arOffer[$key]) . "\n";
+ else
+ $offer .= "" . $this->PrepareValue($arOffer[$key]) . "\n";
+ }
}
foreach ($this->propertiesSKU[$iblock['IBLOCK_DB']['ID']] as $key => $propProduct) {
- if ($propProduct != "" && $arOffer[$key] != null)
- $offer .= "<" . $key . ">" . $this->PrepareValue($arOffer[$key]) . "" . $key . ">\n";
+ if ($propProduct != "" && $arOffer[$key] != null) {
+ if ($key === "manufacturer")
+ $offer .= "" . $this->PrepareValue($arOffer[$key]) . "\n";
+ else
+ $offer .= "" . $this->PrepareValue($arOffer[$key]) . "\n";
+ }
}
$offer.= "\n";