Добавлены изображения для категорий в ICML
This commit is contained in:
parent
91349647ed
commit
1ad5ecf6a2
@ -111,6 +111,17 @@ class RetailCrmICML
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setSiteAddress($block_id)
|
||||||
|
{
|
||||||
|
$site = CAllIBlock::GetSite($block_id)->Fetch();
|
||||||
|
|
||||||
|
if ($site['SERVER_NAME']) {
|
||||||
|
$this->serverName = $site['SERVER_NAME'];
|
||||||
|
} else {
|
||||||
|
$this->serverName = $this->defaultServerName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function PrepareSettings()
|
protected function PrepareSettings()
|
||||||
{
|
{
|
||||||
foreach ($this->propertiesSKU as $iblock => $arr) {
|
foreach ($this->propertiesSKU as $iblock => $arr) {
|
||||||
@ -118,6 +129,7 @@ class RetailCrmICML
|
|||||||
$this->propertiesSKU[$iblock][$id] = strtoupper($sku);
|
$this->propertiesSKU[$iblock][$id] = strtoupper($sku);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->propertiesProduct as $iblock => $arr) {
|
foreach ($this->propertiesProduct as $iblock => $arr) {
|
||||||
foreach ($arr as $id => $prod) {
|
foreach ($arr as $id => $prod) {
|
||||||
$this->propertiesProduct[$iblock][$id] = strtoupper($prod);
|
$this->propertiesProduct[$iblock][$id] = strtoupper($prod);
|
||||||
@ -202,22 +214,27 @@ class RetailCrmICML
|
|||||||
{
|
{
|
||||||
$categories = array();
|
$categories = array();
|
||||||
foreach ($this->iblocks as $id) {
|
foreach ($this->iblocks as $id) {
|
||||||
|
$this->setSiteAddress($id);
|
||||||
$filter = array("IBLOCK_ID" => $id);
|
$filter = array("IBLOCK_ID" => $id);
|
||||||
|
|
||||||
$dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter);
|
$dbRes = CIBlockSection::GetList(array("left_margin" => "asc"), $filter);
|
||||||
$hasCategories = false;
|
$hasCategories = false;
|
||||||
|
|
||||||
while ($arRes = $dbRes->Fetch()) {
|
while ($arRes = $dbRes->Fetch()) {
|
||||||
$categories[$arRes['ID']] = $arRes;
|
$categories[$arRes['ID']] = $arRes;
|
||||||
|
$categories[$arRes['ID']]['SITE'] = $this->protocol . $this->serverName;
|
||||||
$hasCategories = true;
|
$hasCategories = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$hasCategories) {
|
if (!$hasCategories) {
|
||||||
$iblock = CIBlock::GetByID($id)->Fetch();
|
$iblock = CIBlock::GetByID($id)->Fetch();
|
||||||
|
|
||||||
$arRes = Array();
|
$arRes = array();
|
||||||
$arRes['ID'] = $this->mainSection + $id;
|
$arRes['ID'] = $this->mainSection + $id;
|
||||||
$arRes['IBLOCK_SECTION_ID'] = 0;
|
$arRes['IBLOCK_SECTION_ID'] = 0;
|
||||||
$arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']);
|
$arRes['NAME'] = sprintf(GetMessage('ROOT_CATEGORY_FOR_CATALOG'), $iblock['NAME']);
|
||||||
$categories[$arRes['ID']] = $arRes;
|
$categories[$arRes['ID']] = $arRes;
|
||||||
|
$categories[$arRes['ID']]['SITE'] = $this->protocol . $this->serverName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +243,25 @@ class RetailCrmICML
|
|||||||
|
|
||||||
protected function BuildCategory($arCategory)
|
protected function BuildCategory($arCategory)
|
||||||
{
|
{
|
||||||
return "
|
$category =
|
||||||
<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\""
|
"<category id=\"" . $this->PrepareValue($arCategory["ID"]) . "\""
|
||||||
. ( intval($arCategory["IBLOCK_SECTION_ID"] ) > 0 ?
|
. (intval($arCategory["IBLOCK_SECTION_ID"]) > 0 ?
|
||||||
" parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\""
|
" parentId=\"" . $this->PrepareValue($arCategory["IBLOCK_SECTION_ID"]) . "\""
|
||||||
:"")
|
:"")
|
||||||
. ">"
|
. ">\n\t"
|
||||||
. $this->PrepareValue($arCategory["NAME"])
|
. "<name>" . $this->PrepareValue($arCategory["NAME"]) . "</name>\n";
|
||||||
. "</category>\n";
|
|
||||||
|
|
||||||
|
if (CFile::GetPath($arCategory["DETAIL_PICTURE"])) {
|
||||||
|
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["DETAIL_PICTURE"]) . "</picture>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CFile::GetPath($arCategory["PICTURE"])) {
|
||||||
|
$category .= "\t<picture>" . $arCategory['SITE'] . CFile::GetPath($arCategory["PICTURE"]) . "</picture>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$category .= "</category>\n";
|
||||||
|
|
||||||
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function BuildOffers(&$allCategories)
|
protected function BuildOffers(&$allCategories)
|
||||||
@ -246,14 +273,7 @@ class RetailCrmICML
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($this->iblocks as $key => $id) {
|
foreach ($this->iblocks as $key => $id) {
|
||||||
$site = CAllIBlock::GetSite($id)->Fetch();
|
$this->setSiteAddress($id);
|
||||||
|
|
||||||
if ($site['SERVER_NAME']) {
|
|
||||||
$this->serverName = $site['SERVER_NAME'];
|
|
||||||
} else {
|
|
||||||
$this->serverName = $this->defaultServerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$barcodes = array();
|
$barcodes = array();
|
||||||
|
|
||||||
$dbBarCode = CCatalogStoreBarCode::getList(
|
$dbBarCode = CCatalogStoreBarCode::getList(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user