1
0
mirror of synced 2024-11-25 23:06:08 +03:00

Extended properties add to export

This commit is contained in:
m.korolev 2013-09-13 16:15:54 +04:00
parent e8f55aa087
commit 596709946c
5 changed files with 619 additions and 309 deletions

View File

@ -4,12 +4,13 @@ class ICMLLoader {
public $iblocks; public $iblocks;
public $filename; public $filename;
public $articleProperties; public $propertiesSKU;
public $propertiesProduct;
public $application; public $application;
public $encoding = 'utf-8'; public $encoding = 'utf-8';
protected $fp; protected $fp;
protected $mainSection = 1000000; protected $mainSection = 1000000;
public function Load() public function Load()
{ {
@ -20,6 +21,8 @@ class ICMLLoader {
if (count($this->iblocks) < count($this->articleProperties)) if (count($this->iblocks) < count($this->articleProperties))
return false; return false;
$this->PrepareSettings();
$this->PrepareFile(); $this->PrepareFile();
$this->PreWriteCatalog(); $this->PreWriteCatalog();
@ -39,6 +42,20 @@ class ICMLLoader {
} }
protected function PrepareSettings()
{
foreach ($this->propertiesSKU as $iblock => $arr) {
foreach ($arr as $id => $sku) {
$this->propertiesSKU[$iblock][$id] = strtoupper($sku);
}
}
foreach ($this->propertiesProduct as $iblock => $arr) {
foreach ($arr as $id => $prod) {
$this->propertiesProduct[$iblock][$id] = strtoupper($prod);
}
}
}
protected function PrepareValue($text) protected function PrepareValue($text)
{ {
$newText = $this->application->ConvertCharset($text, LANG_CHARSET, $this->encoding); $newText = $this->application->ConvertCharset($text, LANG_CHARSET, $this->encoding);
@ -60,12 +77,11 @@ class ICMLLoader {
protected function PreWriteCatalog() protected function PreWriteCatalog()
{ {
@fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n"); @fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n
@fwrite($this->fp, "<shop>\n"); <shop>\n
<name>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n
@fwrite($this->fp, "<name>". $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n"); <company>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n"
);
@fwrite($this->fp, "<company>".$this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n");
} }
@ -96,8 +112,8 @@ class ICMLLoader {
protected function PostWriteCatalog() protected function PostWriteCatalog()
{ {
@fwrite($this->fp, "</shop>\n"); @fwrite($this->fp, "</shop>\n
@fwrite($this->fp, "</yml_catalog>\n"); </yml_catalog>\n");
} }
protected function CloseFile() protected function CloseFile()
@ -157,11 +173,9 @@ class ICMLLoader {
{ {
foreach ($this->iblocks as $key => $id) foreach ($this->iblocks as $key => $id)
{ {
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch(); $iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id); $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id);
$arSelect = Array ( $arSelect = Array (
"ID", "ID",
"LID", "LID",
@ -178,8 +192,10 @@ class ICMLLoader {
"DETAIL_PAGE_URL" "DETAIL_PAGE_URL"
); );
if (isset($this->articleProperties[$id])) foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
$arSelect[] = "PROPERTY_" . $this->articleProperties[$id]; if ($this->propertiesProduct[$id][$key] != "")
$arSelect[] = "PROPERTY_" . $propProduct;
}
$filter = Array ( $filter = Array (
@ -195,7 +211,23 @@ class ICMLLoader {
$product = $product->GetFields(); $product = $product->GetFields();
// Get categories in InfoBlock // Get properties of product
$resPropertiesProduct = Array();
foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
$resPropertiesProduct[$key] = "";
if ($propProduct != "") {
$propDesc = CIBlockProperty::GetByID($propProduct, $id)->GetNext();
if ($propDesc['PROPERTY_TYPE'] == 'E') {
$el = CIBlockElement::GetById($product["PROPERTY_" . $propProduct . "_VALUE"])->Fetch();
$resPropertiesProduct[$key] = $el['NAME'];
} else {
$resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"];
}
}
}
// Get categories of product
$categories = Array(); $categories = Array();
$dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true); $dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true);
while ($arResCategory = $dbResCategories->Fetch()) { while ($arResCategory = $dbResCategories->Fetch()) {
@ -214,7 +246,6 @@ class ICMLLoader {
$existOffer = false; $existOffer = false;
if (!empty($iblockOffer['IBLOCK_ID'])) { if (!empty($iblockOffer['IBLOCK_ID'])) {
$arFilterOffer = Array ( $arFilterOffer = Array (
'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'], 'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'],
'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => $product["ID"] 'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => $product["ID"]
@ -226,9 +257,11 @@ class ICMLLoader {
"DETAIL_PAGE_URL", "DETAIL_PAGE_URL",
"DETAIL_PICTURE" "DETAIL_PICTURE"
); );
if (isset($this->articleProperties[$id]))
$arSelectOffer[] = "PROPERTY_" . $this->articleProperties[$id];
foreach ($this->propertiesSKU[$id] as $key => $propSKU) {
if ($this->propertiesSKU[$id][$key] != "")
$arSelectOffer[] = "PROPERTY_" . $propSKU;
}
$rsOffers = CIBlockElement::GetList(array(), $arFilterOffer, false, false, $arSelectOffer); $rsOffers = CIBlockElement::GetList(array(), $arFilterOffer, false, false, $arSelectOffer);
while ($arOffer = $rsOffers->GetNext()) { while ($arOffer = $rsOffers->GetNext()) {
@ -241,8 +274,26 @@ class ICMLLoader {
$arOffer['DETAIL_PICTURE'] = $product["DETAIL_PICTURE"]; $arOffer['DETAIL_PICTURE'] = $product["DETAIL_PICTURE"];
$arOffer['PREVIEW_PICTURE'] = $product["PREVIEW_PICTURE"]; $arOffer['PREVIEW_PICTURE'] = $product["PREVIEW_PICTURE"];
$arOffer['PRODUCT_NAME'] = $product["NAME"]; $arOffer['PRODUCT_NAME'] = $product["NAME"];
if (isset($this->articleProperties[$id]))
$arOffer['ARTICLE'] = $product["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; // Get properties of offer
foreach ($this->propertiesSKU[$id] as $key => $propSKU) {
if ($propSKU != "") {
$propDesc = CIBlockProperty::GetByID($propSKU,$arOffer['ID'])->GetNext();
if ($propDesc['PROPERTY_TYPE'] == 'E') {
$el = CIBlockElement::GetById($product["PROPERTY_" . $propSKU . "_VALUE"])->Fetch();
$arOffer[$key] = $el['NAME'];
} else {
$arOffer[$key] = $arOffer["PROPERTY_" . $propSKU . "_VALUE"];
}
}
}
foreach ($resPropertiesProduct as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "")
$arOffer[$key] = $propProduct;
}
$dbPrice = GetCatalogProductPrice($arOffer["ID"],1); $dbPrice = GetCatalogProductPrice($arOffer["ID"],1);
$arOffer['PRICE'] = $dbPrice['PRICE']; $arOffer['PRICE'] = $dbPrice['PRICE'];
@ -258,8 +309,11 @@ class ICMLLoader {
$product['PRODUCT_ID'] = $product["ID"]; $product['PRODUCT_ID'] = $product["ID"];
$product['PRODUCT_NAME'] = $product["NAME"]; $product['PRODUCT_NAME'] = $product["NAME"];
if (isset($this->articleProperties[$id]))
$product['ARTICLE'] = $product["PROPERTY_" . $this->articleProperties[$id] . "_VALUE"]; foreach ($resPropertiesProduct as $key => $propProduct) {
if ($this->propertiesProduct[$id][$key] != "")
$product[$key] = $propProduct;
}
$dbPrice = GetCatalogProductPrice($product["ID"],1); $dbPrice = GetCatalogProductPrice($product["ID"],1);
$product['PRICE'] = $dbPrice['PRICE']; $product['PRICE'] = $dbPrice['PRICE'];
@ -323,8 +377,11 @@ class ICMLLoader {
$offer .= "<xmlId>" . $this->PrepareValue($arOffer["EXTERNAL_ID"]) . "</xmlId>\n"; $offer .= "<xmlId>" . $this->PrepareValue($arOffer["EXTERNAL_ID"]) . "</xmlId>\n";
$offer .= "<productName>" . $this->PrepareValue($arOffer["PRODUCT_NAME"]) . "</productName>\n"; $offer .= "<productName>" . $this->PrepareValue($arOffer["PRODUCT_NAME"]) . "</productName>\n";
if (isset($arOffer["ARTICLE"]))
$offer .= "<article>" . $this->PrepareValue($arOffer["ARTICLE"]) . "</article>\n"; foreach ($this->propertiesProduct[$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;

View File

@ -2,7 +2,6 @@
set_time_limit(0); set_time_limit(0);
global $APPLICATION; global $APPLICATION;
if (!CModule::IncludeModule("iblock")) if (!CModule::IncludeModule("iblock"))
return; return;
@ -13,7 +12,8 @@ if (!CModule::IncludeModule("intaro.intarocrm"))
$loader = new ICMLLoader(); $loader = new ICMLLoader();
$loader->iblocks = $IBLOCK_EXPORT; $loader->iblocks = $IBLOCK_EXPORT;
$loader->articleProperties = $IBLOCK_PROPERTY_ARTICLE; $loader->propertiesSKU = $IBLOCK_PROPERTY_SKU;
$loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
$loader->filename = $SETUP_FILE_NAME; $loader->filename = $SETUP_FILE_NAME;
$loader->application = $APPLICATION; $loader->application = $APPLICATION;
$loader->Load(); $loader->Load();

View File

@ -1,30 +1,29 @@
<? <?
if(!check_bitrix_sessid()) return; if(!check_bitrix_sessid()) return;
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php")); __IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
if (($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']))
$SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME']; $SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME'];
if (isset($arOldSetupVars['IBLOCK_EXPORT'])) if (isset($arOldSetupVars['IBLOCK_EXPORT']))
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT']; $IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
if (isset($arOldSetupVars['IBLOCK_PROPERTY_ARTICLE'])) if (isset($arOldSetupVars['IBLOCK_PROPERTY_SKU']))
$IBLOCK_PROPERTY_ARTICLE = $arOldSetupVars['IBLOCK_PROPERTY_ARTICLE']; $IBLOCK_PROPERTY_SKU = $arOldSetupVars['IBLOCK_PROPERTY_SKU'];
if (isset($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT']))
$IBLOCK_PROPERTY_PRODUCT = $arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'];
} }
if ($STEP>1) if ($STEP>1)
{ {
if (count($IBLOCK_EXPORT) < count($IBLOCK_PROPERTY_ARTICLE))
$arSetupErrors[] = GetMessage("ERROR_ARTICLE_NOT_SET");
if (strlen($SETUP_FILE_NAME)<=0) if (strlen($SETUP_FILE_NAME)<=0)
{ {
$arSetupErrors[] = GetMessage("CET_ERROR_NO_FILENAME"); $arSetupErrors[] = GetMessage("CET_ERROR_NO_FILENAME");
@ -54,12 +53,21 @@ if ($STEP==1)
?> ?>
<style type="text/css">
.iblock-export-table-display-none {
display: none;
}
</style>
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" > <form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') <?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY')
{ {
?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><? ?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><?
} }
?> ?>
<h3>Настройки инфоблоков</h3>
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font> <font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
<? <?
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT)) if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
@ -67,48 +75,92 @@ if ($STEP==1)
$IBLOCK_EXPORT = array(); $IBLOCK_EXPORT = array();
} }
$iblockPropertiesName = Array(
"article" => "Артикул",
"manufacturer" => "Производитель",
"color" => "Цвет",
"weight" => "Вес",
"size" => "Размер",
);
$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"),
);
$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 ($res = $db_res->Fetch()) while ($iblock = $db_res->Fetch())
{ {
if ($arCatalog = CCatalog::GetByIDExt($res["ID"])) if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
{ {
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P") if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
{ {
$arSiteList = array(); $propertiesSKU = null;
$rsSites = CIBlock::GetSite($res["ID"]); if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
while ($arSite = $rsSites->Fetch()) {
{ $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
$arSiteList[] = $arSite["SITE_ID"];
}
$db_properties = CIBlock::GetProperties($res['ID'], Array());
$properties = Array(); $db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
while($prop = $db_properties->Fetch()) while($prop = $db_properties->Fetch())
$properties[] = $prop; $propertiesSKU[] = $prop;
if (count($IBLOCK_EXPORT) != 0) $oldPropertySKU = null;
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT)); if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
else foreach ($iblockPropertiesName as $key => $prop) {
$boolExport = true; $oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
}
}
}
$arIBlockList[] = array(
'ID' => $res['ID'],
'NAME' => $res['NAME'],
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
'IBLOCK_EXPORT' => $boolExport,
'PROPERTIES' => $properties,
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
);
if ($boolExport) $propertiesProduct = null;
$intCountChecked++; $db_properties = CIBlock::GetProperties($iblock['ID'], Array());
$intCountAvailIBlock++; while($prop = $db_properties->Fetch())
$propertiesProduct[] = $prop;
$oldPropertyProduct = null;
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
}
}
$arSiteList = array();
$rsSites = CIBlock::GetSite($iblock["ID"]);
while ($arSite = $rsSites->Fetch())
{
$arSiteList[] = $arSite["SITE_ID"];
}
if (count($IBLOCK_EXPORT) != 0)
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
else
$boolExport = true;
$arIBlockList[] = array(
'ID' => $iblock['ID'],
'NAME' => $iblock['NAME'],
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
'IBLOCK_EXPORT' => $boolExport,
'PROPERTIES_SKU' => $propertiesSKU,
'PROPERTIES_PRODUCT' => $propertiesProduct,
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
);
if ($boolExport)
$intCountChecked++;
$intCountAvailIBlock++;
} }
} }
} }
@ -121,103 +173,146 @@ if ($STEP==1)
} }
?> ?>
<font class="text" style="font-weight: bold;">Выбрать все инфоблоки </font>
<input
style="vertical-align: middle;"
type="checkbox"
name="icml_export_all"
id="icml_export_all"
value="Y"
onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"
<? echo ($boolAll ? ' checked' : ''); ?>>
</br>
</br>
<div>
<? $checkBoxCounter = 0;?>
<? foreach ($arIBlockList as $key => $arIBlock):?>
<div>
<div>
<font class="text" style="font-weight: bold;"><? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?></font>
<input
type="checkbox"
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
id="IBLOCK_EXPORT<?=++$checkBoxCounter?>"
value="<?=$arIBlock["ID"]?>"
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
>
</div>
<br>
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>">
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
<thead>
<tr class="adm-list-table-header">
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Выгружаемое свойство</div>
</td>
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Свойство товара</div>
</td>
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Свойство торгового предложения</div>
</td>
<? endif;?>
</tr>
</thead>
<tbody>
<? foreach ($iblockPropertiesName as $key => $property): ?>
<table class="adm-list-table" id="export_setup"> <? $productSelected = false;?>
<thead> <tr class="adm-list-table-row">
<tr class="adm-list-table-header">
<td class="adm-list-table-cell"> <td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div> <? echo htmlspecialcharsex($property); ?>
</td> </td>
<td class="adm-list-table-cell"> <td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner"> <select
<?echo GetMessage("EXPORT2INTAROCML");?>&nbsp; style="width: 200px;"
</div> id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
</td> name="IBLOCK_PROPERTY_PRODUCT[<?=$arIBlock["ID"]?>][<?=$key?>]"
<td class="adm-list-table-cell"> class="property-export"
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div> onchange="propertyChange(this);">
</td> <option value=""></option>
</tr> <? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
</thead>
<tbody>
<tr class="adm-list-table-row">
<td class="adm-list-table-cell">
<?echo GetMessage("ALL_CATALOG");?>
</td>
<td class="adm-list-table-cell">
<input style="vertical-align: middle;" type="checkbox" name="icml_export_all" id="icml_export_all" value="Y" onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"<? echo ($boolAll ? ' checked' : ''); ?>>
</td>
<td class="adm-list-table-cell">
&nbsp;
</td>
</tr>
<?
foreach ($arIBlockList as $key => $arIBlock)
{
?>
<tr class="adm-list-table-row">
<td class="adm-list-table-cell" style="padding-left: 5em">
<? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?>
</td>
<td class="adm-list-table-cell">
<font class="tablebodytext">
<input
type="checkbox"
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
id="IBLOCK_EXPORT<?=$arIBlock["ID"]?>"
value="<?=$arIBlock["ID"]?>"
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
>
</font>
</td>
<td class="adm-list-table-cell">
<select
style="width: 200px;"
id="IBLOCK_PROPERTY_ARTICLE<?=$arIBlock["ID"]?>"
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
class="property-export">
<option value=""></option>
<?
foreach ($arIBlock['PROPERTIES'] as $prop)
{
?>
<option value="<?=$prop['CODE'] ?>" <option value="<?=$prop['CODE'] ?>"
<? <?
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){ if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
echo " selected"; if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
} else { echo " selected";
if ($arIBlock['OLD_PROPERTY_SELECT'] == "") { $productSelected = true;
if ($prop["CODE"] == "ARTICLE" || }
$prop["CODE"] == "ART" || } else {
$prop["CODE"] == "ARTNUMBER" ) foreach ($iblockPropertiesHint[$key] as $hint) {
if ($prop["CODE"] == $hint ) {
echo " selected"; echo " selected";
$productSelected = true;
break;
}
}
} }
} ?>
>
?>
>
<?=$prop["NAME"];?> <?=$prop["NAME"];?>
</option> </option>
<? <? endforeach;?>
} </select>
?> </td>
</select> <? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
</td> <td class="adm-list-table-cell">
</tr> <select
<? style="width: 200px;"
} id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
?> name="IBLOCK_PROPERTY_SKU[<?=$arIBlock["ID"]?>][<?=$key?>]"
</tbody> class="property-export"
</table> 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";
break;
}
}
}
}
?>
>
<?=$prop["NAME"];?>
</option>
<? endforeach;?>
</select>
</td>
<? endif;?>
</tr>
<? endforeach;?>
</tbody>
</table>
<br>
<br>
</div>
</div>
<? endforeach;?>
</div>
<input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>"> <input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>">
<br> <br>
<br>
<br> <h3>Настройки экспорта</h3>
<font class="text"><?=GetMessage("FILENAME");?><br><br></font> <font class="text"><?=GetMessage("FILENAME");?><br><br></font>
<input type="text" name="SETUP_FILE_NAME" <input type="text" name="SETUP_FILE_NAME"
@ -252,22 +347,74 @@ if ($STEP==1)
<script type="text/javascript"> <script type="text/javascript">
function checkAll(obj,cnt) function checkAll(obj,cnt)
{ {
var boolCheck = obj.checked; for (i = 0; i < cnt; i++)
for (i = 0; i < cnt; i++) {
{ if (obj.checked)
BX('IBLOCK_EXPORT'+i).checked = boolCheck; BX.removeClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
} }
BX('count_checked').value = (boolCheck ? cnt : 0); var table = BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_EXPORT_TABLE'));
if (obj.checked)
BX.removeClass(table,"iblock-export-table-display-none");
var easing = new BX.easing({
duration : 150,
start : {opacity : obj.checked ? 0 : 100 },
finish : {opacity: obj.checked ? 100 : 0 },
transition : BX.easing.transitions.linear,
step : function(state){
for (i = 0; i < cnt; i++)
{
BX('IBLOCK_EXPORT_TABLE'+(i+1)).style.opacity = state.opacity/100;
}
},
complete : function() {
for (i = 0; i < cnt; i++)
{
if (!obj.checked)
BX.addClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
}
}
});
easing.animate();
var boolCheck = obj.checked;
for (i = 0; i < cnt; i++)
{
BX('IBLOCK_EXPORT'+(i+1)).checked = boolCheck;
}
BX('count_checked').value = (boolCheck ? cnt : 0);
}; };
function checkOne(obj,cnt) function checkOne(obj,cnt)
{ {
var boolCheck = obj.checked; var table = BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_EXPORT_TABLE'));
var intCurrent = parseInt(BX('count_checked').value); if (obj.checked)
intCurrent += (boolCheck ? 1 : -1); BX.removeClass(table,"iblock-export-table-display-none");
BX('icml_export_all').checked = (intCurrent < cnt ? false : true); var easing = new BX.easing({
BX('count_checked').value = intCurrent; duration : 150,
if (!boolCheck) start : {opacity : obj.checked ? 0 : 100 },
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none'; finish : {opacity: obj.checked ? 100 : 0 },
transition : BX.easing.transitions.linear,
step : function(state){
table.style.opacity = state.opacity/100;
},
complete : function() {
if (!obj.checked)
BX.addClass(table,"iblock-export-table-display-none");
}
});
easing.animate();
var boolCheck = obj.checked;
var intCurrent = parseInt(BX('count_checked').value);
intCurrent += (boolCheck ? 1 : -1);
BX('icml_export_all').checked = (intCurrent < cnt ? false : true);
BX('count_checked').value = intCurrent;
};
function propertyChange(obj)
{
if (BX(obj.id).value !== 'none') {
if (obj.id.indexOf("SKU") !== -1)
BX(obj.id.replace('SKU','PRODUCT')).value = 'none';
else
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
}
}; };
</script> </script>
@ -279,7 +426,7 @@ if ($STEP==1)
<input type="hidden" name="ACT_FILE" value="<?echo htmlspecialcharsbx($_REQUEST["ACT_FILE"]) ?>"> <input type="hidden" name="ACT_FILE" value="<?echo htmlspecialcharsbx($_REQUEST["ACT_FILE"]) ?>">
<input type="hidden" name="ACTION" value="<?echo htmlspecialcharsbx($ACTION) ?>"> <input type="hidden" name="ACTION" value="<?echo htmlspecialcharsbx($ACTION) ?>">
<input type="hidden" name="STEP" value="<?echo intval($STEP) + 1 ?>"> <input type="hidden" name="STEP" value="<?echo intval($STEP) + 1 ?>">
<input type="hidden" name="SETUP_FIELDS_LIST" value="SETUP_FILE_NAME,IBLOCK_EXPORT,IBLOCK_PROPERTY_ARTICLE"> <input type="hidden" name="SETUP_FIELDS_LIST" value="SETUP_FILE_NAME,IBLOCK_EXPORT,IBLOCK_PROPERTY_SKU,IBLOCK_PROPERTY_PRODUCT">
<input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>"> <input type="submit" value="<?echo ($ACTION=="EXPORT")?GetMessage("CET_EXPORT"):GetMessage("CET_SAVE")?>">

View File

@ -829,20 +829,21 @@ class intaro_intarocrm extends CModule {
else else
$iblocks = $_POST['IBLOCK_EXPORT']; $iblocks = $_POST['IBLOCK_EXPORT'];
if (!isset($_POST['IBLOCK_PROPERTY_ARTICLE'])) if(!isset($_POST['IBLOCK_PROPERTY_SKU']))
$arResult['errCode'] = 'ERR_FIELDS_ARTICLE'; $arResult['errCode'] = 'ERR_FIELDS_SKU';
else else
$articleProperties = $_POST['IBLOCK_PROPERTY_ARTICLE']; $propertiesSKU = $_POST['IBLOCK_PROPERTY_SKU'];
if(!isset($_POST['IBLOCK_PROPERTY_PRODUCT']))
$arResult['errCode'] = 'ERR_FIELDS_PRODUCT';
else
$propertiesProduct = $_POST['IBLOCK_PROPERTY_PRODUCT'];
if (!isset($_POST['SETUP_FILE_NAME'])) if (!isset($_POST['SETUP_FILE_NAME']))
$arResult['errCode'] = 'ERR_FIELDS_FILE'; $arResult['errCode'] = 'ERR_FIELDS_FILE';
else else
$filename = $_POST['SETUP_FILE_NAME']; $filename = $_POST['SETUP_FILE_NAME'];
if (count($iblocks) < count($articleProperties))
$arResult['errCode'] = 'ERR_ARTICLE_IBLOCK';
if (!isset($_POST['TYPE_LOADING'])) if (!isset($_POST['TYPE_LOADING']))
$typeLoading = 0; $typeLoading = 0;
else else
@ -863,15 +864,16 @@ class intaro_intarocrm extends CModule {
$arOldValues = Array( $arOldValues = Array(
'IBLOCK_EXPORT' => $iblocks, 'IBLOCK_EXPORT' => $iblocks,
'IBLOCK_PROPERTY_ARTICLE' => $articleProperties, 'IBLOCK_PROPERTY_SKU' => $propertiesSKU,
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
'SETUP_FILE_NAME' => $filename, 'SETUP_FILE_NAME' => $filename,
'SETUP_PROFILE_NAME' => $profileName 'SETUP_PROFILE_NAME' => $profileName
); );
global $oldValues; global $oldValues;
$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/step5.php' $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step4.php'
); );
return; return;
} }
@ -883,10 +885,12 @@ class intaro_intarocrm extends CModule {
$loader = new ICMLLoader(); $loader = new ICMLLoader();
$loader->iblocks = $iblocks; $loader->iblocks = $iblocks;
$loader->articleProperties = $articleProperties; $loader->propertiesProduct = $propertiesProduct;
$loader->propertiesSKU = $propertiesSKU;
$loader->filename = $filename; $loader->filename = $filename;
$loader->application = $APPLICATION; $loader->application = $APPLICATION;
$loader->Load(); $loader->Load();
} }
if ($typeLoading == 'agent' || $typeLoading == 'cron') { if ($typeLoading == 'agent' || $typeLoading == 'cron') {
@ -900,18 +904,18 @@ class intaro_intarocrm extends CModule {
} }
} }
} }
$ar = $this->GetProfileSetupVars($iblocks, $articleProperties, $filename); $ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $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,
"NAME" => $profileName, "NAME" => $profileName,
"DEFAULT_PROFILE" => "N", "DEFAULT_PROFILE" => "N",
"IN_MENU" => "N", "IN_MENU" => "N",
"IN_AGENT" => "N", "IN_AGENT" => "N",
"IN_CRON" => "N", "IN_CRON" => "N",
"NEED_EDIT" => "N", "NEED_EDIT" => "N",
"SETUP_VARS" => $ar "SETUP_VARS" => $ar
)); ));
if (intval($PROFILE_ID) <= 0) { if (intval($PROFILE_ID) <= 0) {
$arResult['errCode'] = 'ERR_IBLOCK'; $arResult['errCode'] = 'ERR_IBLOCK';
return; return;
@ -1075,18 +1079,23 @@ 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, $articleProperties, $filename) { function GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $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&
// IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER& // IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER&
// SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml // SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml
//$arProfileFields = explode(",", $SETUP_FIELDS_LIST); //$arProfileFields = explode(",", $SETUP_FIELDS_LIST);
$strVars = ""; $strVars = "";
foreach ($iblocks as $key => $val) foreach ($iblocks as $key => $val)
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&'; $strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
foreach ($articleProperties as $key => $val) foreach ($propertiesSKU as $iblock => $arr)
$strVars .= 'IBLOCK_PROPERTY_ARTICLE[' . $key . ']=' . $val . '&'; foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_SKU[' . $iblock . '][' . $id . ']=' . $val . '&';
foreach ($propertiesProduct as $iblock => $arr)
foreach ($arr as $id => $val)
$strVars .= 'IBLOCK_PROPERTY_PRODUCT[' . $iblock . '][' . $id . ']=' . $val . '&';
$strVars .= 'SETUP_FILE_NAME=' . urlencode($filename); $strVars .= 'SETUP_FILE_NAME=' . urlencode($filename);

View File

@ -11,12 +11,22 @@ if(isset($arResult['errCode']) && $arResult['errCode'])
global $oldValues; global $oldValues;
if (!empty($oldValues)) { if (!empty($oldValues)) {
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT']; $IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
$IBLOCK_PROPERTY_ARTICLE = $oldValues['IBLOCK_PROPERTY_ARTICLE']; $IBLOCK_PROPERTY_SKU = $oldValues['IBLOCK_PROPERTY_SKU'];
$IBLOCK_PROPERTY_PRODUCT = $oldValues['IBLOCK_PROPERTY_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'];
} }
?> ?>
<style type="text/css">
.iblock-export-table-display-none {
display: none;
}
</style>
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" > <form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
<h3>Настройки инфоблоков</h3>
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font> <font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
<? <?
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT)) if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
@ -24,47 +34,92 @@ if (!empty($oldValues)) {
$IBLOCK_EXPORT = array(); $IBLOCK_EXPORT = array();
} }
$iblockPropertiesName = Array(
"article" => "Артикул",
"manufacturer" => "Производитель",
"color" => "Цвет",
"weight" => "Вес",
"size" => "Размер",
);
$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"),
);
$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 ($res = $db_res->Fetch()) while ($iblock = $db_res->Fetch())
{ {
if ($arCatalog = CCatalog::GetByIDExt($res["ID"])) if ($arCatalog = CCatalog::GetByIDExt($iblock["ID"]))
{ {
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P") if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
{ {
$arSiteList = array(); $propertiesSKU = null;
$rsSites = CIBlock::GetSite($res["ID"]); if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
while ($arSite = $rsSites->Fetch()) {
{ $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
$arSiteList[] = $arSite["SITE_ID"];
}
$db_properties = CIBlock::GetProperties($res['ID'], Array());
$properties = Array(); $db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
while($prop = $db_properties->Fetch()) while($prop = $db_properties->Fetch())
$properties[] = $prop; $propertiesSKU[] = $prop;
if (count($IBLOCK_EXPORT) != 0) $oldPropertySKU = null;
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT)); if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
else foreach ($iblockPropertiesName as $key => $prop) {
$boolExport = true; $oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
}
}
}
$arIBlockList[] = array(
'ID' => $res['ID'],
'NAME' => $res['NAME'],
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
'IBLOCK_EXPORT' => $boolExport,
'PROPERTIES' => $properties,
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
);
if ($boolExport) $propertiesProduct = null;
$intCountChecked++; $db_properties = CIBlock::GetProperties($iblock['ID'], Array());
$intCountAvailIBlock++; while($prop = $db_properties->Fetch())
$propertiesProduct[] = $prop;
$oldPropertyProduct = null;
if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
foreach ($iblockPropertiesName as $key => $prop) {
$oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
}
}
$arSiteList = array();
$rsSites = CIBlock::GetSite($iblock["ID"]);
while ($arSite = $rsSites->Fetch())
{
$arSiteList[] = $arSite["SITE_ID"];
}
if (count($IBLOCK_EXPORT) != 0)
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
else
$boolExport = true;
$arIBlockList[] = array(
'ID' => $iblock['ID'],
'NAME' => $iblock['NAME'],
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
'IBLOCK_EXPORT' => $boolExport,
'PROPERTIES_SKU' => $propertiesSKU,
'PROPERTIES_PRODUCT' => $propertiesProduct,
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
);
if ($boolExport)
$intCountChecked++;
$intCountAvailIBlock++;
} }
} }
} }
@ -78,99 +133,141 @@ if (!empty($oldValues)) {
?> ?>
<font class="text" style="font-weight: bold;">Выбрать все инфоблоки </font>
<input
style="vertical-align: middle;"
type="checkbox"
name="icml_export_all"
id="icml_export_all"
value="Y"
onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"
<? echo ($boolAll ? ' checked' : ''); ?>>
</br>
</br>
<div>
<? $checkBoxCounter = 0;?>
<? foreach ($arIBlockList as $key => $arIBlock):?>
<div>
<div>
<font class="text" style="font-weight: bold;"><? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?></font>
<input
type="checkbox"
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
id="IBLOCK_EXPORT<?=++$checkBoxCounter?>"
value="<?=$arIBlock["ID"]?>"
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
>
</div>
<br>
<div id="IBLOCK_EXPORT_TABLE<?=$checkBoxCounter?>">
<table class="adm-list-table" id="export_setup" <?=($arIBlock['PROPERTIES_SKU'] == null ? 'style="width: 66%;"': "" )?> >
<thead>
<tr class="adm-list-table-header">
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Выгружаемое свойство</div>
</td>
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Свойство товара</div>
</td>
<? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
<td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner">Свойство торгового предложения</div>
</td>
<? endif;?>
</tr>
</thead>
<tbody>
<? foreach ($iblockPropertiesName as $key => $property): ?>
<table class="adm-list-table" id="export_setup"> <? $productSelected = false;?>
<thead> <tr class="adm-list-table-row">
<tr class="adm-list-table-header">
<td class="adm-list-table-cell"> <td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div> <? echo htmlspecialcharsex($property); ?>
</td> </td>
<td class="adm-list-table-cell"> <td class="adm-list-table-cell">
<div class="adm-list-table-cell-inner"> <select
<?echo GetMessage("EXPORT2INTAROCML");?>&nbsp; style="width: 200px;"
</div> id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
</td> name="IBLOCK_PROPERTY_PRODUCT[<?=$arIBlock["ID"]?>][<?=$key?>]"
<td class="adm-list-table-cell"> class="property-export"
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div> onchange="propertyChange(this);">
</td> <option value=""></option>
</tr> <? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
</thead>
<tbody>
<tr class="adm-list-table-row">
<td class="adm-list-table-cell">
<?echo GetMessage("ALL_CATALOG");?>
</td>
<td class="adm-list-table-cell">
<input style="vertical-align: middle;" type="checkbox" name="icml_export_all" id="icml_export_all" value="Y" onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"<? echo ($boolAll ? ' checked' : ''); ?>>
</td>
<td class="adm-list-table-cell">
&nbsp;
</td>
</tr>
<?
foreach ($arIBlockList as $key => $arIBlock)
{
?>
<tr class="adm-list-table-row">
<td class="adm-list-table-cell" style="padding-left: 5em">
<? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?>
</td>
<td class="adm-list-table-cell">
<font class="tablebodytext">
<input
type="checkbox"
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
id="IBLOCK_EXPORT<?=$arIBlock["ID"]?>"
value="<?=$arIBlock["ID"]?>"
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
>
</font>
</td>
<td class="adm-list-table-cell">
<select
style="width: 200px;"
id="IBLOCK_PROPERTY_ARTICLE<?=$arIBlock["ID"]?>"
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
class="property-export">
<option value=""></option>
<?
foreach ($arIBlock['PROPERTIES'] as $prop)
{
?>
<option value="<?=$prop['CODE'] ?>" <option value="<?=$prop['CODE'] ?>"
<? <?
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){ if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
echo " selected"; if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
} else {
if ($prop["CODE"] == "ARTICLE" ||
$prop["CODE"] == "ART" ||
$prop["CODE"] == "ARTNUMBER" )
echo " selected"; echo " selected";
} $productSelected = true;
}
} else {
?> foreach ($iblockPropertiesHint[$key] as $hint) {
> if ($prop["CODE"] == $hint ) {
echo " selected";
$productSelected = true;
break;
}
}
}
?>
>
<?=$prop["NAME"];?> <?=$prop["NAME"];?>
</option> </option>
<? <? endforeach;?>
} </select>
?> </td>
</select> <? if ($arIBlock['PROPERTIES_SKU'] != null): ?>
</td> <td class="adm-list-table-cell">
</tr> <select
<? style="width: 200px;"
} id="IBLOCK_PROPERTY_SKU_<?=$key?><?=$arIBlock["ID"]?>"
?> name="IBLOCK_PROPERTY_SKU[<?=$arIBlock["ID"]?>][<?=$key?>]"
</tbody> class="property-export"
</table> 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";
break;
}
}
}
}
?>
>
<?=$prop["NAME"];?>
</option>
<? endforeach;?>
</select>
</td>
<? endif;?>
</tr>
<? endforeach;?>
</tbody>
</table>
<br>
<br>
</div>
</div>
<? endforeach;?>
</div>
<input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>"> <input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>">
<br> <br>
<br>
<br>
<font class="text"><?=GetMessage("FILENAME");?><br><br></font> <font class="text"><?=GetMessage("FILENAME");?><br><br></font>
<input type="text" name="SETUP_FILE_NAME" <input type="text" name="SETUP_FILE_NAME"