11Loc::loadMessages(__FILE__);
30 $arCatalogPrices =
array();
31 if (self::$catalogIncluded ===
null)
33 if (self::$catalogIncluded)
35 $arCatalogGroupCodesFilter =
array();
36 foreach($arPriceCode as $value)
38 $t_value = trim($value);
40 $arCatalogGroupCodesFilter[$value] =
true;
42 $arCatalogGroupsFilter =
array();
44 foreach ($arCatalogGroups as
$key => $value)
46 if (isset($arCatalogGroupCodesFilter[$value[
'NAME']]))
48 $arCatalogGroupsFilter[] =
$key;
49 $arCatalogPrices[$value[
"NAME"]] =
array(
50 "ID" => (
int)$value[
"ID"],
51 "CODE" => $value[
"NAME"],
52 "SORT" => (
int)$value[
"SORT"],
53 "BASE" => $value[
"BASE"],
54 "XML_ID" => $value[
"XML_ID"],
56 "~TITLE" => $value[
"NAME_LANG"],
57 "SELECT" =>
"CATALOG_GROUP_".$value[
"ID"],
58 "SELECT_EXTENDED" =>
array(
"PRICE_".$value[
"ID"],
"CURRENCY_".$value[
"ID"],
"SCALED_PRICE_".$value[
"ID"])
62 $userGroups =
array(2);
64 $userGroups =
$USER->GetUserGroupArray();
66 foreach($arCatalogPrices as
$name=>$value)
68 $arCatalogPrices[
$name][
"CAN_VIEW"] = in_array($value[
"ID"], $arPriceGroups[
"view"]);
69 $arCatalogPrices[
$name][
"CAN_BUY"] = in_array($value[
"ID"], $arPriceGroups[
"buy"]);
74 $rsProperties = CIBlockProperty::GetList(
array(),
array(
76 "CHECK_PERMISSIONS" =>
"N",
77 "PROPERTY_TYPE" =>
"N",
80 while ($arProperty = $rsProperties->Fetch())
82 if (in_array($arProperty[
"CODE"], $arPriceCode))
84 $arCatalogPrices[$arProperty[
"CODE"]] =
array(
85 "ID" => (
int)$arProperty[
"ID"],
86 "CODE" => $arProperty[
"CODE"],
87 "SORT" => (
int)$arProperty[
"SORT"],
89 "XML_ID" => $arProperty[
"XML_ID"],
91 "~TITLE" => $arProperty[
"NAME"],
92 "SELECT" =>
"PROPERTY_".$arProperty[
"ID"],
93 "SELECT_EXTENDED" =>
array(
"PROPERTY_".$arProperty[
"ID"]),
100 return $arCatalogPrices;
110 if (empty($arPriceTypes) || !is_array($arPriceTypes))
113 foreach ($arPriceTypes as $arOnePriceType)
115 if ($arOnePriceType[
'CAN_VIEW'] || $arOnePriceType[
'CAN_BUY'])
116 $arResult[] = (int)$arOnePriceType[
'ID'];
118 unset($arOnePriceType);
128 if (!is_array($arUserGroups))
131 if (empty($arUserGroups))
139 self::$needDiscountCache =
false;
140 if (self::$saleIncluded ===
null)
142 if (self::$saleIncluded)
145 $ids = $cache->getDiscountIds($arUserGroups);
148 $discountList = $cache->getDiscounts(
154 if (!empty($discountList))
163 if (self::$catalogIncluded ===
null)
165 if (self::$catalogIncluded)
167 if (!is_array($arCatalogGroups))
170 if (empty($arUserGroups))
173 $arRestFilter =
array(
174 'PRICE_TYPES' => $arCatalogGroups,
175 'USER_GROUPS' => $arUserGroups,
178 $arDiscountFilter =
array();
179 $arDiscountResult =
array();
180 if (empty($arRest) || (array_key_exists(
'DISCOUNTS', $arRest) && empty($arRest[
'DISCOUNTS'])))
182 foreach ($arCatalogGroups as $intOneGroupID)
185 $arDiscountFilter[$strCacheKey] =
array();
187 unset($intOneGroupID);
191 $arResultDiscountList =
array();
194 'ID',
'TYPE',
'SITE_ID',
'ACTIVE',
'ACTIVE_FROM',
'ACTIVE_TO',
195 'RENEWAL',
'NAME',
'SORT',
'MAX_DISCOUNT',
'VALUE_TYPE',
'VALUE',
'CURRENCY',
196 'PRIORITY',
'LAST_DISCOUNT',
197 'USE_COUPONS',
'UNPACK',
'CONDITIONS'
200 $discountRows = array_chunk($arRest[
'DISCOUNTS'], 500);
201 foreach ($discountRows as $pageIds)
203 $discountFilter =
array(
210 '<=ACTIVE_FROM' => $currentDatetime
215 '>=ACTIVE_TO' => $currentDatetime
217 '=USE_COUPONS' =>
'N',
220 CTimeZone::Disable();
223 'filter' => $discountFilter
227 $row[
'ID'] = (int)$row[
'ID'];
228 $row[
'HANDLERS'] =
array();
229 $row[
'MODULE_ID'] =
'catalog';
230 $row[
'TYPE'] = (int)$row[
'TYPE'];
232 $row[
'ACTIVE_FROM'] = $row[
'ACTIVE_FROM']->toString();
234 $row[
'ACTIVE_TO'] = $row[
'ACTIVE_TO']->toString();
235 $row[
'COUPON_ACTIVE'] =
'';
237 $row[
'COUPON_ONE_TIME'] =
null;
238 $arResultDiscountList[$row[
'ID']] = $row;
243 unset($pageIds, $discountRows);
245 foreach ($arCatalogGroups as $intOneGroupID)
248 $arDiscountDetailList =
array();
249 $arDiscountList =
array();
250 foreach ($arRest[
'RESTRICTIONS'] as $intDiscountID => $arDiscountRest)
252 if (empty($arDiscountRest[
'PRICE_TYPE']) || array_key_exists($intOneGroupID, $arDiscountRest[
'PRICE_TYPE']))
254 $arDiscountList[] = $intDiscountID;
255 if (isset($arResultDiscountList[$intDiscountID]))
256 $arDiscountDetailList[] = $arResultDiscountList[$intDiscountID];
259 sort($arDiscountList);
260 $arDiscountFilter[$strCacheKey] = $arDiscountList;
262 $arDiscountResult[$strResultCacheKey] = $arDiscountDetailList;
264 unset($intOneGroupID);
269 self::$needDiscountCache =
$result;
277 $arItem, $bVATInclude =
true,
278 $arCurrencyParams =
array(),
285 if (empty($arCatalogPrices) || !is_array($arCatalogPrices))
289 static $arCurUserGroups =
array();
290 static $strBaseCurrency =
'';
292 if (self::$catalogIncluded ===
null)
294 if (self::$catalogIncluded)
297 $USER_ID = (int)$USER_ID;
298 $intUserID = ($USER_ID > 0 ? $USER_ID : 0);
299 if ($intUserID == 0 && $existUser)
300 $intUserID = (int)
$USER->GetID();
301 if (!isset($arCurUserGroups[$intUserID]))
303 $arUserGroups =
array(2);
305 $arUserGroups = CUser::GetUserGroup($intUserID);
307 $arUserGroups =
$USER->GetUserGroupArray();
309 $arCurUserGroups[$intUserID] = $arUserGroups;
310 unset($arUserGroups);
312 $arUserGroups = $arCurUserGroups[$intUserID];
314 $boolConvert =
false;
315 $resultCurrency =
'';
316 if (isset($arCurrencyParams[
'CURRENCY_ID']) && !empty($arCurrencyParams[
'CURRENCY_ID']))
319 $resultCurrency = $arCurrencyParams[
'CURRENCY_ID'];
321 if (!$boolConvert &&
'' == $strBaseCurrency)
322 $strBaseCurrency = Currency\CurrencyManager::getBaseCurrency();
324 $percentVat = $arItem[
'CATALOG_VAT'] * 0.01;
325 $percentPriceWithVat = 1 + $arItem[
'CATALOG_VAT'] * 0.01;
328 $boolStartMin =
true;
330 $strMinCurrency = ($boolConvert ? $resultCurrency : $strBaseCurrency);
332 foreach ($arCatalogPrices as
$key => $value)
334 $catalogPriceValue =
'CATALOG_PRICE_'.$value[
'ID'];
335 $catalogCurrencyValue =
'CATALOG_CURRENCY_'.$value[
'ID'];
338 || !isset($arItem[$catalogPriceValue])
339 || $arItem[$catalogPriceValue] ==
''
343 $arItem[$catalogPriceValue] = (float)$arItem[$catalogPriceValue];
345 if ($arItem[
'CATALOG_VAT_INCLUDED'] !=
'Y')
346 $arItem[$catalogPriceValue] *= $percentPriceWithVat;
348 $originalCurrency = $arItem[$catalogCurrencyValue];
349 $calculateCurrency = $arItem[$catalogCurrencyValue];
350 $calculatePrice = $arItem[$catalogPriceValue];
351 $cnangeCurrency = ($boolConvert && $resultCurrency != $calculateCurrency);
354 $calculateCurrency = $resultCurrency;
359 $discounts =
array();
360 if (self::isEnabledCalculationDiscounts())
362 $discounts = CCatalogDiscount::GetDiscount(
364 $arItem[
'IBLOCK_ID'],
378 if ($discountPrice ===
false)
381 $originalPriceWithVat = $arItem[$catalogPriceValue];
382 $priceWithVat = $calculatePrice;
383 $discountPriceWithVat = $discountPrice;
388 $originalDiscountPrice = $discountPrice;
389 $originalDiscountPriceWithVat = $originalDiscountPrice;
391 $arItem[$catalogPriceValue] /= $percentPriceWithVat;
392 $calculatePrice /= $percentPriceWithVat;
393 $originalDiscountPrice /= $percentPriceWithVat;
394 $discountPrice /= $percentPriceWithVat;
396 $originalVatValue = $originalPriceWithVat - $arItem[$catalogPriceValue];
397 $vatValue = $priceWithVat - $calculatePrice;
398 $originalDiscountVatValue = $originalDiscountPriceWithVat - $originalDiscountPrice;
399 $discountVatValue = $discountPriceWithVat - $discountPrice;
401 $roundPriceWithVat = Catalog\Product\Price::roundPrice($value[
'ID'], $discountPriceWithVat, $calculateCurrency);
402 $roundPrice = Catalog\Product\Price::roundPrice($value[
'ID'], $discountPrice, $calculateCurrency);
404 $priceResult =
array(
405 'VALUE_NOVAT' => $calculatePrice,
406 'PRINT_VALUE_NOVAT' => CCurrencyLang::CurrencyFormat($calculatePrice, $calculateCurrency,
true),
408 'VALUE_VAT' => $priceWithVat,
409 'PRINT_VALUE_VAT' => CCurrencyLang::CurrencyFormat($priceWithVat, $calculateCurrency,
true),
411 'VATRATE_VALUE' => $vatValue,
412 'PRINT_VATRATE_VALUE' => CCurrencyLang::CurrencyFormat($vatValue, $calculateCurrency,
true),
414 'DISCOUNT_VALUE_NOVAT' => $discountPrice,
415 'PRINT_DISCOUNT_VALUE_NOVAT' => CCurrencyLang::CurrencyFormat($discountPrice, $calculateCurrency,
true),
417 'DISCOUNT_VALUE_VAT' => $discountPriceWithVat,
418 'PRINT_DISCOUNT_VALUE_VAT' => CCurrencyLang::CurrencyFormat($discountPriceWithVat, $calculateCurrency,
true),
420 'DISCOUNT_VATRATE_VALUE' => $discountVatValue,
421 'PRINT_DISCOUNT_VATRATE_VALUE' => CCurrencyLang::CurrencyFormat($discountVatValue, $calculateCurrency,
true),
423 'CURRENCY' => $calculateCurrency,
425 'ROUND_VALUE_VAT' => $roundPriceWithVat,
426 'ROUND_VALUE_NOVAT' => $roundPrice,
427 'ROUND_VATRATE_VALUE' => $roundPriceWithVat - $roundPrice,
432 $priceResult[
'ORIG_VALUE_NOVAT'] = $arItem[$catalogPriceValue];
433 $priceResult[
'ORIG_VALUE_VAT'] = $originalPriceWithVat;
434 $priceResult[
'ORIG_VATRATE_VALUE'] = $originalVatValue;
435 $priceResult[
'ORIG_DISCOUNT_VALUE_NOVAT'] = $originalDiscountPrice;
436 $priceResult[
'ORIG_DISCOUNT_VALUE_VAT'] = $originalDiscountPriceWithVat;
437 $priceResult[
'ORIG_DISCOUNT_VATRATE_VALUE'] = $originalDiscountVatValue;
438 $priceResult[
'ORIG_CURRENCY'] = $originalCurrency;
441 $priceResult[
'PRICE_ID'] = $value[
'ID'];
442 $priceResult[
'ID'] = $arItem[
'CATALOG_PRICE_ID_'.$value[
'ID']];
443 $priceResult[
'CAN_ACCESS'] = $arItem[
'CATALOG_CAN_ACCESS_'.$value[
'ID']];
444 $priceResult[
'CAN_BUY'] = $arItem[
'CATALOG_CAN_BUY_'.$value[
'ID']];
445 $priceResult[
'MIN_PRICE'] =
'N';
449 $priceResult[
'VALUE'] = $priceWithVat;
450 $priceResult[
'PRINT_VALUE'] = $priceResult[
'PRINT_VALUE_VAT'];
451 $priceResult[
'UNROUND_DISCOUNT_VALUE'] = $discountPriceWithVat;
452 $priceResult[
'DISCOUNT_VALUE'] = $roundPriceWithVat;
453 $priceResult[
'PRINT_DISCOUNT_VALUE'] = CCurrencyLang::CurrencyFormat(
461 $priceResult[
'VALUE'] = $calculatePrice;
462 $priceResult[
'PRINT_VALUE'] = $priceResult[
'PRINT_VALUE_NOVAT'];
463 $priceResult[
'UNROUND_DISCOUNT_VALUE'] = $discountPrice;
464 $priceResult[
'DISCOUNT_VALUE'] = $roundPrice;
465 $priceResult[
'PRINT_DISCOUNT_VALUE'] = CCurrencyLang::CurrencyFormat(
472 if ((
roundEx($priceResult[
'VALUE'], 2) -
roundEx($priceResult[
'UNROUND_DISCOUNT_VALUE'], 2)) < 0.01)
474 $priceResult[
'VALUE'] = $priceResult[
'DISCOUNT_VALUE'];
475 $priceResult[
'PRINT_VALUE'] = $priceResult[
'PRINT_DISCOUNT_VALUE'];
476 $priceResult[
'DISCOUNT_DIFF'] = 0;
477 $priceResult[
'DISCOUNT_DIFF_PERCENT'] = 0;
481 $priceResult[
'DISCOUNT_DIFF'] = $priceResult[
'VALUE'] - $priceResult[
'DISCOUNT_VALUE'];
482 $priceResult[
'DISCOUNT_DIFF_PERCENT'] =
roundEx(100*$priceResult[
'DISCOUNT_DIFF']/$priceResult[
'VALUE'], 0);
484 $priceResult[
'PRINT_DISCOUNT_DIFF'] = CCurrencyLang::CurrencyFormat(
485 $priceResult[
'DISCOUNT_DIFF'],
492 $dblMinPrice = ($boolConvert || ($calculateCurrency == $strMinCurrency)
493 ? $priceResult[
'DISCOUNT_VALUE']
497 $boolStartMin =
false;
501 $dblComparePrice = ($boolConvert || ($calculateCurrency == $strMinCurrency)
502 ? $priceResult[
'DISCOUNT_VALUE']
505 if ($dblMinPrice > $dblComparePrice)
507 $dblMinPrice = $dblComparePrice;
511 unset($calculateCurrency);
512 unset($originalCurrency);
514 $arPrices[
$key] = $priceResult;
517 if ($strMinCode !=
'')
518 $arPrices[$strMinCode][
'MIN_PRICE'] =
'Y';
521 unset($percentPriceWithVat);
527 $boolStartMin =
true;
529 foreach($arCatalogPrices as
$key => $value)
531 if (!$value[
'CAN_VIEW'])
534 $dblValue = round(doubleval($arItem[
"PROPERTY_".$value[
"ID"].
"_VALUE"]), 2);
537 $dblMinPrice = $dblValue;
539 $boolStartMin =
false;
543 if ($dblMinPrice > $dblValue)
545 $dblMinPrice = $dblValue;
550 "ID" => $arItem[
"PROPERTY_".$value[
"ID"].
"_VALUE_ID"],
551 "VALUE" => $dblValue,
552 "PRINT_VALUE" => $dblValue.
" ".$arItem[
"PROPERTY_".$value[
"ID"].
"_DESCRIPTION"],
553 "DISCOUNT_VALUE" => $dblValue,
554 "PRINT_DISCOUNT_VALUE" => $dblValue.
" ".$arItem[
"PROPERTY_".$value[
"ID"].
"_DESCRIPTION"],
555 "CURRENCY" => $arItem[
"PROPERTY_".$value[
"ID"].
"_DESCRIPTION"],
556 "CAN_ACCESS" =>
true,
558 'DISCOUNT_DIFF_PERCENT' => 0,
559 'DISCOUNT_DIFF' => 0,
560 'PRINT_DISCOUNT_DIFF' =>
'0 '.$arItem[
"PROPERTY_".$value[
"ID"].
"_DESCRIPTION"],
562 'PRICE_ID' => $value[
'ID']
565 if ($strMinCode !=
'')
566 $arPrices[$strMinCode][
'MIN_PRICE'] =
'Y';
583 if (isset($arItem[
'ACTIVE']) && $arItem[
'ACTIVE'] ===
'N')
586 if (isset($arItem[
'CATALOG_AVAILABLE']) && $arItem[
'CATALOG_AVAILABLE'] ===
'N')
588 if (isset($arItem[
'AVAILABLE']) && $arItem[
'AVAILABLE'] ===
'N')
591 if (!empty($arItem[
"PRICE_MATRIX"]) && is_array($arItem[
"PRICE_MATRIX"]))
593 return $arItem[
"PRICE_MATRIX"][
"AVAILABLE"] ==
"Y";
597 if (empty($arCatalogPrices) || !is_array($arCatalogPrices))
600 foreach ($arCatalogPrices as $arPrice)
603 if ($arPrice[
"CAN_BUY"] && isset($arItem[
"CATALOG_PRICE_".$arPrice[
"ID"]]))
617 static $cache =
array();
618 static $userTypeList =
array();
619 $propertyTypeSupport =
array(
634 foreach ($arPropertiesList as $pid)
636 if (preg_match(
"/[^A-Za-z0-9_]/", $pid) || !isset($arPropertiesValues[$pid]))
638 $prop = $arPropertiesValues[$pid];
639 $prop[
'ID'] = (int)$prop[
'ID'];
640 if (!isset($propertyTypeSupport[$prop[
'MULTIPLE']][$prop[
'PROPERTY_TYPE']]))
645 $productProp =
array(
'VALUES' =>
array(),
'SELECTED' =>
false,
'SET' =>
false);
647 $userTypeProp =
false;
649 if (isset($prop[
'USER_TYPE']) && !empty($prop[
'USER_TYPE']))
651 if (!isset($userTypeList[$prop[
'USER_TYPE']]))
653 $userTypeDescr = CIBlockProperty::GetUserType($prop[
'USER_TYPE']);
654 if (isset($userTypeDescr[
'GetPublicViewHTML']))
656 $userTypeList[$prop[
'USER_TYPE']] = $userTypeDescr[
'GetPublicViewHTML'];
659 if (isset($userTypeList[$prop[
'USER_TYPE']]))
661 $userTypeProp =
true;
662 $userType = $userTypeList[$prop[
'USER_TYPE']];
666 if ($prop[
"MULTIPLE"] ==
"Y" && !empty($prop[
"VALUE"]) && is_array($prop[
"VALUE"]))
671 foreach($prop[
"VALUE"] as $value)
673 if (!is_scalar($value))
675 $value = (string)$value;
676 $displayValue = (string)call_user_func_array($userType,
679 array(
'VALUE' => $value),
682 if (
'' !== $displayValue)
684 if ($productProp[
"SELECTED"] ===
false)
685 $productProp[
"SELECTED"] = $value;
687 $emptyValues =
false;
691 $productProp[
'SET'] = ($countValues === 1);
695 switch($prop[
"PROPERTY_TYPE"])
700 foreach($prop[
"VALUE"] as $value)
702 if (!is_scalar($value))
704 $value = (string)$value;
707 if($productProp[
"SELECTED"] ===
false)
708 $productProp[
"SELECTED"] = $value;
709 $productProp[
"VALUES"][$value] = $value;
710 $emptyValues =
false;
713 $productProp[
'SET'] = ($countValues === 1);
718 foreach($prop[
"VALUE"] as $value)
720 $value = (int)$value;
727 $rsSections = CIBlockSection::GetList(
728 array(
"LEFT_MARGIN"=>
"ASC"),
733 while ($arSection = $rsSections->GetNext())
735 $arSection[
"ID"] = (int)$arSection[
"ID"];
736 if ($productProp[
"SELECTED"] ===
false)
737 $productProp[
"SELECTED"] = $arSection[
"ID"];
738 $productProp[
"VALUES"][$arSection[
"ID"]] = $arSection[
"NAME"];
739 $emptyValues =
false;
742 $productProp[
'SET'] = ($countValues === 1);
747 foreach($prop[
"VALUE"] as $value)
749 $value = (int)$value;
756 $rsElements = CIBlockElement::GetList(
757 array(
"ID" =>
"ASC"),
763 while($arElement = $rsElements->GetNext())
765 $arElement[
'ID'] = (int)$arElement[
'ID'];
766 if($productProp[
"SELECTED"] ===
false)
767 $productProp[
"SELECTED"] = $arElement[
"ID"];
768 $productProp[
"VALUES"][$arElement[
"ID"]] = $arElement[
"NAME"];
769 $emptyValues =
false;
772 $productProp[
'SET'] = ($countValues === 1);
777 foreach($prop[
"VALUE"] as
$i => $value)
779 $prop[
"VALUE_ENUM_ID"][
$i] = (int)$prop[
"VALUE_ENUM_ID"][
$i];
780 if($productProp[
"SELECTED"] ===
false)
781 $productProp[
"SELECTED"] = $prop[
"VALUE_ENUM_ID"][
$i];
782 $productProp[
"VALUES"][$prop[
"VALUE_ENUM_ID"][
$i]] = $value;
783 $emptyValues =
false;
786 $productProp[
'SET'] = ($countValues === 1);
791 elseif($prop[
"MULTIPLE"] ==
"N")
793 switch($prop[
"PROPERTY_TYPE"])
796 if (0 == (
int)$prop[
"VALUE_ENUM_ID"])
798 if (isset($cache[$prop[
'ID']]))
800 $productProp = $cache[$prop[
'ID']];
801 $emptyValues =
false;
806 array(
"SORT"=>
"ASC",
"VALUE"=>
"ASC"),
809 while ($arEnum = $rsEnum->GetNext())
811 $arEnum[
"ID"] = (int)$arEnum[
"ID"];
812 $productProp[
"VALUES"][$arEnum[
"ID"]] = $arEnum[
"VALUE"];
813 if ($arEnum[
"DEF"] ==
"Y")
814 $productProp[
"SELECTED"] = $arEnum[
"ID"];
815 $emptyValues =
false;
819 $cache[$prop[
'ID']] = $productProp;
825 $prop[
'VALUE_ENUM_ID'] = (int)$prop[
'VALUE_ENUM_ID'];
826 $productProp[
'VALUES'][$prop[
'VALUE_ENUM_ID']] = $prop[
'VALUE'];
827 $productProp[
'SELECTED'] = $prop[
'VALUE_ENUM_ID'];
828 $productProp[
'SET'] =
true;
829 $emptyValues =
false;
833 if (0 == (
int)$prop[
'VALUE'])
835 if (isset($cache[$prop[
'ID']]))
837 $productProp = $cache[$prop[
'ID']];
838 $emptyValues =
false;
842 if($prop[
"LINK_IBLOCK_ID"] > 0)
844 $rsElements = CIBlockElement::GetList(
845 array(
"NAME"=>
"ASC",
"SORT"=>
"ASC"),
846 array(
"IBLOCK_ID"=>$prop[
"LINK_IBLOCK_ID"],
"ACTIVE"=>
"Y"),
850 while ($arElement = $rsElements->GetNext())
852 $arElement[
'ID'] = (int)$arElement[
'ID'];
853 if($productProp[
"SELECTED"] ===
false)
854 $productProp[
"SELECTED"] = $arElement[
"ID"];
855 $productProp[
"VALUES"][$arElement[
"ID"]] = $arElement[
"NAME"];
856 $emptyValues =
false;
860 $cache[$prop[
'ID']] = $productProp;
867 $rsElements = CIBlockElement::GetList(
869 array(
'ID' => $prop[
"VALUE"],
'ACTIVE' =>
'Y'),
874 if ($arElement = $rsElements->GetNext())
876 $arElement[
'ID'] = (int)$arElement[
'ID'];
877 $productProp[
'VALUES'][$arElement[
'ID']] = $arElement[
'NAME'];
878 $productProp[
'SELECTED'] = $arElement[
'ID'];
879 $productProp[
'SET'] =
true;
880 $emptyValues =
false;
899 if (!empty($productProps) && is_array($productProps))
901 foreach ($productProps as $propID => $propInfo)
903 if (isset($propInfo[
'SET']) && $propInfo[
'SET'])
906 'ID' => $propInfo[
'SELECTED'],
907 'VALUE' => $propInfo[
'VALUES'][$propInfo[
'SELECTED']]
922 $propertyTypeSupport =
array(
935 $iblockID = (int)$iblockID;
939 $enablePartialList = (
true === $enablePartialList);
942 if (!is_array($propertiesList))
943 $propertiesList =
array();
944 if (empty($propertiesList))
946 $checkProps = array_fill_keys($propertiesList,
true);
947 $propCodes = $checkProps;
948 $existProps =
array();
950 while ($oneProp =
$rsProps->Fetch())
952 if (!isset($propCodes[$oneProp[
'CODE']]) && !isset($propCodes[$oneProp[
'ID']]))
954 $propID = (isset($propCodes[$oneProp[
'CODE']]) ? $oneProp[
'CODE'] : $oneProp[
'ID']);
955 if (!isset($checkProps[$propID]))
958 if (!isset($propertyTypeSupport[$oneProp[
'MULTIPLE']][$oneProp[
'PROPERTY_TYPE']]))
960 return ($oneProp[
'MULTIPLE'] ==
'Y' ? 2 : 3);
963 if (
null !== $oneProp[
'VALUE'])
965 $existProps[$propID] =
true;
968 if (!isset($propertiesValues[$propID]))
970 if ($enablePartialList)
977 if (!is_scalar($propertiesValues[$propID]))
980 $propertiesValues[$propID] = (string)$propertiesValues[$propID];
981 $existValue = (
'' != $propertiesValues[$propID]);
985 $userTypeProp =
false;
987 if (isset($oneProp[
'USER_TYPE']) && !empty($oneProp[
'USER_TYPE']))
989 $userTypeDescr = CIBlockProperty::GetUserType($oneProp[
'USER_TYPE']);
990 if (isset($userTypeDescr[
'GetPublicViewHTML']))
992 $userTypeProp =
true;
993 $userType = $userTypeDescr[
'GetPublicViewHTML'];
997 if ($oneProp[
"MULTIPLE"] ==
"Y")
1001 if ($oneProp[
"VALUE"] == $propertiesValues[$propID])
1003 $displayValue = (string)call_user_func_array($userType,
1006 array(
'VALUE' => $oneProp[
'VALUE']),
1007 array(
'MODE' =>
'SIMPLE_TEXT')
1010 "NAME" => $oneProp[
"NAME"],
1012 "VALUE" => $displayValue,
1013 "SORT" => $sortIndex++,
1015 unset($checkProps[$propID]);
1020 switch($oneProp[
"PROPERTY_TYPE"])
1024 if ($oneProp[
"VALUE"] == $propertiesValues[$propID])
1027 "NAME" => $oneProp[
"NAME"],
1029 "VALUE" => $oneProp[
"VALUE"],
1030 "SORT" => $sortIndex++,
1032 unset($checkProps[$propID]);
1036 if ($oneProp[
"VALUE"] == $propertiesValues[$propID])
1038 $rsSection = CIBlockSection::GetList(
1040 array(
"=ID" => $oneProp[
"VALUE"]),
1044 if($arSection = $rsSection->Fetch())
1047 "NAME" => $oneProp[
"NAME"],
1049 "VALUE" => $arSection[
"NAME"],
1050 "SORT" => $sortIndex++,
1052 unset($checkProps[$propID]);
1057 if ($oneProp[
"VALUE"] == $propertiesValues[$propID])
1059 $rsElement = CIBlockElement::GetList(
1061 array(
"=ID" => $oneProp[
"VALUE"]),
1066 if ($arElement = $rsElement->Fetch())
1069 "NAME" => $oneProp[
"NAME"],
1071 "VALUE" => $arElement[
"NAME"],
1072 "SORT" => $sortIndex++,
1074 unset($checkProps[$propID]);
1079 if ($oneProp[
"VALUE"] == $propertiesValues[$propID])
1083 array(
"ID" => $propertiesValues[$propID],
"IBLOCK_ID" => $iblockID,
"PROPERTY_ID" => $oneProp[
'ID'])
1085 if ($arEnum = $rsEnum->Fetch())
1088 "NAME" => $oneProp[
"NAME"],
1090 "VALUE" => $arEnum[
"VALUE"],
1091 "SORT" => $sortIndex++,
1093 unset($checkProps[$propID]);
1102 switch ($oneProp[
"PROPERTY_TYPE"])
1105 if (0 < (
int)$propertiesValues[$propID])
1109 array(
"ID" => $propertiesValues[$propID],
"IBLOCK_ID" => $iblockID,
"PROPERTY_ID" => $oneProp[
'ID'])
1111 if ($arEnum = $rsEnum->Fetch())
1114 "NAME" => $oneProp[
"NAME"],
1116 "VALUE" => $arEnum[
"VALUE"],
1117 "SORT" => $sortIndex++,
1119 unset($checkProps[$propID]);
1124 if (0 < (
int)$propertiesValues[$propID])
1126 $rsElement = CIBlockElement::GetList(
1128 array(
"=ID" => $propertiesValues[$propID]),
1133 if ($arElement = $rsElement->Fetch())
1136 "NAME" => $oneProp[
"NAME"],
1138 "VALUE" => $arElement[
"NAME"],
1139 "SORT" => $sortIndex++,
1141 unset($checkProps[$propID]);
1149 if ($enablePartialList && !empty($checkProps))
1151 $nonExistProps = array_keys($checkProps);
1152 foreach ($nonExistProps as &$oneCode)
1154 if (!isset($existProps[$oneCode]))
1155 unset($checkProps[$oneCode]);
1160 if(!empty($checkProps))
1172 if (self::$catalogIncluded ===
null)
1174 if (self::$catalogIncluded)
1180 'OFFERS_IBLOCK_ID' =>
$arCatalog[
'IBLOCK_ID'],
1181 'OFFERS_PROPERTY_ID' =>
$arCatalog[
'SKU_PROPERTY_ID'],
1191 $iblockInfo =
false;
1194 $iblockID = (int)$iblockID;
1195 $offerID = (int)$offerID;
1196 if (0 >= $iblockID || 0 >= $offerID)
1199 $skuPropsList =
array();
1200 if (!empty($skuTreeProps))
1202 if (is_array($skuTreeProps))
1204 $skuPropsList = $skuTreeProps;
1208 $skuTreeProps = base64_decode((
string)$skuTreeProps);
1211 $skuPropsList = unserialize($skuTreeProps, [
'allowed_classes' =>
false]);
1212 if (!is_array($skuPropsList))
1214 $skuPropsList =
array();
1220 if (!is_array($propertiesList))
1222 $propertiesList =
array();
1224 if (!empty($skuPropsList))
1226 $propertiesList = array_unique(array_merge($propertiesList, $skuPropsList));
1228 if (empty($propertiesList))
1230 $propCodes = array_fill_keys($propertiesList,
true);
1232 if (self::$catalogIncluded ===
null)
1234 if (self::$catalogIncluded)
1236 $iblockInfo = CCatalogSku::GetInfoByProductIBlock($iblockID);
1237 if (empty($iblockInfo))
1239 $iblockInfo = CCatalogSku::GetInfoByOfferIBlock($iblockID);
1242 if (empty($iblockInfo))
1246 $rsProps = CIBlockElement::GetProperty(
1247 $iblockInfo[
'IBLOCK_ID'],
1249 array(
"sort"=>
"asc",
"enum_sort" =>
"asc",
"value_id"=>
"asc"),
1253 while ($oneProp =
$rsProps->Fetch())
1255 if (!isset($propCodes[$oneProp[
'CODE']]) && !isset($propCodes[$oneProp[
'ID']]))
1257 $propID = (isset($propCodes[$oneProp[
'CODE']]) ? $oneProp[
'CODE'] : $oneProp[
'ID']);
1259 $userTypeProp =
false;
1261 if (isset($oneProp[
'USER_TYPE']) && !empty($oneProp[
'USER_TYPE']))
1263 $userTypeDescr = CIBlockProperty::GetUserType($oneProp[
'USER_TYPE']);
1264 if (isset($userTypeDescr[
'GetPublicViewHTML']))
1266 $userTypeProp =
true;
1267 $userType = $userTypeDescr[
'GetPublicViewHTML'];
1273 $displayValue = (string)call_user_func_array($userType,
1276 array(
'VALUE' => $oneProp[
'VALUE']),
1277 array(
'MODE' =>
'SIMPLE_TEXT')
1280 "NAME" => $oneProp[
"NAME"],
1282 "VALUE" => $displayValue,
1283 "SORT" => $sortIndex++,
1288 switch ($oneProp[
"PROPERTY_TYPE"])
1293 "NAME" => $oneProp[
"NAME"],
1295 "VALUE" => $oneProp[
"VALUE"],
1296 "SORT" => $sortIndex++,
1300 $rsSection = CIBlockSection::GetList(
1302 array(
"=ID"=>$oneProp[
"VALUE"]),
1306 if ($arSection = $rsSection->Fetch())
1309 "NAME" => $oneProp[
"NAME"],
1311 "VALUE" => $arSection[
"NAME"],
1312 "SORT" => $sortIndex++,
1317 $rsElement = CIBlockElement::GetList(
1319 array(
"=ID"=>$oneProp[
"VALUE"]),
1324 if ($arElement = $rsElement->Fetch())
1327 "NAME" => $oneProp[
"NAME"],
1329 "VALUE" => $arElement[
"NAME"],
1330 "SORT" => $sortIndex++,
1336 "NAME" => $oneProp[
"NAME"],
1338 "VALUE" => $oneProp[
"VALUE_ENUM"],
1339 "SORT" => $sortIndex++,
1348 public static function GetOffersArray(
$arFilter, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams =
array(), $USER_ID = 0, $LID =
SITE_ID)
1354 $boolCheckPermissions =
false;
1355 $boolHideNotAvailable =
false;
1356 $showPriceCount =
false;
1357 $customFilter =
false;
1364 if (isset(
$arFilter[
'HIDE_NOT_AVAILABLE']))
1365 $boolHideNotAvailable = (
$arFilter[
'HIDE_NOT_AVAILABLE'] ===
'Y');
1366 if (isset(
$arFilter[
'CHECK_PERMISSIONS']))
1367 $boolCheckPermissions = (
$arFilter[
'CHECK_PERMISSIONS'] ===
'Y');
1368 if (isset(
$arFilter[
'SHOW_PRICE_COUNT']))
1370 $showPriceCount = (int)
$arFilter[
'SHOW_PRICE_COUNT'];
1371 if ($showPriceCount <= 0)
1372 $showPriceCount =
false;
1377 $customFilter =
$arFilter[
'CUSTOM_FILTER'];
1385 if (self::$needDiscountCache ===
null)
1389 self::$needDiscountCache =
false;
1394 if (empty($pricesAllow))
1396 self::$needDiscountCache =
false;
1400 $USER_ID = (int)$USER_ID;
1401 $userGroups =
array(2);
1403 $userGroups = CUser::GetUserGroup($USER_ID);
1405 $userGroups =
$USER->GetUserGroupArray();
1409 unset($pricesAllow);
1416 $arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(
true,
true);
1418 $limit = (int)$limit;
1422 if (!isset($arOrder[
"ID"]))
1423 $arOrder[
"ID"] =
"DESC";
1427 $productProperty =
'PROPERTY_'.$arOffersIBlock[
'OFFERS_PROPERTY_ID'];
1428 $productPropertyValue = $productProperty.
'_VALUE';
1430 $propertyList =
array();
1431 if (!empty($arSelectProperties))
1433 $selectProperties = array_fill_keys($arSelectProperties,
true);
1435 'select' =>
array(
'ID',
'CODE'),
1437 'order' =>
array(
'SORT' =>
'ASC',
'ID' =>
'ASC')
1439 while ($property = $propertyIterator->fetch())
1441 $code = (string)$property[
'CODE'];
1443 $code = $property[
'ID'];
1444 if (!isset($selectProperties[
$code]))
1446 $propertyList[] =
$code;
1449 unset($property, $propertyIterator);
1450 unset($selectProperties);
1455 $productProperty => $arElementID,
1457 "ACTIVE_DATE" =>
"Y",
1460 if (!empty($customFilter))
1465 if ($boolHideNotAvailable)
1467 if ($boolCheckPermissions)
1476 $productProperty => 1,
1477 "CATALOG_QUANTITY" => 1
1481 foreach($arPrices as $value)
1483 if (!$value[
'CAN_VIEW'] && !$value[
'CAN_BUY'])
1485 $arSelect[$value[
"SELECT"]] = 1;
1486 if ($showPriceCount !==
false)
1488 $arFilter[
'CATALOG_SHOP_QUANTITY_'.$value[
'ID']] = $showPriceCount;
1493 if (!empty($arSelectFields))
1495 foreach ($arSelectFields as
$code)
1496 $arSelect[
$code] = 1;
1499 $checkFields =
array();
1500 foreach (array_keys($arOrder) as
$code)
1503 $arSelect[
$code] = 1;
1504 if (
$code ==
'ID' ||
$code ==
'CATALOG_AVAILABLE')
1506 $checkFields[] =
$code;
1510 if (!isset($arSelect[
'PREVIEW_PICTURE']))
1511 $arSelect[
'PREVIEW_PICTURE'] = 1;
1512 if (!isset($arSelect[
'DETAIL_PICTURE']))
1513 $arSelect[
'DETAIL_PICTURE'] = 1;
1515 $arOfferIDs =
array();
1516 $arMeasureMap =
array();
1518 $arOffersPerElement =
array();
1519 $arOffersLink =
array();
1520 $extPrices =
array();
1521 $rsOffers = CIBlockElement::GetList($arOrder,
$arFilter,
false,
false, array_keys($arSelect));
1522 while($arOffer = $rsOffers->GetNext())
1524 $arOffer[
'ID'] = (int)$arOffer[
'ID'];
1525 $element_id = (int)$arOffer[$productPropertyValue];
1529 $arOffersPerElement[$element_id] ??= 0;
1530 $arOffersPerElement[$element_id]++;
1531 if($arOffersPerElement[$element_id] > $limit)
1537 $arOffer[
'SORT_HASH'] =
'ID';
1538 if (!empty($checkFields))
1541 foreach ($checkFields as
$code)
1542 $checkValues .= (isset($arOffer[
$code]) ? $arOffer[
$code] :
'').
'|';
1544 if ($checkValues !=
'')
1545 $arOffer[
'SORT_HASH'] = md5($checkValues);
1546 unset($checkValues);
1548 $arOffer[
"LINK_ELEMENT_ID"] = $element_id;
1549 $arOffer[
"PROPERTIES"] =
array();
1550 $arOffer[
"DISPLAY_PROPERTIES"] =
array();
1554 array(
'PREVIEW_PICTURE',
'DETAIL_PICTURE'),
1559 $arOffer[
'CHECK_QUANTITY'] = (
'Y' == $arOffer[
'CATALOG_QUANTITY_TRACE'] &&
'N' == $arOffer[
'CATALOG_CAN_BUY_ZERO']);
1561 $arOffer[
'CATALOG_MEASURE_NAME'] = $arDefaultMeasure[
'SYMBOL_RUS'];
1562 $arOffer[
'~CATALOG_MEASURE_NAME'] = $arDefaultMeasure[
'SYMBOL_RUS'];
1563 $arOffer[
"CATALOG_MEASURE_RATIO"] = 1;
1564 if (!isset($arOffer[
'CATALOG_MEASURE']))
1565 $arOffer[
'CATALOG_MEASURE'] = 0;
1566 $arOffer[
'CATALOG_MEASURE'] = (int)$arOffer[
'CATALOG_MEASURE'];
1567 if (0 > $arOffer[
'CATALOG_MEASURE'])
1568 $arOffer[
'CATALOG_MEASURE'] = 0;
1569 if (0 < $arOffer[
'CATALOG_MEASURE'])
1571 if (!isset($arMeasureMap[$arOffer[
'CATALOG_MEASURE']]))
1572 $arMeasureMap[$arOffer[
'CATALOG_MEASURE']] =
array();
1573 $arMeasureMap[$arOffer[
'CATALOG_MEASURE']][] = $intKey;
1576 $arOfferIDs[] = $arOffer[
'ID'];
1578 if (!isset($arOffersLink[$arOffer[
'ID']]))
1580 $arOffersLink[$arOffer[
'ID']] = &
$arResult[$intKey];
1584 if (!isset($extPrices[$arOffer[
'ID']]))
1586 $extPrices[$arOffer[
'ID']] =
array();
1588 $extPrices[$arOffer[
'ID']][] = &
$arResult[$intKey];
1593 if (!empty($arOfferIDs))
1597 array(
'@PRODUCT_ID' => $arOfferIDs),
1600 array(
'PRODUCT_ID',
'RATIO')
1602 while ($arRatio = $rsRatios->Fetch())
1604 $arRatio[
'PRODUCT_ID'] = (int)$arRatio[
'PRODUCT_ID'];
1605 if (isset($arOffersLink[$arRatio[
'PRODUCT_ID']]))
1607 $intRatio = (int)$arRatio[
'RATIO'];
1608 $dblRatio = (float)$arRatio[
'RATIO'];
1609 $mxRatio = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
1614 $arOffersLink[$arRatio[
'PRODUCT_ID']][
'CATALOG_MEASURE_RATIO'] = $mxRatio;
1618 if (!empty($propertyList))
1623 if (self::$needDiscountCache)
1628 foreach ($propertyList as $pid)
1630 if (!isset($arOffer[
"PROPERTIES"][$pid]))
1632 $prop = &$arOffer[
"PROPERTIES"][$pid];
1633 $boolArr = is_array($prop[
"VALUE"]);
1635 ($boolArr && !empty($prop[
"VALUE"])) ||
1636 (!$boolArr && (
string)$prop[
"VALUE"] !==
'')
1639 $arOffer[
"DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop);
1641 unset($boolArr, $prop);
1648 if (!empty($extPrices))
1650 foreach ($extPrices as $origID => $prices)
1652 foreach ($prices as $oneRow)
1654 $oneRow[
'PROPERTIES'] = $arOffersLink[$origID][
'PROPERTIES'];
1655 $oneRow[
'DISPLAY_PROPERTIES'] = $arOffersLink[$origID][
'DISPLAY_PROPERTIES'];
1656 $oneRow[
'CATALOG_MEASURE_RATIO'] = $arOffersLink[$origID][
'CATALOG_MEASURE_RATIO'];
1660 if (self::$needDiscountCache)
1668 if (!empty($pricesAllow))
1670 $USER_ID = (int)$USER_ID;
1671 $userGroups =
array(2);
1673 $userGroups = CUser::GetUserGroup($USER_ID);
1675 $userGroups =
$USER->GetUserGroupArray();
1680 unset($pricesAllow);
1684 $arOffer[
'CATALOG_QUANTITY'] = (
1685 0 < $arOffer[
'CATALOG_QUANTITY'] && is_float($arOffer[
'CATALOG_MEASURE_RATIO'])
1686 ? (float)$arOffer[
'CATALOG_QUANTITY']
1687 : (int)$arOffer[
'CATALOG_QUANTITY']
1689 $arOffer[
'MIN_PRICE'] =
false;
1690 $arOffer[
"PRICES"] =
CIBlockPriceTools::GetItemPrices($arOffersIBlock[
"OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
1691 if (!empty($arOffer[
"PRICES"]))
1693 foreach ($arOffer[
'PRICES'] as &$arOnePrice)
1695 if ($arOnePrice[
'MIN_PRICE'] ==
'Y')
1697 $arOffer[
'MIN_PRICE'] = $arOnePrice;
1705 if (isset($arOffer))
1708 if (!empty($arMeasureMap))
1710 $rsMeasures = CCatalogMeasure::getList(
1712 array(
'@ID' => array_keys($arMeasureMap)),
1715 array(
'ID',
'SYMBOL_RUS')
1717 while ($arMeasure = $rsMeasures->GetNext())
1719 $arMeasure[
'ID'] = (int)$arMeasure[
'ID'];
1720 if (isset($arMeasureMap[$arMeasure[
'ID']]) && !empty($arMeasureMap[$arMeasure[
'ID']]))
1722 foreach ($arMeasureMap[$arMeasure[
'ID']] as $intOneKey)
1724 $arResult[$intOneKey][
'CATALOG_MEASURE_NAME'] = $arMeasure[
'SYMBOL_RUS'];
1725 $arResult[$intOneKey][
'~CATALOG_MEASURE_NAME'] = $arMeasure[
'~SYMBOL_RUS'];
1745 if (self::$catalogIncluded ===
null)
1747 return (self::$catalogIncluded ?
array() : CCatalogMeasure::getDefaultMeasure(
true,
true));
1752 $replaceMinPrice = ($replaceMinPrice !==
false);
1753 if (isset($item[
'MIN_PRICE']) && !empty($item[
'MIN_PRICE']) && isset($item[
'CATALOG_MEASURE_RATIO']))
1755 if ($item[
'CATALOG_MEASURE_RATIO'] === 1)
1757 $item[
'RATIO_PRICE'] =
array(
1758 'VALUE' => $item[
'MIN_PRICE'][
'VALUE'],
1759 'DISCOUNT_VALUE' => $item[
'MIN_PRICE'][
'DISCOUNT_VALUE'],
1760 'PRINT_VALUE' => $item[
'MIN_PRICE'][
'PRINT_VALUE'],
1761 'PRINT_DISCOUNT_VALUE' => $item[
'MIN_PRICE'][
'PRINT_DISCOUNT_VALUE'],
1762 'DISCOUNT_DIFF' => $item[
'MIN_PRICE'][
'DISCOUNT_DIFF'],
1763 'PRINT_DISCOUNT_DIFF' => $item[
'MIN_PRICE'][
'PRINT_DISCOUNT_DIFF'],
1764 'DISCOUNT_DIFF_PERCENT' => $item[
'MIN_PRICE'][
'DISCOUNT_DIFF_PERCENT'],
1765 'CURRENCY' => $item[
'MIN_PRICE'][
'CURRENCY']
1770 $item[
'RATIO_PRICE'] =
array(
1771 'VALUE' => $item[
'MIN_PRICE'][
'VALUE']*$item[
'CATALOG_MEASURE_RATIO'],
1772 'DISCOUNT_VALUE' => $item[
'MIN_PRICE'][
'DISCOUNT_VALUE']*$item[
'CATALOG_MEASURE_RATIO'],
1773 'CURRENCY' => $item[
'MIN_PRICE'][
'CURRENCY']
1775 $item[
'RATIO_PRICE'][
'PRINT_VALUE'] = CCurrencyLang::CurrencyFormat(
1776 $item[
'RATIO_PRICE'][
'VALUE'],
1777 $item[
'RATIO_PRICE'][
'CURRENCY'],
1780 $item[
'RATIO_PRICE'][
'PRINT_DISCOUNT_VALUE'] = CCurrencyLang::CurrencyFormat(
1781 $item[
'RATIO_PRICE'][
'DISCOUNT_VALUE'],
1782 $item[
'RATIO_PRICE'][
'CURRENCY'],
1785 if ($item[
'MIN_PRICE'][
'VALUE'] == $item[
'MIN_PRICE'][
'DISCOUNT_VALUE'])
1787 $item[
'RATIO_PRICE'][
'DISCOUNT_DIFF'] = 0;
1788 $item[
'RATIO_PRICE'][
'DISCOUNT_DIFF_PERCENT'] = 0;
1789 $item[
'RATIO_PRICE'][
'PRINT_DISCOUNT_DIFF'] = CCurrencyLang::CurrencyFormat(0, $item[
'RATIO_PRICE'][
'CURRENCY'],
true);
1793 $item[
'RATIO_PRICE'][
'DISCOUNT_DIFF'] = $item[
'RATIO_PRICE'][
'VALUE'] - $item[
'RATIO_PRICE'][
'DISCOUNT_VALUE'];
1794 $item[
'RATIO_PRICE'][
'DISCOUNT_DIFF_PERCENT'] =
roundEx(100*$item[
'RATIO_PRICE'][
'DISCOUNT_DIFF']/$item[
'RATIO_PRICE'][
'VALUE'], 0);
1795 $item[
'RATIO_PRICE'][
'PRINT_DISCOUNT_DIFF'] = CCurrencyLang::CurrencyFormat(
1796 $item[
'RATIO_PRICE'][
'DISCOUNT_DIFF'],
1797 $item[
'RATIO_PRICE'][
'CURRENCY'],
1802 if ($replaceMinPrice)
1804 $item[
'MIN_PRICE'] = $item[
'RATIO_PRICE'];
1805 unset($item[
'RATIO_PRICE']);
1812 if (empty($property) || !is_array($property))
1816 if (empty($property[
'USER_TYPE_SETTINGS'][
'TABLE_NAME']))
1820 if (self::$highLoadInclude ===
null)
1824 if (!self::$highLoadInclude)
1829 $highBlock = HighloadBlockTable::getRow([
1831 '=TABLE_NAME' => $property[
'USER_TYPE_SETTINGS'][
'TABLE_NAME'],
1834 if ($highBlock ===
null)
1839 $entity = HighloadBlockTable::compileEntity($highBlock);
1840 $fieldsList =
$entity->getFields();
1841 if (empty($fieldsList))
1851 foreach ($requireFields as $fieldCode)
1853 if (!isset($fieldsList[$fieldCode]))
1860 $property[
'USER_TYPE_SETTINGS'][
'FIELDS_MAP'] = $fieldsList;
1861 $property[
'USER_TYPE_SETTINGS'][
'ENTITY'] =
$entity;
1869 if (isset($defaultFields[
'PICT']) && is_array($defaultFields[
'PICT']))
1871 if (!isset($defaultFields[
'PICT'][
'ID']))
1872 $defaultFields[
'PICT'][
'ID'] = 0;
1875 $requireFields =
array(
1882 if (empty($skuInfo))
1884 if (!is_array($skuInfo))
1886 $skuInfo = (int)$skuInfo;
1889 if (self::$catalogIncluded ===
null)
1891 if (!self::$catalogIncluded)
1893 $skuInfo = CCatalogSku::GetInfoByProductIBlock($skuInfo);
1894 if (empty($skuInfo))
1897 if (empty($propertiesCodes) || !is_array($propertiesCodes))
1904 'ID',
'IBLOCK_ID',
'CODE',
'NAME',
'SORT',
'LINK_IBLOCK_ID',
'PROPERTY_TYPE',
'USER_TYPE',
'USER_TYPE_SETTINGS'
1907 '=IBLOCK_ID' => $skuInfo[
'IBLOCK_ID'],
1908 '=PROPERTY_TYPE' =>
array(
1913 '=ACTIVE' =>
'Y',
'=MULTIPLE' =>
'N'
1916 'SORT' =>
'ASC',
'ID' =>
'ASC'
1919 while ($propInfo = $propertyIterator->fetch())
1921 $propInfo[
'ID'] = (int)$propInfo[
'ID'];
1922 if ($propInfo[
'ID'] == $skuInfo[
'SKU_PROPERTY_ID'])
1924 $propInfo[
'CODE'] = (string)$propInfo[
'CODE'];
1925 if ($propInfo[
'CODE'] ===
'')
1926 $propInfo[
'CODE'] = $propInfo[
'ID'];
1927 if (!in_array($propInfo[
'CODE'], $propertiesCodes))
1929 $propInfo[
'SORT'] = (int)$propInfo[
'SORT'];
1930 $propInfo[
'USER_TYPE'] = (string)$propInfo[
'USER_TYPE'];
1933 if (
'directory' != $propInfo[
'USER_TYPE'])
1935 $propInfo[
'USER_TYPE_SETTINGS'] = (string)$propInfo[
'USER_TYPE_SETTINGS'];
1936 if ($propInfo[
'USER_TYPE_SETTINGS'] ==
'')
1938 $propInfo[
'USER_TYPE_SETTINGS'] = unserialize($propInfo[
'USER_TYPE_SETTINGS'], [
'allowed_classes' =>
false]);
1939 if (!isset($propInfo[
'USER_TYPE_SETTINGS'][
'TABLE_NAME']) || empty($propInfo[
'USER_TYPE_SETTINGS'][
'TABLE_NAME']))
1941 if (self::$highLoadInclude ===
null)
1943 if (!self::$highLoadInclude)
1946 $highBlock = HighloadBlockTable::getList(
array(
1947 'filter' =>
array(
'=TABLE_NAME' => $propInfo[
'USER_TYPE_SETTINGS'][
'TABLE_NAME'])
1949 if (!isset($highBlock[
'ID']))
1952 $entity = HighloadBlockTable::compileEntity($highBlock);
1953 $fieldsList =
$entity->getFields();
1954 if (empty($fieldsList))
1958 foreach ($requireFields as $fieldCode)
1960 if (!isset($fieldsList[$fieldCode]) || empty($fieldsList[$fieldCode]))
1969 $propInfo[
'USER_TYPE_SETTINGS'][
'FIELDS_MAP'] = $fieldsList;
1970 $propInfo[
'USER_TYPE_SETTINGS'][
'ENTITY'] =
$entity;
1972 switch ($propInfo[
'PROPERTY_TYPE'])
1981 $showMode = (isset($fieldsList[
'UF_FILE']) ?
'PICT' :
'TEXT');
1985 'ID' => $propInfo[
'ID'],
1986 'CODE' => $propInfo[
'CODE'],
1987 'NAME' => $propInfo[
'NAME'],
1988 'SORT' => $propInfo[
'SORT'],
1989 'PROPERTY_TYPE' => $propInfo[
'PROPERTY_TYPE'],
1990 'USER_TYPE' => $propInfo[
'USER_TYPE'],
1991 'LINK_IBLOCK_ID' => $propInfo[
'LINK_IBLOCK_ID'],
1992 'USER_TYPE_SETTINGS' => $propInfo[
'USER_TYPE_SETTINGS'],
1993 'VALUES' =>
array(),
1994 'SHOW_MODE' => $showMode,
1995 'DEFAULT_VALUES' =>
array(
2000 if ($showMode ==
'PICT')
2002 if (isset($defaultFields[
'PICT']))
2003 $treeProp[
'DEFAULT_VALUES'][
'PICT'] = $defaultFields[
'PICT'];
2005 if (isset($defaultFields[
'NAME']))
2007 $treeProp[
'DEFAULT_VALUES'][
'NAME'] = $defaultFields[
'NAME'];
2009 $result[$treeProp[
'CODE']] = $treeProp;
2014 public static function getTreePropertyValues(&$propList, &$propNeedValues)
2017 if (!empty($propList) && is_array($propList))
2019 $useFilterValues = !empty($propNeedValues) && is_array($propNeedValues);
2020 foreach ($propList as $oneProperty)
2022 if (isset($oneProperty[
'DEFAULT_VALUES'][
'PICT']) && is_array($oneProperty[
'DEFAULT_VALUES'][
'PICT']))
2024 if (!isset($oneProperty[
'DEFAULT_VALUES'][
'PICT'][
'ID']))
2025 $oneProperty[
'DEFAULT_VALUES'][
'PICT'][
'ID'] = 0;
2028 $valuesExist =
false;
2029 $pictMode = (
'PICT' == $oneProperty[
'SHOW_MODE']);
2030 $needValuesExist = !empty($propNeedValues[$oneProperty[
'ID']]) && is_array($propNeedValues[$oneProperty[
'ID']]);
2031 if ($useFilterValues && !$needValuesExist)
2033 switch($oneProperty[
'PROPERTY_TYPE'])
2035 case Iblock\PropertyTable::TYPE_LIST:
2036 if ($needValuesExist)
2038 foreach (array_chunk($propNeedValues[$oneProperty[
'ID']], 500) as $pageIds)
2041 'select' =>
array(
'ID',
'VALUE',
'SORT'),
2042 'filter' =>
array(
'=PROPERTY_ID' => $oneProperty[
'ID'],
'@ID' => $pageIds),
2043 'order' =>
array(
'SORT' =>
'ASC',
'VALUE' =>
'ASC')
2047 $row[
'ID'] = (int)$row[
'ID'];
2048 $values[$row[
'ID']] =
array(
2050 'NAME' => $row[
'VALUE'],
2051 'SORT' => (
int)$row[
'SORT'],
2054 $valuesExist =
true;
2063 'select' =>
array(
'ID',
'VALUE',
'SORT'),
2064 'filter' =>
array(
'=PROPERTY_ID' => $oneProperty[
'ID']),
2065 'order' =>
array(
'SORT' =>
'ASC',
'VALUE' =>
'ASC')
2069 $row[
'ID'] = (int)$row[
'ID'];
2070 $values[$row[
'ID']] =
array(
2072 'NAME' => $row[
'VALUE'],
2073 'SORT' => (
int)$row[
'SORT'],
2076 $valuesExist =
true;
2082 'SORT' => PHP_INT_MAX,
2084 'NAME' => $oneProperty[
'DEFAULT_VALUES'][
'NAME'],
2085 'PICT' => $oneProperty[
'DEFAULT_VALUES'][
'PICT']
2088 case Iblock\PropertyTable::TYPE_ELEMENT:
2093 if ($needValuesExist)
2095 foreach (array_chunk($propNeedValues[$oneProperty[
'ID']], 500) as $pageIds)
2098 array(
'SORT' =>
'ASC',
'NAME' =>
'ASC'),
2099 array(
'ID' => $pageIds,
'IBLOCK_ID' => $oneProperty[
'LINK_IBLOCK_ID'],
'ACTIVE' =>
'Y'),
2108 $row[
'PICT'] =
false;
2109 if (!empty($row[
'PREVIEW_PICTURE']))
2112 if (!empty($previewPict))
2114 $row[
'PICT'] =
array(
2115 'ID' => (
int)$previewPict[
'ID'],
2116 'SRC' => $previewPict[
'SRC'],
2117 'WIDTH' => (
int)$previewPict[
'WIDTH'],
2118 'HEIGHT' => (
int)$previewPict[
'HEIGHT']
2122 if (empty($row[
'PICT']))
2123 $row[
'PICT'] = $oneProperty[
'DEFAULT_VALUES'][
'PICT'];
2125 $row[
'ID'] = (int)$row[
'ID'];
2126 $values[$row[
'ID']] =
array(
2128 'NAME' => $row[
'NAME'],
2129 'SORT' => (
int)$row[
'SORT'],
2130 'PICT' => ($pictMode ? $row[
'PICT'] :
false)
2132 $valuesExist =
true;
2141 array(
'SORT' =>
'ASC',
'NAME' =>
'ASC'),
2142 array(
'IBLOCK_ID' => $oneProperty[
'LINK_IBLOCK_ID'],
'ACTIVE' =>
'Y'),
2151 $row[
'PICT'] =
false;
2152 if (!empty($row[
'PREVIEW_PICTURE']))
2155 if (!empty($previewPict))
2157 $row[
'PICT'] =
array(
2158 'ID' => (
int)$previewPict[
'ID'],
2159 'SRC' => $previewPict[
'SRC'],
2160 'WIDTH' => (
int)$previewPict[
'WIDTH'],
2161 'HEIGHT' => (
int)$previewPict[
'HEIGHT']
2165 if (empty($row[
'PICT']))
2166 $row[
'PICT'] = $oneProperty[
'DEFAULT_VALUES'][
'PICT'];
2168 $row[
'ID'] = (int)$row[
'ID'];
2169 $values[$row[
'ID']] =
array(
2171 'NAME' => $row[
'NAME'],
2172 'SORT' => (
int)$row[
'SORT'],
2173 'PICT' => ($pictMode ? $row[
'PICT'] :
false)
2175 $valuesExist =
true;
2181 'SORT' => PHP_INT_MAX,
2183 'NAME' => $oneProperty[
'DEFAULT_VALUES'][
'NAME'],
2184 'PICT' => ($pictMode ? $oneProperty[
'DEFAULT_VALUES'][
'PICT'] :
false)
2187 case Iblock\PropertyTable::TYPE_STRING:
2188 if (self::$highLoadInclude ===
null)
2189 self::$highLoadInclude = Loader::includeModule(
'highloadblock');
2190 if (!self::$highLoadInclude)
2193 $sortExist = isset($oneProperty[
'USER_TYPE_SETTINGS'][
'FIELDS_MAP'][
'UF_SORT']);
2195 $directorySelect =
array(
'ID',
'UF_NAME',
'UF_XML_ID');
2196 $directoryOrder =
array();
2198 $directorySelect[] =
'UF_FILE';
2201 $directorySelect[] =
'UF_SORT';
2202 $directoryOrder[
'UF_SORT'] =
'ASC';
2204 $directoryOrder[
'UF_NAME'] =
'ASC';
2208 $entity = $oneProperty[
'USER_TYPE_SETTINGS'][
'ENTITY'];
2209 if (!(
$entity instanceof Main\Entity\Base))
2211 $entityDataClass =
$entity->getDataClass();
2212 $entityGetList =
array(
2213 'select' => $directorySelect,
2214 'order' => $directoryOrder
2217 if ($needValuesExist)
2219 foreach (array_chunk($propNeedValues[$oneProperty[
'ID']], 500) as $pageIds)
2221 $entityGetList[
'filter'] =
array(
'=UF_XML_ID' => $pageIds);
2222 $iterator = $entityDataClass::getList($entityGetList);
2225 $row[
'ID'] = (int)$row[
'ID'];
2226 $row[
'UF_SORT'] = ($sortExist ? (int)$row[
'UF_SORT'] : $sortValue);
2231 if (!empty($row[
'UF_FILE']))
2234 if (!empty($arFile))
2236 $row[
'PICT'] =
array(
2237 'ID' => (
int)$arFile[
'ID'],
2238 'SRC' => $arFile[
'SRC'],
2239 'WIDTH' => (
int)$arFile[
'WIDTH'],
2240 'HEIGHT' => (
int)$arFile[
'HEIGHT']
2244 if (empty($row[
'PICT']))
2245 $row[
'PICT'] = $oneProperty[
'DEFAULT_VALUES'][
'PICT'];
2247 $values[$row[
'ID']] =
array(
2249 'NAME' => $row[
'UF_NAME'],
2250 'SORT' => (
int)$row[
'UF_SORT'],
2251 'XML_ID' => $row[
'UF_XML_ID'],
2252 'PICT' => ($pictMode ? $row[
'PICT'] :
false)
2254 $valuesExist =
true;
2255 $xmlMap[$row[
'UF_XML_ID']] = $row[
'ID'];
2263 $iterator = $entityDataClass::getList($entityGetList);
2266 $row[
'ID'] = (int)$row[
'ID'];
2267 $row[
'UF_SORT'] = ($sortExist ? (int)$row[
'UF_SORT'] : $sortValue);
2272 if (!empty($row[
'UF_FILE']))
2275 if (!empty($arFile))
2277 $row[
'PICT'] =
array(
2278 'ID' => (
int)$arFile[
'ID'],
2279 'SRC' => $arFile[
'SRC'],
2280 'WIDTH' => (
int)$arFile[
'WIDTH'],
2281 'HEIGHT' => (
int)$arFile[
'HEIGHT']
2285 if (empty($row[
'PICT']))
2286 $row[
'PICT'] = $oneProperty[
'DEFAULT_VALUES'][
'PICT'];
2288 $values[$row[
'ID']] =
array(
2290 'NAME' => $row[
'UF_NAME'],
2291 'SORT' => (
int)$row[
'UF_SORT'],
2292 'XML_ID' => $row[
'UF_XML_ID'],
2293 'PICT' => ($pictMode ? $row[
'PICT'] :
false)
2295 $valuesExist =
true;
2296 $xmlMap[$row[
'UF_XML_ID']] = $row[
'ID'];
2302 'SORT' => PHP_INT_MAX,
2304 'NAME' => $oneProperty[
'DEFAULT_VALUES'][
'NAME'],
2306 'PICT' => ($pictMode ? $oneProperty[
'DEFAULT_VALUES'][
'PICT'] :
false)
2309 $oneProperty[
'XML_MAP'] = $xmlMap;
2314 $oneProperty[
'VALUES'] = $values;
2315 $oneProperty[
'VALUES_COUNT'] =
count($values);
2317 $result[$oneProperty[
'CODE']] = $oneProperty;
2321 unset($arFilterProp);
2326 $replaceMinPrice = ($replaceMinPrice ===
true);
2329 if (!empty($offers) && is_array($offers))
2332 foreach ($offers as $oneOffer)
2334 $oneOffer[
'ID'] = (int)$oneOffer[
'ID'];
2335 if (isset($doubles[$oneOffer[
'ID']]))
2337 if (!$oneOffer[
'CAN_BUY'])
2342 $oneOffer[
'MIN_PRICE'][
'CATALOG_MEASURE_RATIO'] = $oneOffer[
'CATALOG_MEASURE_RATIO'];
2343 $oneOffer[
'MIN_PRICE'][
'CATALOG_MEASURE'] = $oneOffer[
'CATALOG_MEASURE'];
2344 $oneOffer[
'MIN_PRICE'][
'CATALOG_MEASURE_NAME'] = $oneOffer[
'CATALOG_MEASURE_NAME'];
2345 $oneOffer[
'MIN_PRICE'][
'~CATALOG_MEASURE_NAME'] = $oneOffer[
'~CATALOG_MEASURE_NAME'];
2349 $minPrice = ($oneOffer[
'MIN_PRICE'][
'CURRENCY'] ==
$currency
2350 ? $oneOffer[
'MIN_PRICE'][
'DISCOUNT_VALUE']
2353 $result = $oneOffer[
'MIN_PRICE'];
2357 $comparePrice = ($oneOffer[
'MIN_PRICE'][
'CURRENCY'] ==
$currency
2358 ? $oneOffer[
'MIN_PRICE'][
'DISCOUNT_VALUE']
2361 if ($minPrice > $comparePrice)
2363 $minPrice = $comparePrice;
2364 $result = $oneOffer[
'MIN_PRICE'];
2367 $doubles[$oneOffer[
'ID']] =
true;
2375 $encode = ($encode ===
true);
2378 'SECOND_PICT' =>
false
2381 if (!empty($item) && is_array($item))
2383 if (!empty($item[
'PREVIEW_PICTURE']))
2385 if (!is_array($item[
'PREVIEW_PICTURE']))
2386 $item[
'PREVIEW_PICTURE'] = CFile::GetFileArray($item[
'PREVIEW_PICTURE']);
2387 if (isset($item[
'PREVIEW_PICTURE'][
'ID']))
2390 'ID' => (
int)$item[
'PREVIEW_PICTURE'][
'ID'],
2391 'SRC' =>
Iblock\
Component\Tools::getImageSrc($item[
'PREVIEW_PICTURE'], $encode),
2392 'WIDTH' => (
int)$item[
'PREVIEW_PICTURE'][
'WIDTH'],
2393 'HEIGHT' => (
int)$item[
'PREVIEW_PICTURE'][
'HEIGHT']
2397 if (!empty($item[
'DETAIL_PICTURE']))
2399 $keyPict = (empty(
$result[
'PICT']) ?
'PICT' :
'SECOND_PICT');
2400 if (!is_array($item[
'DETAIL_PICTURE']))
2401 $item[
'DETAIL_PICTURE'] = CFile::GetFileArray($item[
'DETAIL_PICTURE']);
2402 if (isset($item[
'DETAIL_PICTURE'][
'ID']))
2405 'ID' => (
int)$item[
'DETAIL_PICTURE'][
'ID'],
2406 'SRC' =>
Iblock\
Component\Tools::getImageSrc($item[
'DETAIL_PICTURE'], $encode),
2407 'WIDTH' => (
int)$item[
'DETAIL_PICTURE'][
'WIDTH'],
2408 'HEIGHT' => (
int)$item[
'DETAIL_PICTURE'][
'HEIGHT']
2412 if (empty(
$result[
'SECOND_PICT']))
2415 '' != $propertyCode &&
2416 isset($item[
'PROPERTIES'][$propertyCode]) &&
2417 'F' == $item[
'PROPERTIES'][$propertyCode][
'PROPERTY_TYPE']
2421 isset($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']) &&
2422 !empty($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE'])
2426 isset($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE'][
'ID']) ?
2427 array(0 => $item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']) :
2428 $item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']
2430 foreach ($fileValues as $oneFileValue)
2432 $keyPict = (empty(
$result[
'PICT']) ?
'PICT' :
'SECOND_PICT');
2434 'ID' => (
int)$oneFileValue[
'ID'],
2436 'WIDTH' => (
int)$oneFileValue[
'WIDTH'],
2437 'HEIGHT' => (
int)$oneFileValue[
'HEIGHT']
2439 if (
'SECOND_PICT' == $keyPict)
2442 if (isset($oneFileValue))
2443 unset($oneFileValue);
2447 $propValues = $item[
'PROPERTIES'][$propertyCode][
'VALUE'];
2448 if (!is_array($propValues))
2449 $propValues =
array($propValues);
2450 foreach ($propValues as $oneValue)
2452 $oneFileValue = CFile::GetFileArray($oneValue);
2453 if (isset($oneFileValue[
'ID']))
2455 $keyPict = (empty(
$result[
'PICT']) ?
'PICT' :
'SECOND_PICT');
2457 'ID' => (
int)$oneFileValue[
'ID'],
2459 'WIDTH' => (
int)$oneFileValue[
'WIDTH'],
2460 'HEIGHT' => (
int)$oneFileValue[
'HEIGHT']
2462 if (
'SECOND_PICT' == $keyPict)
2466 if (isset($oneValue))
2475 public static function getSliderForItem(&$item, $propertyCode, $addDetailToSlider, $encode =
true)
2477 $encode = ($encode ===
true);
2480 if (!empty($item) && is_array($item))
2483 '' != $propertyCode &&
2484 isset($item[
'PROPERTIES'][$propertyCode]) &&
2485 'F' == $item[
'PROPERTIES'][$propertyCode][
'PROPERTY_TYPE']
2488 if (
'MORE_PHOTO' == $propertyCode && isset($item[
'MORE_PHOTO']) && !empty($item[
'MORE_PHOTO']))
2490 foreach ($item[
'MORE_PHOTO'] as $onePhoto)
2493 'ID' => (
int)$onePhoto[
'ID'],
2495 'WIDTH' => (
int)$onePhoto[
'WIDTH'],
2496 'HEIGHT' => (
int)$onePhoto[
'HEIGHT']
2504 isset($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']) &&
2505 !empty($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE'])
2509 isset($item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE'][
'ID']) ?
2510 array(0 => $item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']) :
2511 $item[
'DISPLAY_PROPERTIES'][$propertyCode][
'FILE_VALUE']
2513 foreach ($fileValues as $oneFileValue)
2516 'ID' => (
int)$oneFileValue[
'ID'],
2518 'WIDTH' => (
int)$oneFileValue[
'WIDTH'],
2519 'HEIGHT' => (
int)$oneFileValue[
'HEIGHT']
2522 if (isset($oneFileValue))
2523 unset($oneFileValue);
2527 $propValues = $item[
'PROPERTIES'][$propertyCode][
'VALUE'];
2528 if (!is_array($propValues))
2529 $propValues =
array($propValues);
2531 foreach ($propValues as $oneValue)
2533 $oneFileValue = CFile::GetFileArray($oneValue);
2534 if (isset($oneFileValue[
'ID']))
2537 'ID' => (
int)$oneFileValue[
'ID'],
2539 'WIDTH' => (
int)$oneFileValue[
'WIDTH'],
2540 'HEIGHT' => (
int)$oneFileValue[
'HEIGHT']
2544 if (isset($oneValue))
2549 if ($addDetailToSlider || empty(
$result))
2551 if (!empty($item[
'DETAIL_PICTURE']))
2553 if (!is_array($item[
'DETAIL_PICTURE']))
2554 $item[
'DETAIL_PICTURE'] = CFile::GetFileArray($item[
'DETAIL_PICTURE']);
2555 if (isset($item[
'DETAIL_PICTURE'][
'ID']))
2560 'ID' => (
int)$item[
'DETAIL_PICTURE'][
'ID'],
2561 'SRC' =>
Iblock\
Component\Tools::getImageSrc($item[
'DETAIL_PICTURE'], $encode),
2562 'WIDTH' => (
int)$item[
'DETAIL_PICTURE'][
'WIDTH'],
2563 'HEIGHT' => (
int)$item[
'DETAIL_PICTURE'][
'HEIGHT']
2575 static $propertyEnum =
array();
2577 if (!empty($item) && is_array($item))
2579 $item[
'LABEL'] =
false;
2580 $item[
'LABEL_VALUE'] =
'';
2581 $item[
'LABEL_ARRAY_VALUE'] =
array();
2583 if (!is_array($propertyCode))
2585 $propertyCode =
array($propertyCode);
2588 if (!empty($propertyCode))
2590 foreach ($propertyCode as $index =>
$code)
2594 if (
$code !==
'' && isset($item[
'PROPERTIES'][
$code]))
2596 $prop = $item[
'PROPERTIES'][
$code];
2598 if (!empty($prop[
'VALUE']))
2602 if ($prop[
'PROPERTY_TYPE'] ==
'L' && $prop[
'MULTIPLE'] ==
'N')
2604 if (!isset($propertyEnum[$prop[
'ID']]))
2609 array(
'PROPERTY_ID' => $prop[
'ID'])
2611 while ($enum = $enumList->Fetch())
2616 $propertyEnum[$prop[
'ID']] =
$count;
2617 unset($enum, $enumList,
$count);
2620 $useName = ($propertyEnum[$prop[
'ID']] == 1);
2625 $item[
'LABEL_ARRAY_VALUE'][
$code] = $prop[
'NAME'];
2629 $item[
'LABEL_ARRAY_VALUE'][
$code] = (is_array($prop[
'VALUE'])
2630 ? implode(
' / ', $prop[
'VALUE'])
2636 $item[
'LABEL'] =
true;
2638 if ($item[
'LABEL_VALUE'] ===
'')
2640 $item[
'LABEL_VALUE'] = $item[
'LABEL_ARRAY_VALUE'][
$code];
2643 if (isset($item[
'DISPLAY_PROPERTIES'][
$code]))
2645 unset($item[
'DISPLAY_PROPERTIES'][
$code]);
2657 if (!empty($properties) && is_array($properties) && !empty($clearCodes))
2659 if (!is_array($clearCodes))
2660 $clearCodes =
array($clearCodes);
2662 foreach ($clearCodes as $oneCode)
2664 if (isset($properties[$oneCode]))
2665 unset($properties[$oneCode]);
2669 return !empty($properties);
2674 if (empty($priceList) || !is_array($priceList))
2677 foreach ($priceList as $price)
2679 if (isset($price[
'MIN_PRICE']) && $price[
'MIN_PRICE'] ==
'Y')
2691 return (self::$calculationDiscounts >= 0);
2696 self::$calculationDiscounts++;
2701 self::$calculationDiscounts--;
const CATALOG_VALUE_EPSILON
static preloadPriceData(array $productIds, array $catalogGroups)
static preloadProductDataToExtendOrder(array $productIds, array $userGroups)
static setProductPropertiesCache($productId, $props)
static get($moduleId, $name, $default="", $siteId=false)
static includeModule($moduleName)
static getList(array $parameters=array())
static normalizeArrayValuesByInt(&$map, $sorted=true)
static SetDiscountProductCache($arItem, $arParams=array())
static SetAllDiscountFilterCache($arDiscountCache, $boolNeedClear=true)
static GetDiscountFilterCacheKey($arCatalogGroups, $arUserGroups, $boolNeedClear=true)
static SetProductSectionsCache($arItemIDs)
static SetProductPropertiesCache($intProductID, $arProps)
static GetDiscountResultCacheKey($arDiscountIDs, $strSiteID, $strRenewal, $boolNeedClear=true)
static SetAllDiscountResultCache($arDiscountResultCache)
static GetRestrictions($arParams, $boolKeys=true, $boolRevert=true)
static GetGroupsPerms($arUserGroups=array(), $arCatalogGroupsFilter=array())
static CountPriceWithDiscount($price, $currency, $discounts)
static ConvertCurrency($valSum, $curFrom, $curTo, $valDate="")
static getList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetFileArray($fileId, $uploadDir=false)
static GetList($arOrder=array("SORT"=>"ASC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetList($arOrder=array("SORT"=>"ASC", "VALUE"=>"ASC"), $arFilter=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
CheckSerializedData($str, $max_depth=200)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"