33 if (self::$catalog ===
null)
35 self::$catalog = \Bitrix\Main\Loader::includeModule(
"catalog");
40 $catalog = \CCatalogSKU::getInfoByProductIBlock($this->iblockId);
43 $this->skuIblockId =
$catalog[
"IBLOCK_ID"];
44 $this->skuPropertyId =
$catalog[
"SKU_PROPERTY_ID"];
66 $this->elementPropertyValues = array();
68 "IBLOCK_ID" => $this->iblockId,
69 "=ID" => $this->elementId,
71 if ($this->skuIblockId > 0 && $this->skuPropertyId > 0)
74 "IBLOCK_ID" => $this->iblockId,
76 "=PROPERTY_".$this->skuPropertyId => $this->elementId,
80 $this->elementPrices = array();
83 $elements = $this->elementPropertyValues[
"IBLOCK_ELEMENT_ID"] ?? [
$this->elementId];
87 $this->elementSections = array();
101 if (!isset(self::$filterPropertyID[
$iblockId]))
104 $properties = \Bitrix\Iblock\SectionPropertyTable::getList(array(
105 "select" => array(
"PROPERTY_ID"),
107 "=IBLOCK_ID" => array($this->iblockId, $this->skuIblockId),
108 "=SMART_FILTER" =>
"Y",
111 while ($property = $properties->fetch())
113 self::$filterPropertyID[
$iblockId][$property[
'PROPERTY_ID']] = $property[
'PROPERTY_ID'];
118 self::$filterPropertyID[
$iblockId] = array_values(self::$filterPropertyID[
$iblockId]);
119 sort(self::$filterPropertyID[
$iblockId]);
122 $elementList = \CIBlockElement::getPropertyValues(
126 array(
'ID' => self::$filterPropertyID[
$iblockId])
129 while ($element = $elementList->fetch())
131 foreach ($element as $propertyId => $value)
133 if ($value !==
false)
135 if (!isset($this->elementPropertyValues[$propertyId]))
136 $this->elementPropertyValues[$propertyId] = array();
138 if (is_array($value))
139 $this->elementPropertyValues[$propertyId] = array_merge($this->elementPropertyValues[$propertyId], $value);
141 $this->elementPropertyValues[$propertyId][] = $value;
156 $priceList = \Bitrix\Catalog\PriceTable::getList(array(
157 'select' => array(
'ID',
'PRODUCT_ID',
'CATALOG_GROUP_ID',
'PRICE',
'CURRENCY',
'QUANTITY_FROM',
'QUANTITY_TO'),
158 'filter' => array(
'@PRODUCT_ID' => $productList)
160 while($price = $priceList->fetch())
162 if (!isset($this->elementPrices[$price[
"CATALOG_GROUP_ID"]][$price[
"CURRENCY"]]))
163 $this->elementPrices[$price[
"CATALOG_GROUP_ID"]][$price[
"CURRENCY"]] = array();
164 $priceValue = (float)$price[
"PRICE"];
165 $this->elementPrices[$price[
"CATALOG_GROUP_ID"]][$price[
"CURRENCY"]][(string)$priceValue] = $priceValue;
170 foreach ($this->elementPrices as $catalogGroupId => $currencyPrices)
172 foreach ($currencyPrices as $currency => $prices)
174 if (count($prices) > 2)
176 $this->elementPrices[$catalogGroupId][$currency] = array(
182 unset($currency, $prices);
184 unset($catalogGroupId, $currencyPrices);
196 $sectionList = \CIBlockElement::getElementGroups(
$elementId,
true, array(
"ID"));
197 while ($section = $sectionList->fetch())
199 $this->elementSections[] = $section[
"ID"];
212 return $this->elementPropertyValues[$propertyId] ?? [];
224 return $this->elementPrices[$priceId] ?? [];
236 return in_array($sectionId, $this->elementSections);
246 return array_unique($this->elementSections, SORT_NUMERIC);
261 return array_unique($sections, SORT_NUMERIC);
273 if (!isset(self::$sectionParents[$sectionId]))
276 $sectionList = \CIBlockSection::getNavChain($this->iblockId, $sectionId, array(
"ID"));
277 while ($section = $sectionList->fetch())
279 $sections[] = $section[
"ID"];
281 self::$sectionParents[$sectionId] = $sections;
283 return self::$sectionParents[$sectionId];
loadElementProperties(int $iblockId, array $elementFilter)
isElementSection($sectionId)
loadElementPrices(array $productList)
loadElementSections($elementId)
getPropertyValues($propertyId)
__construct($iblockId, $elementId)
getSectionParents($sectionId)