/** * @param integer $iblockId Information block identifier. * @param integer $elementId Element identifier. * * @throws \Bitrix\Main\LoaderException */ public function __construct($iblockId, $elementId) { $this->iblockId = intval($iblockId); $this->elementId = intval($elementId); if (self::$catalog === null) { self::$catalog = \Bitrix\Main\Loader::includeModule("catalog"); } if (self::$catalog) { $catalog = \CCatalogSKU::getInfoByProductIBlock($this->iblockId); if (!empty($catalog) && is_array($catalog)) { $this->skuIblockId = $catalog["IBLOCK_ID"]; $this->skuPropertyId = $catalog["SKU_PROPERTY_ID"]; } } }
/** * Initializes internal object state. Must be called before usage. * * @throws \Bitrix\Main\LoaderException * @return void */ public function init() { $this->dictionary = new Dictionary($this->iblockId); $this->storage = new Storage($this->iblockId); if (self::$catalog === null) { self::$catalog = \Bitrix\Main\Loader::includeModule("catalog"); } if (self::$catalog) { $catalog = \CCatalogSKU::getInfoByProductIBlock($this->iblockId); if (!empty($catalog) && is_array($catalog)) { $this->skuIblockId = $catalog["IBLOCK_ID"]; $this->skuPropertyId = $catalog["SKU_PROPERTY_ID"]; } } }
/** * @param integer $iblockId Information block identifier. */ public function __construct($iblockId) { $this->iblockId = intval($iblockId); $this->valid = \CIBlock::getArrayByID($this->iblockId, "PROPERTY_INDEX") === "Y"; if (Loader::includeModule("catalog")) { $catalogInfo = \CCatalogSKU::getInfoByProductIBlock($this->iblockId); if (!empty($catalogInfo) && is_array($catalogInfo)) { $this->skuIblockId = $catalogInfo["IBLOCK_ID"]; $this->skuPropertyId = $catalogInfo["SKU_PROPERTY_ID"]; $this->valid = $this->valid && \CIBlock::getArrayByID($this->skuIblockId, "PROPERTY_INDEX") === "Y"; } } $this->dictionary = new \Bitrix\Iblock\PropertyIndex\Dictionary($this->iblockId); $this->storage = new \Bitrix\Iblock\PropertyIndex\Storage($this->iblockId); }
/** * @param integer $iblockId Information block identifier. */ public function __construct($iblockId) { $this->iblockId = intval($iblockId); $this->valid = \CIBlock::getArrayByID($this->iblockId, "PROPERTY_INDEX") === "Y"; if (self::$catalog === null) { self::$catalog = \Bitrix\Main\Loader::includeModule("catalog"); } if (self::$catalog) { $catalogInfo = \CCatalogSKU::getInfoByProductIBlock($this->iblockId); if (!empty($catalogInfo) && is_array($catalogInfo)) { $this->skuIblockId = $catalogInfo["IBLOCK_ID"]; $this->skuPropertyId = $catalogInfo["SKU_PROPERTY_ID"]; $this->valid = $this->valid && \CIBlock::getArrayByID($this->skuIblockId, "PROPERTY_INDEX") === "Y"; } } $this->dictionary = new Dictionary($this->iblockId); $this->storage = new Storage($this->iblockId); $this->valid = $this->valid && $this->dictionary->isExists(); }
public function loadFromDatabase() { if (!isset($this->fields)) { $this->fields = array(); $select = array_values($this->fieldMap); $elementList = \Freetrix\Iblock\ElementTable::getList(array("select" => $select, "filter" => array("=ID" => $this->id))); $this->elementFields = $elementList->fetch(); if ($this->elementFields) { $arCatalog = \CCatalogSKU::getInfoByProductIBlock($this->elementFields["IBLOCK_ID"]); if (is_array($arCatalog)) { $this->skuIblockId = $arCatalog["IBLOCK_ID"]; $skuList = \CIBlockElement::getList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"], "=PROPERTY_" . $arCatalog["SKU_PROPERTY_ID"] => $this->id), false, false, $select); while ($sku = $skuList->fetch()) { $this->skuList[] = $sku; foreach ($sku as $fieldName => $fieldValue) { $this->fields[$fieldName][] = $fieldValue; } } } } } return is_array($this->fields); }
protected function getOffersCatalog($iblockId) { if (self::$catalogIncluded === null) { self::$catalogIncluded = Main\Loader::includeModule('catalog'); } if (!self::$catalogIncluded) { return array(); } if (!isset(static::$offersCatalog[$iblockId])) { static::$offersCatalog[$iblockId] = \CCatalogSKU::getInfoByProductIBlock($iblockId); } return static::$offersCatalog[$iblockId]; }