Merge branch 'exportICMLSize'
This commit is contained in:
commit
75d44cd73e
@ -8,7 +8,9 @@ class ICMLLoader {
|
||||
public $iblocks;
|
||||
public $filename;
|
||||
public $propertiesSKU;
|
||||
public $propertiesUnitSKU;
|
||||
public $propertiesProduct;
|
||||
public $propertiesUnitProduct;
|
||||
public $application;
|
||||
public $encoding = 'utf-8';
|
||||
public $encodingDefault = 'utf-8';
|
||||
@ -21,6 +23,15 @@ class ICMLLoader {
|
||||
protected $logFile = '/bitrix/catalog_export/i_crm_load_log.txt';
|
||||
protected $fpLog;
|
||||
|
||||
protected $measurement = array (
|
||||
'mm' => 1,
|
||||
'cm' => 10,
|
||||
'm' => 1000,
|
||||
'mg' => 0.001,
|
||||
'g' => 1,
|
||||
'kg' => 1000,
|
||||
);
|
||||
|
||||
public function Load()
|
||||
{
|
||||
global $USER;
|
||||
@ -270,7 +281,8 @@ class ICMLLoader {
|
||||
|
||||
// Compile products to array
|
||||
$products[$product['ID']] = $product;
|
||||
|
||||
$products[$product['ID']]['offers'] = array();
|
||||
|
||||
$detailPicture = intval($product["DETAIL_PICTURE"]);
|
||||
$previewPicture = intval($product["PREVIEW_PICTURE"]);
|
||||
|
||||
@ -356,8 +368,14 @@ class ICMLLoader {
|
||||
|
||||
if (isset ($product["PROPERTY_" . $propProduct . "_NAME"]))
|
||||
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"];
|
||||
else
|
||||
elseif (isset ($product[$propProduct]))
|
||||
$resPropertiesProduct[$key] = $product[$propProduct];
|
||||
else
|
||||
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
|
||||
|
||||
if (array_key_exists($key, $this->propertiesUnitProduct[$id])) {
|
||||
$resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,6 +399,7 @@ class ICMLLoader {
|
||||
if (!empty($iblockOffer['IBLOCK_ID'])) {
|
||||
|
||||
foreach ($product['offers'] as $offer) {
|
||||
|
||||
|
||||
$offer['PRODUCT_ID'] = $product["ID"];
|
||||
$offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"];
|
||||
@ -396,11 +415,18 @@ class ICMLLoader {
|
||||
|
||||
if ($propSKU != "") {
|
||||
|
||||
if (isset ($product["PROPERTY_" . $propSKU . "_NAME"]))
|
||||
$offer[$key] = $product["PROPERTY_" . $propSKU . "_NAME"];
|
||||
if (isset ($offer["PROPERTY_" . $propSKU . "_NAME"]))
|
||||
$offer[$key] = $offer["PROPERTY_" . $propSKU . "_NAME"];
|
||||
elseif (isset ($offer[$propSKU]))
|
||||
$offer[$key] = $offer[$propSKU];
|
||||
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) {
|
||||
@ -421,8 +447,9 @@ class ICMLLoader {
|
||||
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
|
||||
|
||||
foreach ($resPropertiesProduct as $key => $propProduct) {
|
||||
if ($this->propertiesProduct[$id][$key] != "")
|
||||
if ($this->propertiesProduct[$id][$key] != "") {
|
||||
$product[$key] = $propProduct;
|
||||
}
|
||||
}
|
||||
|
||||
$stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories);
|
||||
@ -489,6 +516,10 @@ class ICMLLoader {
|
||||
if ($propProduct != "" && $arOffer[$key] != null)
|
||||
$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";
|
||||
return $offer;
|
||||
|
@ -16,9 +16,20 @@ $iblockProperties = Array(
|
||||
"color" =>"color",
|
||||
"weight" => "weight",
|
||||
"size" => "size",
|
||||
"length" => "length",
|
||||
"width" => "width",
|
||||
"height" => "height",
|
||||
);
|
||||
$IBLOCK_PROPERTY_SKU = array();
|
||||
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||
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 = $$skuProps;
|
||||
foreach ($skuProps as $iblock => $val) {
|
||||
@ -26,10 +37,18 @@ foreach ($iblockProperties as $prop) {
|
||||
}
|
||||
}
|
||||
$IBLOCK_PROPERTY_PRODUCT = array();
|
||||
$IBLOCK_PROPERTY_UNIT_PRODUCT = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
$skuProps = "IBLOCK_PROPERTY_PRODUCT" . "_" . $prop;
|
||||
$skuProps = $$skuProps;
|
||||
foreach ($skuProps as $iblock => $val) {
|
||||
|
||||
$productUnitProps = "IBLOCK_PROPERTY_UNIT_PRODUCT" . "_" . $prop;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@ -38,7 +57,9 @@ foreach ($iblockProperties as $prop) {
|
||||
$loader = new ICMLLoader();
|
||||
$loader->iblocks = $IBLOCK_EXPORT;
|
||||
$loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
|
||||
$loader->propertiesUnitSKU = $IBLOCK_PROPERTY_UNIT_SKU;
|
||||
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
|
||||
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
|
||||
$loader->filename = $SETUP_FILE_NAME;
|
||||
$loader->application = $APPLICATION;
|
||||
$loader->Load();
|
@ -4,8 +4,11 @@ $iblockProperties = Array(
|
||||
"article" => "article",
|
||||
"manufacturer" => "manufacturer",
|
||||
"color" =>"color",
|
||||
"weight" => "weight",
|
||||
"size" => "size",
|
||||
"weight" => "weight",
|
||||
"length" => "length",
|
||||
"width" => "width",
|
||||
"height" => "height",
|
||||
);
|
||||
|
||||
if(!check_bitrix_sessid()) return;
|
||||
@ -14,7 +17,6 @@ __IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.
|
||||
|
||||
if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
||||
{
|
||||
|
||||
|
||||
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
|
||||
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
|
||||
@ -24,16 +26,26 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'
|
||||
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
|
||||
|
||||
$IBLOCK_PROPERTY_SKU = array();
|
||||
$IBLOCK_PROPERTY_UNIT_SKU = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($arOldSetupVars['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $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_UNIT_PRODUCT = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $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"),
|
||||
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
||||
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
||||
"weight" => GetMessage("PROPERTY_WEIGHT_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(
|
||||
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
||||
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
||||
"color" => Array("COLOR", "CVET"),
|
||||
"weight" => Array("WEIGHT", "VES", "VEC"),
|
||||
"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;
|
||||
$intCountChecked = 0;
|
||||
$intCountAvailIBlock = 0;
|
||||
$arIBlockList = array();
|
||||
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
||||
|
||||
while ($iblock = $db_res->Fetch())
|
||||
{
|
||||
if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
|
||||
@ -136,6 +180,13 @@ if ($STEP==1)
|
||||
$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();
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
@ -172,7 +230,9 @@ if ($STEP==1)
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
@ -190,9 +250,6 @@ if ($STEP==1)
|
||||
$boolAll = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></font>
|
||||
@ -241,80 +298,219 @@ if ($STEP==1)
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||
<? $productSelected = false;?>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||
|
||||
<? $productSelected = false;?>
|
||||
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
</td>
|
||||
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<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): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<option value=""></option>
|
||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)){?>
|
||||
</optgroup>
|
||||
<?}?>
|
||||
|
||||
</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>
|
||||
<? endif;?>
|
||||
</tr>
|
||||
|
||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<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): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
echo " selected";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
<? if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) : ?>
|
||||
</optgroup>
|
||||
<? endif; ?>
|
||||
</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>
|
||||
|
||||
<? endif;?>
|
||||
</tr>
|
||||
|
||||
<? endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -444,7 +640,9 @@ if ($STEP==1)
|
||||
$vals = "SETUP_FILE_NAME,IBLOCK_EXPORT";
|
||||
foreach ($iblockProperties as $val) {
|
||||
$vals .= ",IBLOCK_PROPERTY_SKU_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_PRODUCT_" . $val;
|
||||
$vals .= ",IBLOCK_PROPERTY_UNIT_PRODUCT_" . $val;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -832,20 +832,31 @@ class intaro_intarocrm extends CModule {
|
||||
"color" =>"color",
|
||||
"weight" => "weight",
|
||||
"size" => "size",
|
||||
"length" => "length",
|
||||
"width" => "width",
|
||||
"height" => "height",
|
||||
);
|
||||
|
||||
$propertiesSKU = array();
|
||||
$propertiesUnitSKU = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($_POST['IBLOCK_PROPERTY_SKU'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesSKU[$iblock][$prop] = $val;
|
||||
}
|
||||
foreach ($_POST['IBLOCK_PROPERTY_UNIT_SKU'. '_' . $prop] as $iblock => $val) {
|
||||
$propertiesUnitSKU[$iblock][$prop] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$propertiesProduct = array();
|
||||
$propertiesUnitProduct = array();
|
||||
foreach ($iblockProperties as $prop) {
|
||||
foreach ($_POST['IBLOCK_PROPERTY_PRODUCT'. '_' . $prop] as $iblock => $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']))
|
||||
@ -874,7 +885,9 @@ class intaro_intarocrm extends CModule {
|
||||
$arOldValues = Array(
|
||||
'IBLOCK_EXPORT' => $iblocks,
|
||||
'IBLOCK_PROPERTY_SKU' => $propertiesSKU,
|
||||
'IBLOCK_PROPERTY_UNIT_SKU' => $propertiesUnitSKU,
|
||||
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
|
||||
'IBLOCK_PROPERTY_UNIT_PRODUCT' => $propertiesUnitProduct,
|
||||
'SETUP_FILE_NAME' => $filename,
|
||||
'SETUP_PROFILE_NAME' => $profileName
|
||||
);
|
||||
@ -882,7 +895,7 @@ class intaro_intarocrm extends CModule {
|
||||
$oldValues = $arOldValues;
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
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;
|
||||
}
|
||||
@ -899,7 +912,9 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
$loader = new ICMLLoader();
|
||||
$loader->iblocks = $iblocks;
|
||||
$loader->propertiesUnitProduct = $propertiesUnitProduct;
|
||||
$loader->propertiesProduct = $propertiesProduct;
|
||||
$loader->propertiesUnitSKU = $propertiesUnitSKU;
|
||||
$loader->propertiesSKU = $propertiesSKU;
|
||||
$loader->filename = $filename;
|
||||
$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(
|
||||
"LAST_USE" => false,
|
||||
"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');
|
||||
}
|
||||
|
||||
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename) {
|
||||
function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesUnitProduct, $propertiesSKU, $propertiesUnitSKU, $filename) {
|
||||
// Get string like IBLOCK_EXPORT[0]=3&
|
||||
// IBLOCK_EXPORT[1]=6&
|
||||
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
|
||||
@ -1113,9 +1128,15 @@ class intaro_intarocrm extends CModule {
|
||||
foreach ($propertiesSKU as $iblock => $arr)
|
||||
foreach ($arr as $id => $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 ($arr as $id => $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);
|
||||
|
||||
|
@ -12,7 +12,9 @@ global $oldValues;
|
||||
if (!empty($oldValues)) {
|
||||
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
||||
$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_UNIT_PRODUCT = $oldValues['IBLOCK_PROPERTY_UNIT_PRODUCT'];
|
||||
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
||||
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
||||
}
|
||||
@ -33,22 +35,55 @@ if (!empty($oldValues)) {
|
||||
{
|
||||
$IBLOCK_EXPORT = array();
|
||||
}
|
||||
|
||||
|
||||
$iblockPropertiesName = Array(
|
||||
"article" => GetMessage("PROPERTY_ARTICLE_HEADER_NAME"),
|
||||
"manufacturer" => GetMessage("PROPERTY_MANUFACTURER_HEADER_NAME"),
|
||||
"color" => GetMessage("PROPERTY_COLOR_HEADER_NAME"),
|
||||
"weight" => GetMessage("PROPERTY_WEIGHT_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(
|
||||
"article" => Array("ARTICLE", "ART", "ARTNUMBER", "ARTICUL", "ARTIKUL"),
|
||||
"manufacturer" => Array("MANUFACTURER", "PROISVODITEL", "PROISVOD", "PROISV"),
|
||||
"color" => Array("COLOR", "CVET"),
|
||||
"weight" => Array("WEIGHT", "VES", "VEC"),
|
||||
"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;
|
||||
@ -77,6 +112,12 @@ if (!empty($oldValues)) {
|
||||
$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();
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
@ -113,7 +161,9 @@ if (!empty($oldValues)) {
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_UNIT_SKU_SELECT' => $oldPropertyUnitSKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'OLD_PROPERTY_UNIT_PRODUCT_SELECT' => $oldPropertyUnitProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
@ -180,79 +230,212 @@ if (!empty($oldValues)) {
|
||||
<tbody>
|
||||
|
||||
<? foreach ($iblockPropertiesName as $key => $property): ?>
|
||||
<? $productSelected = false;?>
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
|
||||
<? $productSelected = false;?>
|
||||
|
||||
<tr class="adm-list-table-row">
|
||||
<td class="adm-list-table-cell">
|
||||
<? echo htmlspecialcharsex($property); ?>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<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): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<option value=""></option>
|
||||
<? foreach ($arIBlock['PROPERTIES_SKU'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
<?if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)){?>
|
||||
</optgroup>
|
||||
<?}?>
|
||||
</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>
|
||||
<? endif;?>
|
||||
</tr>
|
||||
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
|
||||
<td class="adm-list-table-cell">
|
||||
<select
|
||||
style="width: 200px;"
|
||||
id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_SKU_<?=$key?>[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
|
||||
<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): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if (!$productSelected) {
|
||||
if ($arIBlock['OLD_PROPERTY_SKU_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_SKU_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
}
|
||||
} else {
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
echo " selected";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<? endforeach;?>
|
||||
<? if (version_compare(SM_VERSION, '14.0.0', '>=') && array_key_exists($key, $iblockFieldsName)) : ?>
|
||||
</optgroup>
|
||||
<? endif; ?>
|
||||
</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>
|
||||
<? endif;?>
|
||||
</tr>
|
||||
<? endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -381,6 +564,13 @@ if (!empty($oldValues)) {
|
||||
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||
}
|
||||
};
|
||||
function checkProfile(obj)
|
||||
{
|
||||
if (obj.value !== 'none')
|
||||
$('#profile-field').show();
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -23,6 +23,21 @@ $MESS["PROPERTY_OFFER_HEADER_NAME"] = "Свойство торгового пр
|
||||
$MESS["PROPERTY_ARTICLE_HEADER_NAME"] = "Артикул";
|
||||
$MESS["PROPERTY_MANUFACTURER_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["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