Merge branch 'exportExtendedProperties'
This commit is contained in:
commit
2b0b5c0049
@ -7,7 +7,8 @@ class ICMLLoader {
|
||||
|
||||
public $iblocks;
|
||||
public $filename;
|
||||
public $articleProperties;
|
||||
public $propertiesSKU;
|
||||
public $propertiesProduct;
|
||||
public $application;
|
||||
public $encoding = 'utf-8';
|
||||
|
||||
@ -23,6 +24,8 @@ class ICMLLoader {
|
||||
if (count($this->iblocks) < count($this->articleProperties))
|
||||
return false;
|
||||
|
||||
$this->PrepareSettings();
|
||||
|
||||
$this->PrepareFile();
|
||||
|
||||
$this->PreWriteCatalog();
|
||||
@ -42,6 +45,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)
|
||||
{
|
||||
$newText = $this->application->ConvertCharset($text, LANG_CHARSET, $this->encoding);
|
||||
@ -63,12 +80,11 @@ class ICMLLoader {
|
||||
|
||||
protected function PreWriteCatalog()
|
||||
{
|
||||
@fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n");
|
||||
@fwrite($this->fp, "<shop>\n");
|
||||
|
||||
@fwrite($this->fp, "<name>". $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n");
|
||||
|
||||
@fwrite($this->fp, "<company>".$this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n");
|
||||
@fwrite($this->fp, "<yml_catalog date=\"" . $this->PrepareValue(Date("Y-m-d H:i:s")) . "\">\n
|
||||
<shop>\n
|
||||
<name>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</name>\n
|
||||
<company>" . $this->PrepareValue(COption::GetOptionString("main", "site_name", ""))."</company>\n"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -99,8 +115,8 @@ class ICMLLoader {
|
||||
|
||||
protected function PostWriteCatalog()
|
||||
{
|
||||
@fwrite($this->fp, "</shop>\n");
|
||||
@fwrite($this->fp, "</yml_catalog>\n");
|
||||
@fwrite($this->fp, "</shop>\n
|
||||
</yml_catalog>\n");
|
||||
}
|
||||
|
||||
protected function CloseFile()
|
||||
@ -160,11 +176,9 @@ class ICMLLoader {
|
||||
{
|
||||
foreach ($this->iblocks as $key => $id)
|
||||
{
|
||||
|
||||
$iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch();
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id);
|
||||
|
||||
|
||||
$arSelect = Array (
|
||||
"ID",
|
||||
"LID",
|
||||
@ -181,8 +195,10 @@ class ICMLLoader {
|
||||
"DETAIL_PAGE_URL"
|
||||
);
|
||||
|
||||
if (isset($this->articleProperties[$id]))
|
||||
$arSelect[] = "PROPERTY_" . $this->articleProperties[$id];
|
||||
foreach ($this->propertiesProduct[$id] as $key => $propProduct) {
|
||||
if ($this->propertiesProduct[$id][$key] != "")
|
||||
$arSelect[] = "PROPERTY_" . $propProduct;
|
||||
}
|
||||
|
||||
|
||||
$filter = Array (
|
||||
@ -198,7 +214,23 @@ class ICMLLoader {
|
||||
|
||||
$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();
|
||||
$dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true);
|
||||
while ($arResCategory = $dbResCategories->Fetch()) {
|
||||
@ -217,7 +249,6 @@ class ICMLLoader {
|
||||
$existOffer = false;
|
||||
if (!empty($iblockOffer['IBLOCK_ID'])) {
|
||||
|
||||
|
||||
$arFilterOffer = Array (
|
||||
'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'],
|
||||
'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => $product["ID"]
|
||||
@ -229,9 +260,11 @@ class ICMLLoader {
|
||||
"DETAIL_PAGE_URL",
|
||||
"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);
|
||||
while ($arOffer = $rsOffers->GetNext()) {
|
||||
@ -244,8 +277,26 @@ class ICMLLoader {
|
||||
$arOffer['DETAIL_PICTURE'] = $product["DETAIL_PICTURE"];
|
||||
$arOffer['PREVIEW_PICTURE'] = $product["PREVIEW_PICTURE"];
|
||||
$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);
|
||||
$arOffer['PRICE'] = $dbPrice['PRICE'];
|
||||
@ -261,8 +312,11 @@ class ICMLLoader {
|
||||
|
||||
$product['PRODUCT_ID'] = $product["ID"];
|
||||
$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);
|
||||
$product['PRICE'] = $dbPrice['PRICE'];
|
||||
@ -326,8 +380,11 @@ class ICMLLoader {
|
||||
|
||||
$offer .= "<xmlId>" . $this->PrepareValue($arOffer["EXTERNAL_ID"]) . "</xmlId>\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";
|
||||
return $offer;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
|
||||
global $APPLICATION;
|
||||
if (!CModule::IncludeModule("iblock"))
|
||||
return;
|
||||
@ -13,7 +12,8 @@ if (!CModule::IncludeModule("intaro.intarocrm"))
|
||||
|
||||
$loader = new ICMLLoader();
|
||||
$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->application = $APPLICATION;
|
||||
$loader->Load();
|
@ -1,11 +1,12 @@
|
||||
<?
|
||||
|
||||
|
||||
|
||||
if(!check_bitrix_sessid()) return;
|
||||
|
||||
__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']))
|
||||
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
|
||||
@ -13,18 +14,16 @@ if (($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY') && $STEP == 1)
|
||||
$SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME'];
|
||||
if (isset($arOldSetupVars['IBLOCK_EXPORT']))
|
||||
$IBLOCK_EXPORT = $arOldSetupVars['IBLOCK_EXPORT'];
|
||||
if (isset($arOldSetupVars['IBLOCK_PROPERTY_ARTICLE']))
|
||||
$IBLOCK_PROPERTY_ARTICLE = $arOldSetupVars['IBLOCK_PROPERTY_ARTICLE'];
|
||||
if (isset($arOldSetupVars['IBLOCK_PROPERTY_SKU']))
|
||||
$IBLOCK_PROPERTY_SKU = $arOldSetupVars['IBLOCK_PROPERTY_SKU'];
|
||||
if (isset($arOldSetupVars['IBLOCK_PROPERTY_PRODUCT']))
|
||||
$IBLOCK_PROPERTY_PRODUCT = $arOldSetupVars['IBLOCK_PROPERTY_PRODUCT'];
|
||||
}
|
||||
|
||||
|
||||
if ($STEP>1)
|
||||
{
|
||||
|
||||
|
||||
if (count($IBLOCK_EXPORT) < count($IBLOCK_PROPERTY_ARTICLE))
|
||||
$arSetupErrors[] = GetMessage("ERROR_ARTICLE_NOT_SET");
|
||||
|
||||
if (strlen($SETUP_FILE_NAME)<=0)
|
||||
{
|
||||
$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(); ?>" >
|
||||
<?if ($ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY')
|
||||
{
|
||||
?><input type="hidden" name="PROFILE_ID" value="<? echo intval($PROFILE_ID); ?>"><?
|
||||
}
|
||||
?>
|
||||
|
||||
<h3><?=GetMessage("SETTINGS_INFOBLOCK");?></h3>
|
||||
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
|
||||
<?
|
||||
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
|
||||
@ -67,42 +75,86 @@ if ($STEP==1)
|
||||
$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;
|
||||
$intCountChecked = 0;
|
||||
$intCountAvailIBlock = 0;
|
||||
$arIBlockList = array();
|
||||
$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")
|
||||
{
|
||||
$propertiesSKU = null;
|
||||
if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
|
||||
|
||||
$db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesSKU[] = $prop;
|
||||
|
||||
$oldPropertySKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$propertiesProduct = null;
|
||||
$db_properties = CIBlock::GetProperties($iblock['ID'], Array());
|
||||
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($res["ID"]);
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
$db_properties = CIBlock::GetProperties($res['ID'], Array());
|
||||
|
||||
$properties = Array();
|
||||
while($prop = $db_properties->Fetch())
|
||||
$properties[] = $prop;
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT));
|
||||
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $res['ID'],
|
||||
'NAME' => $res['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
|
||||
'ID' => $iblock['ID'],
|
||||
'NAME' => $iblock['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES' => $properties,
|
||||
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
@ -121,103 +173,146 @@ if ($STEP==1)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<table class="adm-list-table" id="export_setup">
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner">
|
||||
<?echo GetMessage("EXPORT2INTAROCML");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</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">
|
||||
|
||||
</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">
|
||||
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></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<?=$arIBlock["ID"]?>"
|
||||
id="IBLOCK_EXPORT<?=++$checkBoxCounter?>"
|
||||
value="<?=$arIBlock["ID"]?>"
|
||||
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
|
||||
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
|
||||
>
|
||||
</font>
|
||||
</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): ?>
|
||||
<? $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_ARTICLE<?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export">
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT[<?=$arIBlock["ID"]?>][<?=$key?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<?
|
||||
foreach ($arIBlock['PROPERTIES'] as $prop)
|
||||
{
|
||||
?>
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){
|
||||
if ($arIBlock['OLD_PROPERTY_PRODUCT_SELECT'] != null) {
|
||||
if ($prop["CODE"] == $arIBlock['OLD_PROPERTY_PRODUCT_SELECT'][$key] ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
}
|
||||
} else {
|
||||
if ($arIBlock['OLD_PROPERTY_SELECT'] == "") {
|
||||
if ($prop["CODE"] == "ARTICLE" ||
|
||||
$prop["CODE"] == "ART" ||
|
||||
$prop["CODE"] == "ARTNUMBER" )
|
||||
foreach ($iblockPropertiesHint[$key] as $hint) {
|
||||
if ($prop["CODE"] == $hint ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</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[<?=$arIBlock["ID"]?>][<?=$key?>]"
|
||||
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";
|
||||
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; ?>">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<h3><?=GetMessage("SETTINGS_EXPORT");?></h3>
|
||||
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
@ -252,22 +347,74 @@ if ($STEP==1)
|
||||
<script type="text/javascript">
|
||||
function checkAll(obj,cnt)
|
||||
{
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if (obj.checked)
|
||||
BX.removeClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
|
||||
}
|
||||
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).checked = boolCheck;
|
||||
BX('IBLOCK_EXPORT'+(i+1)).checked = boolCheck;
|
||||
}
|
||||
BX('count_checked').value = (boolCheck ? cnt : 0);
|
||||
};
|
||||
function checkOne(obj,cnt)
|
||||
{
|
||||
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){
|
||||
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;
|
||||
if (!boolCheck)
|
||||
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none';
|
||||
};
|
||||
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>
|
||||
|
||||
@ -279,7 +426,7 @@ if ($STEP==1)
|
||||
<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="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")?>">
|
||||
|
||||
|
||||
|
@ -823,20 +823,21 @@ class intaro_intarocrm extends CModule {
|
||||
else
|
||||
$iblocks = $_POST['IBLOCK_EXPORT'];
|
||||
|
||||
if (!isset($_POST['IBLOCK_PROPERTY_ARTICLE']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_ARTICLE';
|
||||
if(!isset($_POST['IBLOCK_PROPERTY_SKU']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_SKU';
|
||||
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']))
|
||||
$arResult['errCode'] = 'ERR_FIELDS_FILE';
|
||||
else
|
||||
$filename = $_POST['SETUP_FILE_NAME'];
|
||||
|
||||
if (count($iblocks) < count($articleProperties))
|
||||
$arResult['errCode'] = 'ERR_ARTICLE_IBLOCK';
|
||||
|
||||
|
||||
if (!isset($_POST['TYPE_LOADING']))
|
||||
$typeLoading = 0;
|
||||
else
|
||||
@ -857,7 +858,8 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
$arOldValues = Array(
|
||||
'IBLOCK_EXPORT' => $iblocks,
|
||||
'IBLOCK_PROPERTY_ARTICLE' => $articleProperties,
|
||||
'IBLOCK_PROPERTY_SKU' => $propertiesSKU,
|
||||
'IBLOCK_PROPERTY_PRODUCT' => $propertiesProduct,
|
||||
'SETUP_FILE_NAME' => $filename,
|
||||
'SETUP_PROFILE_NAME' => $profileName
|
||||
);
|
||||
@ -865,7 +867,7 @@ class intaro_intarocrm extends CModule {
|
||||
$oldValues = $arOldValues;
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
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;
|
||||
}
|
||||
@ -878,10 +880,12 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
$loader = new ICMLLoader();
|
||||
$loader->iblocks = $iblocks;
|
||||
$loader->articleProperties = $articleProperties;
|
||||
$loader->propertiesProduct = $propertiesProduct;
|
||||
$loader->propertiesSKU = $propertiesSKU;
|
||||
$loader->filename = $filename;
|
||||
$loader->application = $APPLICATION;
|
||||
$loader->Load();
|
||||
|
||||
}
|
||||
|
||||
if ($typeLoading == 'agent' || $typeLoading == 'cron') {
|
||||
@ -895,7 +899,7 @@ class intaro_intarocrm extends CModule {
|
||||
}
|
||||
}
|
||||
}
|
||||
$ar = $this->GetProfileSetupVars($iblocks, $articleProperties, $filename);
|
||||
$ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename);
|
||||
$PROFILE_ID = CCatalogExport::Add(array(
|
||||
"LAST_USE" => false,
|
||||
"FILE_NAME" => $this->INTARO_CRM_EXPORT,
|
||||
@ -1074,18 +1078,23 @@ class intaro_intarocrm extends CModule {
|
||||
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&
|
||||
// IBLOCK_EXPORT[1]=6&
|
||||
// IBLOCK_PROPERTY_ARTICLE[0]=ARTICLE&
|
||||
// IBLOCK_PROPERTY_ARTICLE[1]=ARTNUMBER&
|
||||
// SETUP_FILE_NAME=%2Fbitrix%2Fcatalog_export%2Ftestintarocrm.xml
|
||||
|
||||
//$arProfileFields = explode(",", $SETUP_FIELDS_LIST);
|
||||
$strVars = "";
|
||||
foreach ($iblocks as $key => $val)
|
||||
$strVars .= 'IBLOCK_EXPORT[' . $key . ']=' . $val . '&';
|
||||
foreach ($articleProperties as $key => $val)
|
||||
$strVars .= 'IBLOCK_PROPERTY_ARTICLE[' . $key . ']=' . $val . '&';
|
||||
foreach ($propertiesSKU as $iblock => $arr)
|
||||
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);
|
||||
|
||||
|
@ -11,12 +11,22 @@ if(isset($arResult['errCode']) && $arResult['errCode'])
|
||||
global $oldValues;
|
||||
if (!empty($oldValues)) {
|
||||
$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_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(); ?>" >
|
||||
<h3><?=GetMessage("SETTINGS_INFOBLOCK");?></h3>
|
||||
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
|
||||
<?
|
||||
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
|
||||
@ -24,41 +34,86 @@ if (!empty($oldValues)) {
|
||||
$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;
|
||||
$intCountChecked = 0;
|
||||
$intCountAvailIBlock = 0;
|
||||
$arIBlockList = array();
|
||||
$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")
|
||||
{
|
||||
$propertiesSKU = null;
|
||||
if ($arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
||||
{
|
||||
$iblockOffer = CCatalogSKU::GetInfoByProductIBlock($iblock["ID"]);
|
||||
|
||||
$db_properties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], Array());
|
||||
while($prop = $db_properties->Fetch())
|
||||
$propertiesSKU[] = $prop;
|
||||
|
||||
$oldPropertySKU = null;
|
||||
if (isset($IBLOCK_PROPERTY_SKU[$iblock['ID']])) {
|
||||
foreach ($iblockPropertiesName as $key => $prop) {
|
||||
$oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$propertiesProduct = null;
|
||||
$db_properties = CIBlock::GetProperties($iblock['ID'], Array());
|
||||
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($res["ID"]);
|
||||
$rsSites = CIBlock::GetSite($iblock["ID"]);
|
||||
while ($arSite = $rsSites->Fetch())
|
||||
{
|
||||
$arSiteList[] = $arSite["SITE_ID"];
|
||||
}
|
||||
$db_properties = CIBlock::GetProperties($res['ID'], Array());
|
||||
|
||||
$properties = Array();
|
||||
while($prop = $db_properties->Fetch())
|
||||
$properties[] = $prop;
|
||||
|
||||
if (count($IBLOCK_EXPORT) != 0)
|
||||
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT));
|
||||
$boolExport = (in_array($iblock['ID'], $IBLOCK_EXPORT));
|
||||
else
|
||||
$boolExport = true;
|
||||
|
||||
|
||||
$arIBlockList[] = array(
|
||||
'ID' => $res['ID'],
|
||||
'NAME' => $res['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
|
||||
'ID' => $iblock['ID'],
|
||||
'NAME' => $iblock['NAME'],
|
||||
'IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'],
|
||||
'IBLOCK_EXPORT' => $boolExport,
|
||||
'PROPERTIES' => $properties,
|
||||
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
|
||||
'PROPERTIES_SKU' => $propertiesSKU,
|
||||
'PROPERTIES_PRODUCT' => $propertiesProduct,
|
||||
'OLD_PROPERTY_SKU_SELECT' => $oldPropertySKU,
|
||||
'OLD_PROPERTY_PRODUCT_SELECT' => $oldPropertyProduct,
|
||||
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
||||
);
|
||||
|
||||
@ -78,99 +133,141 @@ if (!empty($oldValues)) {
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<table class="adm-list-table" id="export_setup">
|
||||
<thead>
|
||||
<tr class="adm-list-table-header">
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner">
|
||||
<?echo GetMessage("EXPORT2INTAROCML");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="adm-list-table-cell">
|
||||
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</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">
|
||||
|
||||
</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">
|
||||
<font class="text" style="font-weight: bold;"><?=GetMessage("CHECK_ALL_INFOBLOCKS");?></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<?=$arIBlock["ID"]?>"
|
||||
id="IBLOCK_EXPORT<?=++$checkBoxCounter?>"
|
||||
value="<?=$arIBlock["ID"]?>"
|
||||
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
|
||||
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
|
||||
>
|
||||
</font>
|
||||
</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): ?>
|
||||
<? $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_ARTICLE<?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
|
||||
class="property-export">
|
||||
id="IBLOCK_PROPERTY_PRODUCT_<?=$key?><?=$arIBlock["ID"]?>"
|
||||
name="IBLOCK_PROPERTY_PRODUCT[<?=$arIBlock["ID"]?>][<?=$key?>]"
|
||||
class="property-export"
|
||||
onchange="propertyChange(this);">
|
||||
<option value=""></option>
|
||||
<?
|
||||
foreach ($arIBlock['PROPERTIES'] as $prop)
|
||||
{
|
||||
?>
|
||||
<? foreach ($arIBlock['PROPERTIES_PRODUCT'] as $prop): ?>
|
||||
<option value="<?=$prop['CODE'] ?>"
|
||||
<?
|
||||
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){
|
||||
echo " selected";
|
||||
} else {
|
||||
if ($prop["CODE"] == "ARTICLE" ||
|
||||
$prop["CODE"] == "ART" ||
|
||||
$prop["CODE"] == "ARTNUMBER" )
|
||||
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 ) {
|
||||
echo " selected";
|
||||
$productSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
>
|
||||
<?=$prop["NAME"];?>
|
||||
</option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</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[<?=$arIBlock["ID"]?>][<?=$key?>]"
|
||||
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";
|
||||
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; ?>">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
||||
<input type="text" name="SETUP_FILE_NAME"
|
||||
@ -215,29 +312,74 @@ if (!empty($oldValues)) {
|
||||
<script type="text/javascript">
|
||||
function checkAll(obj,cnt)
|
||||
{
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if (obj.checked)
|
||||
BX.removeClass('IBLOCK_EXPORT_TABLE'+(i+1),"iblock-export-table-display-none");
|
||||
}
|
||||
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).checked = boolCheck;
|
||||
BX('IBLOCK_EXPORT'+(i+1)).checked = boolCheck;
|
||||
}
|
||||
BX('count_checked').value = (boolCheck ? cnt : 0);
|
||||
};
|
||||
function checkOne(obj,cnt)
|
||||
{
|
||||
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){
|
||||
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;
|
||||
if (!boolCheck)
|
||||
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none';
|
||||
};
|
||||
function checkProfile(obj)
|
||||
function propertyChange(obj)
|
||||
{
|
||||
if (obj.value !== 'none')
|
||||
$('#profile-field').show();
|
||||
if (BX(obj.id).value !== 'none') {
|
||||
if (obj.id.indexOf("SKU") !== -1)
|
||||
BX(obj.id.replace('SKU','PRODUCT')).value = 'none';
|
||||
else
|
||||
$('#profile-field').hide();
|
||||
BX(obj.id.replace('PRODUCT','SKU')).value = 'none';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -14,4 +14,8 @@ $MESS["ERROR_IBLOCK_CATALOG"] = "Модуль Каталог не установ
|
||||
$MESS["ERROR_IBLOCK_INTAROCRM"] = "Модуль IntaroCRM не установлен";
|
||||
$MESS["ERROR_ARTICLE_NOT_SET"] = "Были установлены поля артикулов, но не установлены Информационные блоки";
|
||||
$MESS["PROFILE_NAME"] = "Имя профиля";
|
||||
$MESS["SETTINGS_INFOBLOCK"] = "Настройки инфоблоков";
|
||||
$MESS["SETTINGS_EXPORT"] = "Настройки экспорта";
|
||||
$MESS["CHECK_ALL_INFOBLOCKS"] = "Выбрать все инфоблоки ";
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user