Ejemplo n.º 1
0
 public static function getTabs($iblockElementInfo)
 {
     $showTab = false;
     if ($iblockElementInfo["ID"] > 0) {
         $showTab = true;
         if (Loader::includeModule('catalog')) {
             /*
             				$dbRes = CatalogIblockTable::getList(array(
             					'filter' => array(
             						'=IBLOCK_ID' => $iblockElementInfo["IBLOCK"]["ID"],
             						'!PRODUCT_IBLOCK_ID' => 0
             					),
             					'select' => array('IBLOCK_ID'),
             				));
             				if($dbRes->fetch())
             				{
             					$showTab = false;
             				}
             */
             if (\CCatalogSku::GetInfoByOfferIBlock($iblockElementInfo["IBLOCK"]["ID"]) !== false) {
                 $showTab = false;
             }
         }
     }
     return $showTab ? array(array("DIV" => "seo_adv", "SORT" => 4, "TAB" => Loc::getMessage("SEO_ADV_TAB"), "TITLE" => Loc::getMessage("SEO_ADV_TAB_TITLE"))) : null;
 }
Ejemplo n.º 2
0
 public static function _GetProductUrl($OF_ELEMENT_ID, $OF_IBLOCK_ID, $server_name = false, $arrType = false)
 {
     static $arIBlockCache = array();
     static $arElementCache = array();
     $product_url = "";
     $OF_ELEMENT_ID = (int) $OF_ELEMENT_ID;
     $OF_IBLOCK_ID = (int) $OF_IBLOCK_ID;
     if ($arrType === "E" && $OF_IBLOCK_ID > 0 && $OF_ELEMENT_ID > 0 && Loader::includeModule('catalog')) {
         if (!isset($arIBlockCache[$OF_IBLOCK_ID])) {
             $arIBlockCache[$OF_IBLOCK_ID] = CCatalogSku::GetInfoByOfferIBlock($OF_IBLOCK_ID);
             if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
                 $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"] = CIBlock::GetArrayByID($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK_ID"]);
             }
         }
         if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
             if (!array_key_exists($OF_ELEMENT_ID, $arElementCache)) {
                 $OF_PROP_ID = $arIBlockCache[$OF_IBLOCK_ID]["SKU_PROPERTY_ID"];
                 $rsOffer = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arIBlockCache[$OF_IBLOCK_ID]["IBLOCK_ID"], "=ID" => $OF_ELEMENT_ID), false, false, array("LANG_DIR", "PROPERTY_" . $OF_PROP_ID . ".ID", "PROPERTY_" . $OF_PROP_ID . ".CODE", "PROPERTY_" . $OF_PROP_ID . ".XML_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_SECTION_ID"));
                 if ($arOffer = $rsOffer->Fetch()) {
                     $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = '';
                     if (intval($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]) > 0) {
                         $rsSections = CIBlockSection::GetByID($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]);
                         if ($arSection = $rsSections->Fetch()) {
                             $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = $arSection['CODE'];
                         }
                     }
                     $arElementCache[$OF_ELEMENT_ID] = array("LANG_DIR" => $arOffer["LANG_DIR"], "ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "ELEMENT_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "ELEMENT_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "EXTERNAL_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_XML_ID"], "IBLOCK_TYPE_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["IBLOCK_TYPE_ID"], "IBLOCK_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_ID"], "IBLOCK_CODE" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["CODE"], "IBLOCK_EXTERNAL_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["XML_ID"], "IBLOCK_SECTION_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"], "SECTION_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"]);
                 }
             }
             if (is_array($arElementCache[$OF_ELEMENT_ID])) {
                 $product_url = CIBlock::ReplaceDetailUrl($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["DETAIL_PAGE_URL"], $arElementCache[$OF_ELEMENT_ID], $server_name, $arrType);
             }
         }
     }
     return $product_url;
 }