Merge branch 'exportICMLSize'
This commit is contained in:
commit
75d44cd73e
@ -8,7 +8,9 @@ class ICMLLoader {
|
|||||||
public $iblocks;
|
public $iblocks;
|
||||||
public $filename;
|
public $filename;
|
||||||
public $propertiesSKU;
|
public $propertiesSKU;
|
||||||
|
public $propertiesUnitSKU;
|
||||||
public $propertiesProduct;
|
public $propertiesProduct;
|
||||||
|
public $propertiesUnitProduct;
|
||||||
public $application;
|
public $application;
|
||||||
public $encoding = 'utf-8';
|
public $encoding = 'utf-8';
|
||||||
public $encodingDefault = 'utf-8';
|
public $encodingDefault = 'utf-8';
|
||||||
@ -21,6 +23,15 @@ class ICMLLoader {
|
|||||||
protected $logFile = '/bitrix/catalog_export/i_crm_load_log.txt';
|
protected $logFile = '/bitrix/catalog_export/i_crm_load_log.txt';
|
||||||
protected $fpLog;
|
protected $fpLog;
|
||||||
|
|
||||||
|
protected $measurement = array (
|
||||||
|
'mm' => 1,
|
||||||
|
'cm' => 10,
|
||||||
|
'm' => 1000,
|
||||||
|
'mg' => 0.001,
|
||||||
|
'g' => 1,
|
||||||
|
'kg' => 1000,
|
||||||
|
);
|
||||||
|
|
||||||
public function Load()
|
public function Load()
|
||||||
{
|
{
|
||||||
global $USER;
|
global $USER;
|
||||||
@ -270,6 +281,7 @@ class ICMLLoader {
|
|||||||
|
|
||||||
// Compile products to array
|
// Compile products to array
|
||||||
$products[$product['ID']] = $product;
|
$products[$product['ID']] = $product;
|
||||||
|
$products[$product['ID']]['offers'] = array();
|
||||||
|
|
||||||
$detailPicture = intval($product["DETAIL_PICTURE"]);
|
$detailPicture = intval($product["DETAIL_PICTURE"]);
|
||||||
$previewPicture = intval($product["PREVIEW_PICTURE"]);
|
$previewPicture = intval($product["PREVIEW_PICTURE"]);
|
||||||
@ -356,8 +368,14 @@ class ICMLLoader {
|
|||||||
|
|
||||||
if (isset ($product["PROPERTY_" . $propProduct . "_NAME"]))
|
if (isset ($product["PROPERTY_" . $propProduct . "_NAME"]))
|
||||||
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"];
|
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"];
|
||||||
|
elseif (isset ($product[$propProduct]))
|
||||||
|
$resPropertiesProduct[$key] = $product[$propProduct];
|
||||||
else
|
else
|
||||||
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
|
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
|
||||||
|
|
||||||
|
if (array_key_exists($key, $this->propertiesUnitProduct[$id])) {
|
||||||
|
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,6 +400,7 @@ class ICMLLoader {
|
|||||||
|
|
||||||
foreach ($product['offers'] as $offer) {
|
foreach ($product['offers'] as $offer) {
|
||||||
|
|
||||||
|
|
||||||
$offer['PRODUCT_ID'] = $product["ID"];
|
$offer['PRODUCT_ID'] = $product["ID"];
|
||||||
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
||||||
$offer['PICTURE'] = $product["PICTURE"];
|
$offer['PICTURE'] = $product["PICTURE"];
|
||||||
@ -396,13 +415,20 @@ class ICMLLoader {
|
|||||||
|
|
||||||
if ($propSKU != "") {
|
if ($propSKU != "") {
|
||||||
|
|
||||||
if (isset ($product["PROPERTY_" . $propSKU . "_NAME"]))
|
if (isset ($offer["PROPERTY_" . $propSKU . "_NAME"]))
|
||||||
$offer[$key] = $product["PROPERTY_" . $propSKU . "_NAME"];
|
$offer[$key] = $offer["PROPERTY_" . $propSKU . "_NAME"];
|
||||||
|
elseif (isset ($offer[$propSKU]))
|
||||||
|
$offer[$key] = $offer[$propSKU];
|
||||||
else
|
else
|
||||||
$offer[$key] = $product["PROPERTY_" . $propSKU . "_VALUE"];
|
$offer[$key] = $offer["PROPERTY_" . $propSKU . "_VALUE"];
|
||||||
|
|
||||||
|
if (array_key_exists($key, $this->propertiesUnitSKU[$id])) {
|
||||||
|
$offer[$key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($resPropertiesProduct as $key => $propProduct) {
|
foreach ($resPropertiesProduct as $key => $propProduct) {
|
||||||
if ($this->propertiesProduct[$id][$key] != "" && !isset($offer[$key]))
|
if ($this->propertiesProduct[$id][$key] != "" && !isset($offer[$key]))
|
||||||
$offer[$key] = $propProduct;
|
$offer[$key] = $propProduct;
|
||||||
@ -421,9 +447,10 @@ class ICMLLoader {
|
|||||||
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
|
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
|
||||||
|
|
||||||
foreach ($resPropertiesProduct as $key => $propProduct) {
|
foreach ($resPropertiesProduct as $key => $propProduct) {
|
||||||
if ($this->propertiesProduct[$id][$key] != "")
|
if ($this->propertiesProduct[$id][$key] != "") {
|
||||||
$product[$key] = $propProduct;
|
$product[$key] = $propProduct;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories);
|
$stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories);
|
||||||
}
|
}
|
||||||
@ -489,6 +516,10 @@ class ICMLLoader {
|
|||||||
if ($propProduct != "" && $arOffer[$key] != null)
|
if ($propProduct != "" && $arOffer[$key] != null)
|
||||||
$offer .= "<" . $key . ">" . $this->PrepareValue($arOffer[$key]) . "</" . $key . ">\n";
|
$offer .= "<" . $key . ">" . $this->PrepareValue($arOffer[$key]) . "</" . $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";
|
||||||
|
}
|
||||||
|
|
||||||
$offer.= "</offer>\n";
|
$offer.= "</offer>\n";
|
||||||
return $offer;
|
return $offer;
|
||||||
|
@ -16,9 +16,20 @@ $iblockProperties = Array(
|
|||||||
"color" =>"color",
|
"color" =>"color",
|
||||||
"weight" => "weight",
|
"weight" => "weight",
|
||||||
"size" => "size",
|
"size" => "size",
|
||||||
|
"length" => "length",
|
||||||
|
"width" => "width",
|
||||||
|
"height" => "height",
|
||||||
);
|
);
|
||||||
$IBLOCK_PROPERTY_SKU = array();
|
$IBLOCK_PROPERTY_SKU = array();
|
||||||
|
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
|
|
||||||
|
$skuUnitProps = ('IBLOCK_PROPERTY_UNIT_SKU' . "_" . $prop);
|
||||||
|
$skuUnitProps = $$skuUnitProps;
|
||||||
|
foreach ($skuUnitProps as $iblock => $val) {
|
||||||
|
$IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
$skuProps = ('IBLOCK_PROPERTY_SKU' . "_" . $prop);
|
$skuProps = ('IBLOCK_PROPERTY_SKU' . "_" . $prop);
|
||||||
$skuProps = $$skuProps;
|
$skuProps = $$skuProps;
|
||||||
foreach ($skuProps as $iblock => $val) {
|
foreach ($skuProps as $iblock => $val) {
|
||||||
@ -26,10 +37,18 @@ foreach ($iblockProperties as $prop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||||
|
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
$skuProps = "IBLOCK_PROPERTY_PRODUCT" . "_" . $prop;
|
|
||||||
$skuProps = $$skuProps;
|
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
|
||||||
foreach ($skuProps as $iblock => $val) {
|
$productUnitProps = $$productUnitProps;
|
||||||
|
foreach ($productUnitProps as $iblock => $val) {
|
||||||
|
$IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
$productProps = "IBLOCK_PROPERTY_PRODUCT" . "_" . $prop;
|
||||||
|
$productProps = $$productProps;
|
||||||
|
foreach ($productProps as $iblock => $val) {
|
||||||
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +57,9 @@ foreach ($iblockProperties as $prop) {
|
|||||||
$loader = new ICMLLoader();
|
$loader = new ICMLLoader();
|
||||||
$loader->iblocks = $IBLOCK_EXPORT;
|
$loader->iblocks = $IBLOCK_EXPORT;
|
||||||
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
|
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
|
||||||
|
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
||||||
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
||||||
|
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
|
||||||
$loader->filename = $SETUP_FILE_NAME;
|
$loader->filename = $SETUP_FILE_NAME;
|
||||||
$loader->application = $APPLICATION;
|
$loader->application = $APPLICATION;
|
||||||
$loader->Load();
|
$loader->Load();
|
@ -4,8 +4,11 @@ $iblockProperties = Array(
|
|||||||
"article" => "article",
|
"article" => "article",
|
||||||
"manufacturer" => "manufacturer",
|
"manufacturer" => "manufacturer",
|
||||||
"color" =>"color",
|
"color" =>"color",
|
||||||
"weight" => "weight",
|
|
||||||
"size" => "size",
|
"size" => "size",
|
||||||
|
"weight" => "weight",
|
||||||
|
"length" => "length",
|
||||||
|
"width" => "width",
|
||||||
|
"height" => "height",
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!check_bitrix_sessid()) return;
|
if(!check_bitrix_sessid()) return;
|
||||||
@ -15,7 +18,6 @@ __IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.
|
|||||||
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
||||||
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
|
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
|
||||||
if (isset($arOldSetupVars['SETUP_PROFILE_NAME']))
|
if (isset($arOldSetupVars['SETUP_PROFILE_NAME']))
|
||||||
@ -24,16 +26,26 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'
|
|||||||
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
|
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
|
||||||
|
|
||||||
$IBLOCK_PROPERTY_SKU = array();
|
$IBLOCK_PROPERTY_SKU = array();
|
||||||
|
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
|
$IBLOCK_PROPERTY_SKU[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
|
foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
|
$IBLOCK_PROPERTY_UNIT_SKU[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||||
|
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
$IBLOCK_PROPERTY_PRODUCT[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
|
foreach ($arOldSetupVars['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
|
$IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock][$prop] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,24 +109,56 @@ if ($STEP==1)
|
|||||||
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
|
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
|
||||||
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
||||||
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
||||||
"weight" => GetMessage("PROPERTY_WEIGHT_HEADER_NAME"),
|
|
||||||
"size" => GetMessage("PROPERTY_SIZE_HEADER_NAME"),
|
"size" => GetMessage("PROPERTY_SIZE_HEADER_NAME"),
|
||||||
|
"weight" => GetMessage("PROPERTY_WEIGHT_HEADER_NAME"),
|
||||||
|
"length" => GetMessage("PROPERTY_LENGTH_HEADER_NAME"),
|
||||||
|
"width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"),
|
||||||
|
"height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"),
|
||||||
|
);
|
||||||
|
|
||||||
|
$iblockFieldsName = Array(
|
||||||
|
|
||||||
|
"weight" => Array("code" => "catalog_size" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'),
|
||||||
|
"length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
|
"width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
|
"height" => Array("code" => "catalog_height" , "name" => GetMessage("SELECT_HEIGHT_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$iblockPropertiesHint = Array(
|
$iblockPropertiesHint = Array(
|
||||||
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
||||||
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
||||||
"color" => Array("COLOR", "CVET"),
|
"color" => Array("COLOR", "CVET"),
|
||||||
"weight" => Array("WEIGHT", "VES", "VEC"),
|
|
||||||
"size" => Array("SIZE", "RAZMER"),
|
"size" => Array("SIZE", "RAZMER"),
|
||||||
|
"weight" => Array("WEIGHT", "VES", "VEC"),
|
||||||
|
"length" => Array("LENGTH", "DLINA"),
|
||||||
|
"width" => Array("WIDTH", "SHIRINA"),
|
||||||
|
"height" => Array("HEIGHT", "VISOTA"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$units = Array(
|
||||||
|
'length' => Array(
|
||||||
|
'mm' => GetMessage("UNIT_MEASUREMENT_MM"),
|
||||||
|
'cm' => GetMessage("UNIT_MEASUREMENT_CM"),
|
||||||
|
'm' => GetMessage("UNIT_MEASUREMENT_M"),
|
||||||
|
),
|
||||||
|
'mass' => Array(
|
||||||
|
'mg' => GetMessage("UNIT_MEASUREMENT_MG"),
|
||||||
|
'g' => GetMessage("UNIT_MEASUREMENT_G"),
|
||||||
|
'kg' => GetMessage("UNIT_MEASUREMENT_KG"),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$hintUnit = Array(
|
||||||
|
'length' => 'mm',
|
||||||
|
'mass' => 'g'
|
||||||
|
);
|
||||||
|
|
||||||
$boolAll = false;
|
$boolAll = false;
|
||||||
$intCountChecked = 0;
|
$intCountChecked = 0;
|
||||||
$intCountAvailIBlock = 0;
|
$intCountAvailIBlock = 0;
|
||||||
$arIBlockList = array();
|
$arIBlockList = array();
|
||||||
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
||||||
|
|
||||||
while ($iblock = $db_res->Fetch())
|
while ($iblock = $db_res->Fetch())
|
||||||
{
|
{
|
||||||
if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
|
if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
|
||||||
@ -136,6 +180,13 @@ if ($STEP==1)
|
|||||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldPropertyUnitSKU = null;
|
||||||
|
if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) {
|
||||||
|
foreach ($iblockPropertiesName as $key => $prop) {
|
||||||
|
$oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,6 +202,13 @@ if ($STEP==1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldPropertyUnitProduct = null;
|
||||||
|
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
|
||||||
|
foreach ($iblockPropertiesName as $key => $prop) {
|
||||||
|
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$arSiteList = array();
|
$arSiteList = array();
|
||||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||||
while ($arSite = $rsSites->Fetch())
|
while ($arSite = $rsSites->Fetch())
|
||||||
@ -172,7 +230,9 @@ if ($STEP==1)
|
|||||||
'PROPERTIES_SKU' => $propertiesSKU,
|
'PROPERTIES_SKU' => $propertiesSKU,
|
||||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||||
|
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||||
|
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -190,9 +250,6 @@ if ($STEP==1)
|
|||||||
$boolAll = true;
|
$boolAll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></font>
|
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></font>
|
||||||
@ -242,11 +299,14 @@ if ($STEP==1)
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||||
|
|
||||||
<? $productSelected = false;?>
|
<? $productSelected = false;?>
|
||||||
|
|
||||||
<tr class="adm-list-table-row">
|
<tr class="adm-list-table-row">
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
<? echo htmlspecialcharsex($property); ?>
|
<? echo htmlspecialcharsex($property); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
<select
|
<select
|
||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
@ -255,6 +315,39 @@ if ($STEP==1)
|
|||||||
class="property-export"
|
class="property-export"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName) && $arIBlock['PROPERTIES_SKU'] == null) :?>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_FIELD_NAME");?>">
|
||||||
|
<? foreach ($iblockFieldsName as $keyField => $field): ?>
|
||||||
|
|
||||||
|
<? if ($keyField == $key): ?>
|
||||||
|
<option value="<?=$field['code'];?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||||
|
if ($field['code'] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
$productSelected = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
|
if ($field['code'] == $hint ) {
|
||||||
|
echo " selected";
|
||||||
|
$productSelected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
|
||||||
|
<?=$field['name'];?>
|
||||||
|
</option>
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
|
<? endforeach;?>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_PROPERTY_NAME");?>">
|
||||||
|
<?endif; ?>
|
||||||
|
|
||||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<option value="<?=$prop['CODE'] ?>"
|
||||||
<?
|
<?
|
||||||
@ -277,8 +370,43 @@ if ($STEP==1)
|
|||||||
<?=$prop["NAME"];?>
|
<?=$prop["NAME"];?>
|
||||||
</option>
|
</option>
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)){?>
|
||||||
|
</optgroup>
|
||||||
|
<?}?>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<select
|
||||||
|
style="width: 100px; margin-left: 50px;"
|
||||||
|
id="IBLOCK_PROPERTY_UNIT_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
|
name="IBLOCK_PROPERTY_UNIT_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
|
>
|
||||||
|
<? foreach ($units as $unitTypeName => $unitType): ?>
|
||||||
|
<? if ($unitTypeName == $iblockFieldsName[$key]['unit']): ?>
|
||||||
|
<? foreach ($unitType as $keyUnit => $unit): ?>
|
||||||
|
<option value="<?=$keyUnit;?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_UNIT_PRODUCT_SELECT'] != null) {
|
||||||
|
if ($keyUnit == $arIBlock['OLD_PROPERTY_UNIT_PRODUCT_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($keyUnit == $hintUnit[$unitTypeName]) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
<?=$unit?>
|
||||||
|
</option>
|
||||||
|
<? endforeach;?>
|
||||||
|
<?endif; ?>
|
||||||
|
<? endforeach;?>
|
||||||
|
</select>
|
||||||
|
<?endif; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
<select
|
<select
|
||||||
@ -289,6 +417,39 @@ if ($STEP==1)
|
|||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
|
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_FIELD_NAME");?>">
|
||||||
|
<? foreach ($iblockFieldsName as $keyField => $field): ?>
|
||||||
|
|
||||||
|
<? if ($keyField == $key) :?>
|
||||||
|
<option value="<?=$field['code'];?>"
|
||||||
|
<?
|
||||||
|
if (!$productSelected) {
|
||||||
|
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||||
|
if ($field['code'] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
|
if ($field['code'] == $hint ) {
|
||||||
|
echo " selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
|
||||||
|
<?=$field['name'];?>
|
||||||
|
</option>
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
|
<? endforeach;?>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_PROPERTY_NAME");?>">
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<option value="<?=$prop['CODE'] ?>"
|
||||||
<?
|
<?
|
||||||
@ -311,10 +472,45 @@ if ($STEP==1)
|
|||||||
<?=$prop["NAME"];?>
|
<?=$prop["NAME"];?>
|
||||||
</option>
|
</option>
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
|
<? if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) : ?>
|
||||||
|
</optgroup>
|
||||||
|
<? endif; ?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<select
|
||||||
|
style="width: 100px; margin-left: 50px;"
|
||||||
|
id="IBLOCK_PROPERTY_UNIT_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
|
name="IBLOCK_PROPERTY_UNIT_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
|
>
|
||||||
|
<? foreach ($units as $unitTypeName => $unitType): ?>
|
||||||
|
<? if ($unitTypeName == $iblockFieldsName[$key]['unit']): ?>
|
||||||
|
<? foreach ($unitType as $keyUnit => $unit): ?>
|
||||||
|
<option value="<?=$keyUnit;?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_UNIT_SKU_SELECT'] != null) {
|
||||||
|
if ($keyUnit == $arIBlock['OLD_PROPERTY_UNIT_SKU_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($keyUnit == $hintUnit[$unitTypeName]) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
<?=$unit?>
|
||||||
|
</option>
|
||||||
|
<? endforeach;?>
|
||||||
|
<?endif; ?>
|
||||||
|
<? endforeach;?>
|
||||||
|
</select>
|
||||||
|
<?endif; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -444,7 +640,9 @@ if ($STEP==1)
|
|||||||
$vals = "SETUP_FILE_NAME,IBLOCK_EXPORT";
|
$vals = "SETUP_FILE_NAME,IBLOCK_EXPORT";
|
||||||
foreach ($iblockProperties as $val) {
|
foreach ($iblockProperties as $val) {
|
||||||
$vals .= ",IBLOCK_PROPERTY_SKU_" . $val;
|
$vals .= ",IBLOCK_PROPERTY_SKU_" . $val;
|
||||||
|
$vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val;
|
||||||
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
||||||
|
$vals .= ",IBLOCK_PROPERTY_UNIT_PRODUCT_" . $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -832,20 +832,31 @@ class intaro_intarocrm extends CModule {
|
|||||||
"color" =>"color",
|
"color" =>"color",
|
||||||
"weight" => "weight",
|
"weight" => "weight",
|
||||||
"size" => "size",
|
"size" => "size",
|
||||||
|
"length" => "length",
|
||||||
|
"width" => "width",
|
||||||
|
"height" => "height",
|
||||||
);
|
);
|
||||||
|
|
||||||
$propertiesSKU = array();
|
$propertiesSKU = array();
|
||||||
|
$propertiesUnitSKU = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesSKU[$iblock][$prop] = $val;
|
$propertiesSKU[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
|
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||||
|
$propertiesUnitSKU[$iblock][$prop] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$propertiesProduct = array();
|
$propertiesProduct = array();
|
||||||
|
$propertiesUnitProduct = array();
|
||||||
foreach ($iblockProperties as $prop) {
|
foreach ($iblockProperties as $prop) {
|
||||||
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
$propertiesProduct[$iblock][$prop] = $val;
|
$propertiesProduct[$iblock][$prop] = $val;
|
||||||
}
|
}
|
||||||
|
foreach ($_POST['IBLOCK_PROPERTY_UNIT_PRODUCT'. '_' . $prop] as $iblock => $val) {
|
||||||
|
$propertiesUnitProduct[$iblock][$prop] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_POST['SETUP_FILE_NAME']))
|
if (!isset($_POST['SETUP_FILE_NAME']))
|
||||||
@ -874,7 +885,9 @@ class intaro_intarocrm extends CModule {
|
|||||||
$arOldValues = Array(
|
$arOldValues = Array(
|
||||||
'IBLOCK_EXPORT' => $iblocks,
|
'IBLOCK_EXPORT' => $iblocks,
|
||||||
'IBLOCK_PROPERTY_SKU' => $propertiesSKU,
|
'IBLOCK_PROPERTY_SKU' => $propertiesSKU,
|
||||||
|
'IBLOCK_PROPERTY_UNIT_SKU' => $propertiesUnitSKU,
|
||||||
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
|
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
|
||||||
|
'IBLOCK_PROPERTY_UNIT_PRODUCT' => $propertiesUnitProduct,
|
||||||
'SETUP_FILE_NAME' => $filename,
|
'SETUP_FILE_NAME' => $filename,
|
||||||
'SETUP_PROFILE_NAME' => $profileName
|
'SETUP_PROFILE_NAME' => $profileName
|
||||||
);
|
);
|
||||||
@ -882,7 +895,7 @@ class intaro_intarocrm extends CModule {
|
|||||||
$oldValues = $arOldValues;
|
$oldValues = $arOldValues;
|
||||||
$APPLICATION->IncludeAdminFile(
|
$APPLICATION->IncludeAdminFile(
|
||||||
GetMessage('MODULE_INSTALL_TITLE'),
|
GetMessage('MODULE_INSTALL_TITLE'),
|
||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step5.php'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -899,7 +912,9 @@ class intaro_intarocrm extends CModule {
|
|||||||
|
|
||||||
$loader = new ICMLLoader();
|
$loader = new ICMLLoader();
|
||||||
$loader->iblocks = $iblocks;
|
$loader->iblocks = $iblocks;
|
||||||
|
$loader->propertiesUnitProduct = $propertiesUnitProduct;
|
||||||
$loader->propertiesProduct = $propertiesProduct;
|
$loader->propertiesProduct = $propertiesProduct;
|
||||||
|
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
||||||
$loader->propertiesSKU = $propertiesSKU;
|
$loader->propertiesSKU = $propertiesSKU;
|
||||||
$loader->filename = $filename;
|
$loader->filename = $filename;
|
||||||
$loader->application = $APPLICATION;
|
$loader->application = $APPLICATION;
|
||||||
@ -918,7 +933,7 @@ class intaro_intarocrm extends CModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename);
|
$ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename);
|
||||||
$PROFILE_ID = CCatalogExport::Add(array(
|
$PROFILE_ID = CCatalogExport::Add(array(
|
||||||
"LAST_USE" => false,
|
"LAST_USE" => false,
|
||||||
"FILE_NAME" => $this->INTARO_CRM_EXPORT,
|
"FILE_NAME" => $this->INTARO_CRM_EXPORT,
|
||||||
@ -1099,7 +1114,7 @@ class intaro_intarocrm extends CModule {
|
|||||||
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename) {
|
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename) {
|
||||||
// Get string like IBLOCK_EXPORT[0]=3&
|
// Get string like IBLOCK_EXPORT[0]=3&
|
||||||
// IBLOCK_EXPORT[1]=6&
|
// IBLOCK_EXPORT[1]=6&
|
||||||
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
|
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
|
||||||
@ -1113,9 +1128,15 @@ class intaro_intarocrm extends CModule {
|
|||||||
foreach ($propertiesSKU as $iblock => $arr)
|
foreach ($propertiesSKU as $iblock => $arr)
|
||||||
foreach ($arr as $id => $val)
|
foreach ($arr as $id => $val)
|
||||||
$strVars .= 'IBLOCK_PROPERTY_SKU_' . $id . '[' . $iblock . ']=' . $val . '&';
|
$strVars .= 'IBLOCK_PROPERTY_SKU_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||||
|
foreach ($propertiesUnitSKU as $iblock => $arr)
|
||||||
|
foreach ($arr as $id => $val)
|
||||||
|
$strVars .= 'IBLOCK_PROPERTY_UNIT_SKU_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||||
foreach ($propertiesProduct as $iblock => $arr)
|
foreach ($propertiesProduct as $iblock => $arr)
|
||||||
foreach ($arr as $id => $val)
|
foreach ($arr as $id => $val)
|
||||||
$strVars .= 'IBLOCK_PROPERTY_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
|
$strVars .= 'IBLOCK_PROPERTY_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||||
|
foreach ($propertiesUnitProduct as $iblock => $arr)
|
||||||
|
foreach ($arr as $id => $val)
|
||||||
|
$strVars .= 'IBLOCK_PROPERTY_UNIT_PRODUCT_' . $id . '[' . $iblock . ']=' . $val . '&';
|
||||||
|
|
||||||
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
|
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ global $oldValues;
|
|||||||
if (!empty($oldValues)) {
|
if (!empty($oldValues)) {
|
||||||
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
||||||
$IBLOCK_PROPERTY_SKU = $oldValues['IBLOCK_PROPERTY_SKU'];
|
$IBLOCK_PROPERTY_SKU = $oldValues['IBLOCK_PROPERTY_SKU'];
|
||||||
|
$IBLOCK_PROPERTY_UNIT_SKU = $oldValues['IBLOCK_PROPERTY_UNIT_SKU'];
|
||||||
$IBLOCK_PROPERTY_PRODUCT = $oldValues['IBLOCK_PROPERTY_PRODUCT'];
|
$IBLOCK_PROPERTY_PRODUCT = $oldValues['IBLOCK_PROPERTY_PRODUCT'];
|
||||||
|
$IBLOCK_PROPERTY_UNIT_PRODUCT = $oldValues['IBLOCK_PROPERTY_UNIT_PRODUCT'];
|
||||||
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
||||||
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
||||||
}
|
}
|
||||||
@ -38,18 +40,51 @@ if (!empty($oldValues)) {
|
|||||||
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
|
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
|
||||||
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
||||||
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
||||||
"weight" => GetMessage("PROPERTY_WEIGHT_HEADER_NAME"),
|
|
||||||
"size" => GetMessage("PROPERTY_SIZE_HEADER_NAME"),
|
"size" => GetMessage("PROPERTY_SIZE_HEADER_NAME"),
|
||||||
|
"weight" => GetMessage("PROPERTY_WEIGHT_HEADER_NAME"),
|
||||||
|
"length" => GetMessage("PROPERTY_LENGTH_HEADER_NAME"),
|
||||||
|
"width" => GetMessage("PROPERTY_WIDTH_HEADER_NAME"),
|
||||||
|
"height" => GetMessage("PROPERTY_HEIGHT_HEADER_NAME"),
|
||||||
|
);
|
||||||
|
|
||||||
|
$iblockFieldsName = Array(
|
||||||
|
|
||||||
|
"weight" => Array("code" => "catalog_size" , "name" => GetMessage("SELECT_WEIGHT_PROPERTY_NAME"), 'unit' => 'mass'),
|
||||||
|
"length" => Array("code" => "catalog_length" , "name" => GetMessage("SELECT_LENGTH_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
|
"width" => Array("code" => "catalog_width" , "name" => GetMessage("SELECT_WIDTH_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
|
"height" => Array("code" => "catalog_height" , "name" => GetMessage("SELECT_HEIGHT_PROPERTY_NAME"), 'unit' => 'length'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$iblockPropertiesHint = Array(
|
$iblockPropertiesHint = Array(
|
||||||
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
||||||
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
||||||
"color" => Array("COLOR", "CVET"),
|
"color" => Array("COLOR", "CVET"),
|
||||||
"weight" => Array("WEIGHT", "VES", "VEC"),
|
|
||||||
"size" => Array("SIZE", "RAZMER"),
|
"size" => Array("SIZE", "RAZMER"),
|
||||||
|
"weight" => Array("WEIGHT", "VES", "VEC"),
|
||||||
|
"length" => Array("LENGTH", "DLINA"),
|
||||||
|
"width" => Array("WIDTH", "SHIRINA"),
|
||||||
|
"height" => Array("HEIGHT", "VISOTA"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$units = Array(
|
||||||
|
'length' => Array(
|
||||||
|
'mm' => GetMessage("UNIT_MEASUREMENT_MM"),
|
||||||
|
'cm' => GetMessage("UNIT_MEASUREMENT_CM"),
|
||||||
|
'm' => GetMessage("UNIT_MEASUREMENT_M"),
|
||||||
|
),
|
||||||
|
'mass' => Array(
|
||||||
|
'mg' => GetMessage("UNIT_MEASUREMENT_MG"),
|
||||||
|
'g' => GetMessage("UNIT_MEASUREMENT_G"),
|
||||||
|
'kg' => GetMessage("UNIT_MEASUREMENT_KG"),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$hintUnit = Array(
|
||||||
|
'length' => 'mm',
|
||||||
|
'mass' => 'g'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$boolAll = false;
|
$boolAll = false;
|
||||||
$intCountChecked = 0;
|
$intCountChecked = 0;
|
||||||
@ -77,6 +112,12 @@ if (!empty($oldValues)) {
|
|||||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$oldPropertyUnitSKU = null;
|
||||||
|
if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) {
|
||||||
|
foreach ($iblockPropertiesName as $key => $prop) {
|
||||||
|
$oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -92,6 +133,13 @@ if (!empty($oldValues)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldPropertyUnitProduct = null;
|
||||||
|
if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
|
||||||
|
foreach ($iblockPropertiesName as $key => $prop) {
|
||||||
|
$oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$arSiteList = array();
|
$arSiteList = array();
|
||||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||||
while ($arSite = $rsSites->Fetch())
|
while ($arSite = $rsSites->Fetch())
|
||||||
@ -113,7 +161,9 @@ if (!empty($oldValues)) {
|
|||||||
'PROPERTIES_SKU' => $propertiesSKU,
|
'PROPERTIES_SKU' => $propertiesSKU,
|
||||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||||
|
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||||
|
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -180,7 +230,9 @@ if (!empty($oldValues)) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||||
|
|
||||||
<? $productSelected = false;?>
|
<? $productSelected = false;?>
|
||||||
|
|
||||||
<tr class="adm-list-table-row">
|
<tr class="adm-list-table-row">
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
<? echo htmlspecialcharsex($property); ?>
|
<? echo htmlspecialcharsex($property); ?>
|
||||||
@ -193,6 +245,39 @@ if (!empty($oldValues)) {
|
|||||||
class="property-export"
|
class="property-export"
|
||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName) && $arIBlock['PROPERTIES_SKU'] == null) :?>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_FIELD_NAME");?>">
|
||||||
|
<? foreach ($iblockFieldsName as $keyField => $field): ?>
|
||||||
|
|
||||||
|
<? if ($keyField == $key): ?>
|
||||||
|
<option value="<?=$field['code'];?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||||
|
if ($field['code'] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
$productSelected = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
|
if ($field['code'] == $hint ) {
|
||||||
|
echo " selected";
|
||||||
|
$productSelected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
|
||||||
|
<?=$field['name'];?>
|
||||||
|
</option>
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
|
<? endforeach;?>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_PROPERTY_NAME");?>">
|
||||||
|
<?endif; ?>
|
||||||
|
|
||||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<option value="<?=$prop['CODE'] ?>"
|
||||||
<?
|
<?
|
||||||
@ -215,7 +300,40 @@ if (!empty($oldValues)) {
|
|||||||
<?=$prop["NAME"];?>
|
<?=$prop["NAME"];?>
|
||||||
</option>
|
</option>
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)){?>
|
||||||
|
</optgroup>
|
||||||
|
<?}?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<select
|
||||||
|
style="width: 100px; margin-left: 50px;"
|
||||||
|
id="IBLOCK_PROPERTY_UNIT_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
|
name="IBLOCK_PROPERTY_UNIT_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
|
>
|
||||||
|
<? foreach ($units as $unitTypeName => $unitType): ?>
|
||||||
|
<? if ($unitTypeName == $iblockFieldsName[$key]['unit']): ?>
|
||||||
|
<? foreach ($unitType as $keyUnit => $unit): ?>
|
||||||
|
<option value="<?=$keyUnit;?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_UNIT_PRODUCT_SELECT'] != null) {
|
||||||
|
if ($keyUnit == $arIBlock['OLD_PROPERTY_UNIT_PRODUCT_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($keyUnit == $hintUnit[$unitTypeName]) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
<?=$unit?>
|
||||||
|
</option>
|
||||||
|
<? endforeach;?>
|
||||||
|
<?endif; ?>
|
||||||
|
<? endforeach;?>
|
||||||
|
</select>
|
||||||
|
<?endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
@ -227,6 +345,38 @@ if (!empty($oldValues)) {
|
|||||||
onchange="propertyChange(this);">
|
onchange="propertyChange(this);">
|
||||||
|
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
|
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_FIELD_NAME");?>">
|
||||||
|
<? foreach ($iblockFieldsName as $keyField => $field): ?>
|
||||||
|
|
||||||
|
<? if ($keyField == $key) :?>
|
||||||
|
<option value="<?=$field['code'];?>"
|
||||||
|
<?
|
||||||
|
if (!$productSelected) {
|
||||||
|
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||||
|
if ($field['code'] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||||
|
if ($field['code'] == $hint ) {
|
||||||
|
echo " selected";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}?>
|
||||||
|
>
|
||||||
|
|
||||||
|
<?=$field['name'];?>
|
||||||
|
</option>
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
|
<? endforeach;?>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="<?=GetMessage("SELECT_PROPERTY_NAME");?>">
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||||
<option value="<?=$prop['CODE'] ?>"
|
<option value="<?=$prop['CODE'] ?>"
|
||||||
<?
|
<?
|
||||||
@ -249,7 +399,40 @@ if (!empty($oldValues)) {
|
|||||||
<?=$prop["NAME"];?>
|
<?=$prop["NAME"];?>
|
||||||
</option>
|
</option>
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
|
<? if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) : ?>
|
||||||
|
</optgroup>
|
||||||
|
<? endif; ?>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<?if (array_key_exists($key, $iblockFieldsName)) :?>
|
||||||
|
<select
|
||||||
|
style="width: 100px; margin-left: 50px;"
|
||||||
|
id="IBLOCK_PROPERTY_UNIT_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||||
|
name="IBLOCK_PROPERTY_UNIT_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||||
|
>
|
||||||
|
<? foreach ($units as $unitTypeName => $unitType): ?>
|
||||||
|
<? if ($unitTypeName == $iblockFieldsName[$key]['unit']): ?>
|
||||||
|
<? foreach ($unitType as $keyUnit => $unit): ?>
|
||||||
|
<option value="<?=$keyUnit;?>"
|
||||||
|
<?
|
||||||
|
if ($arIBlock['OLD_PROPERTY_UNIT_SKU_SELECT'] != null) {
|
||||||
|
if ($keyUnit == $arIBlock['OLD_PROPERTY_UNIT_SKU_SELECT'][$key] ) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($keyUnit == $hintUnit[$unitTypeName]) {
|
||||||
|
echo " selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
<?=$unit?>
|
||||||
|
</option>
|
||||||
|
<? endforeach;?>
|
||||||
|
<?endif; ?>
|
||||||
|
<? endforeach;?>
|
||||||
|
</select>
|
||||||
|
<?endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
</tr>
|
</tr>
|
||||||
@ -381,6 +564,13 @@ if (!empty($oldValues)) {
|
|||||||
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
function checkProfile(obj)
|
||||||
|
{
|
||||||
|
if (obj.value !== 'none')
|
||||||
|
$('#profile-field').show();
|
||||||
|
else
|
||||||
|
$('#profile-field').hide();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,21 @@ $MESS["PROPERTY_OFFER_HEADER_NAME"] = "Свойство торгового пр
|
|||||||
$MESS["PROPERTY_ARTICLE_HEADER_NAME"] = "Артикул";
|
$MESS["PROPERTY_ARTICLE_HEADER_NAME"] = "Артикул";
|
||||||
$MESS["PROPERTY_MANUFACTURER_HEADER_NAME"] = "Производитель";
|
$MESS["PROPERTY_MANUFACTURER_HEADER_NAME"] = "Производитель";
|
||||||
$MESS["PROPERTY_COLOR_HEADER_NAME"] = "Цвет";
|
$MESS["PROPERTY_COLOR_HEADER_NAME"] = "Цвет";
|
||||||
$MESS["PROPERTY_WEIGHT_HEADER_NAME"] = "Вес";
|
$MESS["PROPERTY_WEIGHT_HEADER_NAME"] = "Вес (габариты)";
|
||||||
|
$MESS["PROPERTY_LENGTH_HEADER_NAME"] = "Длина (габариты)";
|
||||||
|
$MESS["PROPERTY_WIDTH_HEADER_NAME"] = "Ширина (габариты)";
|
||||||
|
$MESS["PROPERTY_HEIGHT_HEADER_NAME"] = "Высота (габариты)";
|
||||||
$MESS["PROPERTY_SIZE_HEADER_NAME"] = "Размер";
|
$MESS["PROPERTY_SIZE_HEADER_NAME"] = "Размер";
|
||||||
|
$MESS["SELECT_FIELD_NAME"] = "Поле";
|
||||||
|
$MESS["SELECT_PROPERTY_NAME"] = "Свойства";
|
||||||
|
$MESS["SELECT_WEIGHT_PROPERTY_NAME"] = "Вec (грамм)";
|
||||||
|
$MESS["SELECT_LENGTH_PROPERTY_NAME"] = "Длина (мм.)";
|
||||||
|
$MESS["SELECT_WIDTH_PROPERTY_NAME"] = "Ширина (мм.)";
|
||||||
|
$MESS["SELECT_HEIGHT_PROPERTY_NAME"] = "Высота (мм.)";
|
||||||
|
$MESS["UNIT_MEASUREMENT_MM"] = "мм.";
|
||||||
|
$MESS["UNIT_MEASUREMENT_CM"] = "см.";
|
||||||
|
$MESS["UNIT_MEASUREMENT_M"] = "м.";
|
||||||
|
$MESS["UNIT_MEASUREMENT_MG"] = "мг.";
|
||||||
|
$MESS["UNIT_MEASUREMENT_G"] = "г.";
|
||||||
|
$MESS["UNIT_MEASUREMENT_KG"] = "кг.";
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user