17 private $groupByIblock = array();
18 private $columnsList =
null;
19 private $parentsIds = array();
20 private $measuresIds =
null;
21 private $siteId =
null;
22 private $storesCount =
null;
24 private $provider =
null;
25 private $productsIds = array();
28 private $iblockData =
null;
29 private $catalogData =
null;
31 private $resultData = array();
33 private $useSliderCard =
null;
44 public static function getData(array $productsIds, $siteId, array $columnsList = array(), $tmpId =
"")
46 if(empty($productsIds))
49 if(!\
Bitrix\Main\Loader::includeModule(
'iblock'))
52 if(!\
Bitrix\Main\Loader::includeModule(
'catalog'))
55 $product =
new self($productsIds, $siteId, $columnsList, $tmpId);
56 $product->fillIblockData();
58 if(count($product->resultData) <= 0)
61 $product->fillCatalogData();
62 $product->completeResultData();
63 $result = $product->getResultData();
76 public static function getProviderData(array $productsData, $siteId, $userId =
null, array &$errors = array())
78 if(empty($productsData))
88 $registry = Sale\Registry::getInstance(
Sale\Registry::REGISTRY_TYPE_ORDER);
90 $orderClass = $registry->getOrderClassName();
92 $order = $orderClass::create($siteId);
94 if(intval($userId) > 0)
96 $order->setFieldNoDemand(
"USER_ID", intval($userId));
97 $context[
'USER_ID'] = $userId;
101 $basketClass = $registry->getBasketClassName();
102 $basket = $basketClass::create($siteId);
103 $order->setBasket($basket);
105 if(intval($userId) > 0)
107 $fUserId = Fuser::getIdByUserId(intval($userId));
108 $basket->setFUserId($fUserId);
111 foreach($productsData as $productFields)
113 if (isset($productFields[
'OFFER_ID']))
115 $productFields[
'PRODUCT_ID'] = $productFields[
'OFFER_ID'];
118 $r = Catalog\Product\Basket::addProductToBasket($basket, $productFields, $context);
119 if (!$r->isSuccess())
121 $errors = $r->getErrorMessages();
126 return Provider::getProductData($basket, array(
"PRICE",
"AVAILABLE_QUANTITY"));
129 private function __construct(array $productsIds, $siteId, array $columnsList = array(), $tmpId =
"")
131 $this->columnsList = $columnsList;
132 if (!in_array(
'PROPERTY_MORE_PHOTO', $columnsList,
true))
134 $this->columnsList[] =
'PROPERTY_MORE_PHOTO';
136 $this->productsIds = $productsIds;
137 $this->siteId = $siteId;
138 $this->tmpId = $tmpId;
140 $this->provider = \CSaleBasket::GetProductProvider(
142 "MODULE" =>
'catalog',
143 "PRODUCT_PROVIDER_CLASS" =>
'CCatalogProductProvider'
147 $this->useSliderCard = Catalog\Config\State::isProductCardSliderEnabled();
150 private function getResultData()
152 if($this->resultData ===
null)
153 throw new ArgumentNullException(
'this->resultData must be set earlier!');
155 return $this->resultData;
158 private function fillCatalogData()
160 $this->catalogData = [];
161 $this->measuresIds = [];
163 if (empty($this->iblockData))
170 $res = Catalog\ProductTable::getList([
173 'AVAILABLE',
'QUANTITY',
'QUANTITY_TRACE',
'CAN_BUY_ZERO',
174 'WEIGHT',
'WIDTH',
'LENGTH',
'HEIGHT',
175 'MEASURE',
'BARCODE_MULTI',
'VAT_ID'
177 'filter' => [
'@ID' => array_keys($this->iblockData)]
179 while ($row = $res->fetch())
181 $this->catalogData[$row[
'ID']] = $row;
182 $this->measuresIds[] = $row[
'MEASURE'];
184 $type = (int)$row[
'TYPE'];
187 $setIds[] = $row[
'ID'];
190 if (isset($this->resultData[$row[
'ID']]))
192 $this->resultData[$row[
'ID']][
'TYPE'] = Sale\Internals\Catalog\ProductTypeMapper::getType($type);
193 $this->resultData[$row[
'ID']][
'DIMENSIONS'] = serialize(
195 "WIDTH" => $row[
"WIDTH"],
196 "HEIGHT" => $row[
"HEIGHT"],
197 "LENGTH" => $row[
"LENGTH"]
201 $this->resultData[$row[
'ID']][
'AVAILABLE'] = (float)$row[
"QUANTITY"];
202 $this->resultData[$row[
'ID']][
'WEIGHT'] = $row[
"WEIGHT"];
203 $this->resultData[$row[
'ID']][
'BARCODE_MULTI'] = $row[
"BARCODE_MULTI"];
204 $this->resultData[$row[
'ID']][
"SET_ITEMS"] = [];
205 $this->resultData[$row[
'ID']][
"IS_SET_ITEM"] =
"N";
206 $this->resultData[$row[
'ID']][
"VAT_ID"] = $row[
"VAT_ID"];
207 $this->resultData[$row[
'ID']][
"IS_SET_PARENT"] =
"N";
213 $this->fillSetInfo($setIds);
217 private function fillSetInfo($setIds)
222 if(!method_exists($this->provider,
'GetSetItems'))
225 $provider = $this->provider;
226 $childrenParent = array();
230 if ($this->tmpId ==
"")
231 $this->tmpId = randString(7);
233 foreach($setIds as $id)
235 if ($this->catalogData[$id][
"TYPE"] != \CCatalogProduct::TYPE_SET)
238 $arSets = $provider::GetSetItems($id, \CSaleBasket::TYPE_SET);
243 foreach ($arSets as $arSetData)
245 foreach ($arSetData[
"ITEMS"] as $setItem)
247 $arSetItemParams = array();
248 $arSetItemParams[
"PARENT_OFFER_ID"] = $id;
249 $arSetItemParams[
"OFFER_ID"] = $setItem[
"PRODUCT_ID"];
250 $arSetItemParams[
"NAME"] = $setItem[
"NAME"];
251 $arSetItemParams[
"MODULE"] = $setItem[
"MODULE"];
252 $arSetItemParams[
"PRODUCT_PROVIDER_CLASS"] = $setItem[
"PRODUCT_PROVIDER_CLASS"];
253 $arSetItemParams[
"BARCODE_MULTI"] = $setItem[
"BARCODE_MULTI"];
254 $arSetItemParams[
"PRODUCT_TYPE"] = $setItem[
"TYPE"];
255 $arSetItemParams[
"WEIGHT"] = $setItem[
"WEIGHT"];
256 $arSetItemParams[
"SET_ITEMS"] =
"";
257 $arSetItemParams[
"OLD_PARENT_ID"] = $id.
"_tmp".$this->tmpId;
258 $arSetItemParams[
"IS_SET_ITEM"] =
"Y";
259 $arSetItemParams[
"IS_SET_PARENT"] =
"N";
260 $arSetItemParams[
"PROVIDER_DATA"] = serialize($setItem);
261 $items[$id][$setItem[
"PRODUCT_ID"]] = $arSetItemParams;
263 if(!in_array($setItem[
"PRODUCT_ID"], $itemsIds))
264 $itemsIds[] = $setItem[
"PRODUCT_ID"];
266 if(!is_array($childrenParent[$setItem[
"PRODUCT_ID"]]))
267 $childrenParent[$setItem[
"PRODUCT_ID"]] = array();
269 $childrenParent[$setItem[
"PRODUCT_ID"]][] = $id;
273 $tmpData = self::getData($itemsIds, $this->siteId, $this->columnsList, $this->tmpId);
275 foreach($childrenParent as $childId => $childData)
277 if(!is_array($childData))
280 if(empty($tmpData[$childId]))
283 foreach($childData as $productId)
285 if(empty($items[$productId][$childId]))
288 foreach($this->resultData[$productId][
'SET_ITEMS'] as $set)
289 if($set[
'OFFER_ID'] == $childId)
292 $this->resultData[
$productId][
'SET_ITEMS'][] = array_merge($tmpData[$childId], $items[$productId][$childId]);
293 $this->resultData[
$productId][
"IS_SET_PARENT"] = empty($this->resultData[$productId][
"SET_ITEMS"]) ?
'N' :
'Y';
294 $this->resultData[
$productId][
"OLD_PARENT_ID"] = empty($this->resultData[$productId][
"SET_ITEMS"]) ?
'' :
$productId.
"_tmp".$this->tmpId;
295 $this->resultData[
$productId][
"PRODUCT_TYPE"] = empty($this->resultData[$productId][
"SET_ITEMS"]) ?
"" : \CSaleBasket::TYPE_SET;
301 private function fillIblockData()
303 $select = array(
"ID",
"NAME",
"IBLOCK_ID",
"IBLOCK_SECTION_ID",
"DETAIL_PICTURE",
"PREVIEW_PICTURE",
"XML_ID",
"IBLOCK_EXTERNAL_ID");
304 $blockedFields = array(
309 foreach ($this->columnsList as $field)
311 if (isset($blockedFields[$field]))
316 if (!empty($this->productsIds))
318 $parentList = \CCatalogSku::getProductList($this->productsIds);
319 if (!is_array($parentList))
320 $parentList = array();
321 $simpleProducts = array();
322 foreach ($this->productsIds as $id)
324 if (isset($parentList[$id]))
326 $info = $parentList[$id];
328 $this->resultData[$id] = array(
329 "PRODUCT_ID" => $info[
"ID"],
330 "IBLOCK_ID" => $info[
"IBLOCK_ID"],
331 "OFFERS_IBLOCK_ID" => $info[
"OFFER_IBLOCK_ID"]
333 $this->parentsIds[] = $info[
"ID"];
335 if(!isset($this->groupByIblock[$info[
'OFFER_IBLOCK_ID']]))
336 $this->groupByIblock[$info[
'OFFER_IBLOCK_ID']] = array();
338 $this->groupByIblock[$info[
'OFFER_IBLOCK_ID']][] = $id;
340 if(!isset($this->groupByIblock[$info[
'IBLOCK_ID']]))
341 $this->groupByIblock[$info[
'IBLOCK_ID']] = array();
343 $this->groupByIblock[$info[
'IBLOCK_ID']][] = $info[
"ID"];
349 $simpleProducts[$id] = $id;
355 if (!empty($simpleProducts))
357 $simpleIblock = \CIBlockElement::GetIBlockByIDList($simpleProducts);
358 foreach ($simpleIblock as $id => $iblockId)
360 $this->resultData[$id] = array(
362 "IBLOCK_ID" => $iblockId,
363 "OFFERS_IBLOCK_ID" => 0
366 if(!isset($this->groupByIblock[$iblockId]))
367 $this->groupByIblock[$iblockId] = array();
369 $this->groupByIblock[$iblockId][] = $id;
371 unset($id, $iblockId, $simpleIblock);
373 unset($simpleProducts);
376 $this->iblockData = array();
377 $ppData = getProductProps(array_merge($this->productsIds, $this->parentsIds), $select);
379 foreach($ppData as $id => $fields)
381 if(empty($ppData[$id]))
384 foreach($fields as $k => $v)
385 if(mb_substr($k, 0, 1) ==
'~')
386 $fields[mb_substr($k, 1)] = $v;
388 $this->iblockData[$id] = $ppData[$id];
389 $this->iblockData[$id][
"PRODUCT_PROPS_VALUES"] = $this->createProductPropsValues($id);
391 if(!in_array($id, $this->productsIds))
394 $this->resultData[$id] = array_merge(
395 $this->resultData[$id],
397 $this->iblockData[$id],
402 $this->resultData[$id][
"OFFER_ID"] = $id;
403 $this->resultData[$id][
"NAME"] = $fields[
"NAME"];
404 $this->resultData[$id][
"PRODUCT_XML_ID"] = $fields[
"XML_ID"];
405 $this->resultData[$id][
"CATALOG_XML_ID"] = $fields[
"~IBLOCK_EXTERNAL_ID"];
406 $this->resultData[$id][
"PRODUCT_PROPS_VALUES"] = $this->iblockData[$id][
"PRODUCT_PROPS_VALUES"];
407 $this->resultData[$id][
'EDIT_PAGE_URL'] = $this->createEditPageUrl($fields);
410 $notFound = array_diff($this->productsIds, array_keys($this->iblockData));
412 if(!empty($notFound))
414 foreach($notFound as $id)
416 unset($this->resultData[$id]);
430 private static function isOffer($productData)
432 return intval($productData[
'PRODUCT_ID']) != intval($productData[
'OFFER_ID']);
435 private function completeResultData()
437 if(empty($this->resultData))
440 foreach($this->resultData as $productId => $productData)
442 $this->resultData[
$productId][
'PROPERTIES'] = array();
443 $this->resultData[
$productId][
'PICTURE_URL'] = $this->createImageUrl($productId);
444 $this->resultData[
$productId][
'MODULE'] =
"catalog";
445 $this->resultData[
$productId][
"PRODUCT_PROVIDER_CLASS"] =
'\Bitrix\Catalog\Product\CatalogProvider';
446 $this->resultData[
$productId][
"STORES"] = $this->getStoresData($productId);
448 if($this->isOffer($productData) && !empty($this->iblockData[$productData[
'PRODUCT_ID']]))
450 $parentData = $this->iblockData[$productData[
'PRODUCT_ID']];
452 if(is_array($parentData[
'PRODUCT_PROPS_VALUES']))
454 foreach($parentData[
'PRODUCT_PROPS_VALUES'] as $fieldId => $fieldValue)
456 if(!isset($productData[
'PRODUCT_PROPS_VALUES'][$fieldId])
457 || (isset($productData[
'PRODUCT_PROPS_VALUES'][$fieldId]) && is_null($productData[
'PRODUCT_PROPS_VALUES'][$fieldId]))
460 $this->resultData[
$productId][
"PRODUCT_PROPS_VALUES"][$fieldId] = $fieldValue;
465 if(mb_strpos($this->iblockData[$productId][
"XML_ID"],
'#') ===
false)
467 $parentXmlId = strval($parentData[
'XML_ID']);
468 $this->resultData[
$productId][
'PRODUCT_XML_ID'] = $parentXmlId.
'#'.$this->iblockData[
$productId][
'XML_ID'];
472 if(is_array($this->resultData[$productId][
'PRODUCT_PROPS_VALUES']))
474 foreach($this->resultData[$productId][
'PRODUCT_PROPS_VALUES'] as $fieldId => $fieldValue)
476 if(is_null($fieldValue))
478 $this->resultData[
$productId][
'PRODUCT_PROPS_VALUES'][$fieldId] =
' ';
484 $this->fillPropsData();
485 $this->fillMeasures();
486 $this->fillMeasuresRatio();
489 private function fillPropsData()
491 if(empty($this->resultData))
494 foreach($this->groupByIblock as $iblockId => $elIds)
497 foreach ($elIds as $oneId)
499 if (isset($this->resultData[$oneId]))
507 $basketProperties = Catalog\Product\PropertyCatalogFeature::getBasketPropertyCodes($iblockId);
508 if (empty($basketProperties))
510 \CIBlockElement::GetPropertyValuesArray(
515 'IBLOCK_ID' => $iblockId
518 'ID' => $basketProperties
521 'PROPERTY_FIELDS' => array(
522 'ID',
'IBLOCK_ID',
'NAME',
'CODE',
'PROPERTY_TYPE',
523 'MULTIPLE',
'LINK_IBLOCK_ID',
524 'USER_TYPE',
'USER_TYPE_SETTINGS',
532 foreach($this->resultData as $elId => $elData)
534 if(isset($elData[
'PROPERTIES']))
536 $props = $this->formatProps($elData[
'PROPERTIES']);
537 unset($this->resultData[$elId][
'PROPERTIES']);
539 if($elData[
"CATALOG_XML_ID"] <>
'')
543 "NAME" =>
"Catalog XML_ID",
544 "CODE" =>
"CATALOG.XML_ID",
545 "VALUE" => $elData[
'CATALOG_XML_ID']
549 if($elData[
"PRODUCT_XML_ID"] <>
'')
553 "NAME" =>
"Product XML_ID",
554 "CODE" =>
"PRODUCT.XML_ID",
555 "VALUE" => $elData[
"PRODUCT_XML_ID"]
562 $this->resultData[$elId][
'PROPS'] = $props;
568 private static function formatProps(array $properties)
570 if(empty($properties))
575 foreach ($properties as $prop)
578 (isset($prop[
'XML_ID']) && $prop[
'XML_ID'] ===
'CML2_LINK')
579 || $prop[
'PROPERTY_TYPE'] ==
'F'
585 if (is_array($prop[
"VALUE"]) && empty($prop[
"VALUE"]))
590 if (!is_array($prop[
"VALUE"]) && $prop[
"VALUE"] ==
'')
595 $displayProperty = \CIBlockFormatProperties::GetDisplayValue(array(), $prop,
'');
599 if (
'E' == $prop[
'PROPERTY_TYPE'])
601 if (!empty($displayProperty[
'LINK_ELEMENT_VALUE']))
605 foreach ($displayProperty[
'LINK_ELEMENT_VALUE'] as $arTempo)
606 $mxValues[] = $arTempo[
'NAME'].
' ['.$arTempo[
'ID'].
']';
609 elseif (
'G' == $prop[
'PROPERTY_TYPE'])
611 if (!empty($displayProperty[
'LINK_SECTION_VALUE']))
615 foreach ($displayProperty[
'LINK_SECTION_VALUE'] as $arTempo)
616 $mxValues[] = $arTempo[
'NAME'].
' ['.$arTempo[
'ID'].
']';
619 if (empty($mxValues))
621 $mxValues = $displayProperty[
"DISPLAY_VALUE"];
626 'CODE' => htmlspecialcharsback($prop[
'CODE']),
627 'NAME' => htmlspecialcharsback($prop[
"NAME"]),
628 'VALUE' => htmlspecialcharsback(strip_tags(is_array($mxValues) ? implode(
"/ ", $mxValues) : $mxValues))
635 private function createProductPropsValues($productId)
637 if(intval($productId) <= 0)
643 foreach ($fields as $fieldId => $fieldValue)
645 if (strncmp($fieldId,
'PROPERTY_', 9) == 0 && mb_substr($fieldId, -6) ==
"_VALUE")
647 $propertyInfo = $this->getPropertyInfo(str_replace(
"_VALUE",
"", $fieldId));
648 $code = $propertyInfo[
'CODE'] <>
'' ? $propertyInfo[
'CODE'] : $propertyInfo[
'ID'];
649 $keyResult =
'PROPERTY_'.$code.
'_VALUE';
650 $result[$keyResult] = self::getIblockPropInfo($fieldValue, $propertyInfo, array(
"WIDTH" => 90,
"HEIGHT" => 90));
658 private function preparePropertyInfo()
663 foreach($this->columnsList as $column)
665 if(strncmp($column,
'PROPERTY_', 9) != 0)
668 $propertyCode = mb_substr($column, 9);
670 if ($propertyCode ==
'')
673 $codes[] = $propertyCode;
676 $dbRes = PropertyTable::getList(array(
684 while($propData = $dbRes->fetch())
686 $code = $propData[
'CODE'] <>
'' ? $propData[
'CODE'] : $propData[
'ID'];
687 $result[
'PROPERTY_'.mb_strtoupper($code)] = $propData;
693 private function getPropertyInfo($fieldId)
695 static $propsInfo =
null;
697 if($propsInfo ===
null)
698 $propsInfo = $this->preparePropertyInfo();
700 return isset($propsInfo[$fieldId]) ? $propsInfo[$fieldId] : array();
703 private function createImageUrl($productId)
707 $imgCode = $this->getImageId($this->iblockData[$productId]);
709 if ($imgCode == 0 && $this->isOffer($this->resultData[$productId]))
711 if(!empty($this->iblockData[$this->resultData[$productId][
'PRODUCT_ID']]))
713 $imgCode = $this->getImageId($this->iblockData[$this->resultData[$productId][
'PRODUCT_ID']]);
719 $arFile = \CFile::GetFileArray($imgCode);
720 $arImgProduct = \CFile::ResizeImageGet($arFile, array(
'width'=>80,
'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL,
false,
false);
722 if (is_array($arImgProduct))
723 $imgUrl = $arImgProduct[
"src"];
729 private function getImageId(array $product): int
732 if (isset($product[
'PREVIEW_PICTURE']) && (
int)$product[
'PREVIEW_PICTURE'] > 0)
734 $fieldImage = (int)$product[
'PREVIEW_PICTURE'];
736 elseif (isset($product[
'DETAIL_PICTURE']) && (
int)$product[
'DETAIL_PICTURE'] > 0)
738 $fieldImage = (int)$product[
'DETAIL_PICTURE'];
742 if (isset($product[
'PROPERTY_MORE_PHOTO_VALUE']))
744 if (is_array($product[
'PROPERTY_MORE_PHOTO_VALUE']))
746 $propertyImage = (int)reset($product[
'PROPERTY_MORE_PHOTO_VALUE']);
748 elseif ((
int)$product[
'PROPERTY_MORE_PHOTO_VALUE'] > 0)
750 $propertyImage = (int)$product[
'PROPERTY_MORE_PHOTO_VALUE'];
754 if ($this->useSliderCard)
756 $result = ($propertyImage > 0 ? $propertyImage : $fieldImage);
760 $result = ($fieldImage > 0 ? $fieldImage : $propertyImage);
762 unset($propertyImage, $fieldImage);
767 private static function createEditPageUrl(array $productData)
770 if(intval($productData[
'IBLOCK_ID']) <= 0 || intval($productData[
'ID']) <= 0)
773 $result = \CIBlock::GetAdminElementEditLink(
774 intval($productData[
'IBLOCK_ID']),
775 intval($productData[
'ID']),
777 "find_section_section" => (intval($productData[
'IBLOCK_SECTION_ID']) > 0 ? intval($productData[
'IBLOCK_SECTION_ID']) : null),
784 private function fillMeasures()
787 $defaultMeasure = \CCatalogMeasure::getDefaultMeasure(
true,
true);
788 $defaultMeasureText = ($defaultMeasure[
"SYMBOL_RUS"] !=
'' ? $defaultMeasure[
"SYMBOL_RUS"] : $defaultMeasure[
"SYMBOL_INTL"]);
789 $defaultMeasureCode = 0;
790 $settedIds = array();
792 $dbRes = \CCatalogMeasure::GetList(
794 array(
"ID" => $this->measuresIds),
797 array(
"ID",
"CODE",
"SYMBOL_RUS",
"SYMBOL_INTL")
800 while ($measure = $dbRes->Fetch())
801 $measures[$measure[
'ID']] = $measure;
803 foreach($this->catalogData as $productId => $productFields)
805 if(!isset($this->resultData[$productId]))
808 $this->resultData[
$productId][
"MEASURE_TEXT"] = $defaultMeasureText;
809 $this->resultData[
$productId][
"MEASURE_CODE"] = $defaultMeasureCode;
811 if (empty($measures[$productFields[
'MEASURE']]) || !is_array($measures[$productFields[
'MEASURE']]))
814 $measure = $measures[$productFields[
'MEASURE']];
816 $this->resultData[
$productId][
"MEASURE_TEXT"] = ($measure[
"SYMBOL_RUS"] !=
'' ? $measure[
"SYMBOL_RUS"] : $measure[
"SYMBOL_INTL"]);
817 $this->resultData[
$productId][
"MEASURE_CODE"] = $measure[
"CODE"] !=
'' ? $measure[
"CODE"] : $defaultMeasureText;
822 $needToSet = array_diff_key($this->resultData, array_flip($settedIds));
824 foreach($needToSet as $productId => $fields)
826 if(!isset($fields[
'MEASURE_CODE']))
827 $this->resultData[
$productId][
'MEASURE_CODE'] = $defaultMeasureCode;
829 if(!empty($fields[
'MEASURE_TEXT']))
830 $this->resultData[
$productId][
"MEASURE_TEXT"] = $defaultMeasureText;
834 private function fillMeasuresRatio()
836 $dbRes = \Bitrix\Catalog\MeasureRatioTable::getList(array(
837 'select' => array(
'*'),
838 'filter' => array(
"@PRODUCT_ID" => array_keys($this->resultData),
'=IS_DEFAULT' =>
'Y')
841 while($ratio = $dbRes->fetch())
843 if(!isset($this->resultData[$ratio[
'PRODUCT_ID']]))
846 $this->resultData[$ratio[
'PRODUCT_ID']][
'MEASURE_RATIO'] = $ratio[
"RATIO"];
849 foreach($this->resultData as $productId => $fields)
851 if(!isset($fields[
'MEASURE_RATIO']))
852 $this->resultData[
$productId][
'MEASURE_RATIO'] = 1;
856 private function getStoresData($productId)
863 $productProvider = $this->provider;
865 if($this->storesCount ===
null)
866 $this->storesCount = $productProvider::GetStoresCount(array(
"SITE_ID" => $this->siteId));
868 if(intval($this->storesCount <= 0))
871 $stores = $productProvider::GetProductStores(array(
"PRODUCT_ID" => $productId,
"SITE_ID" => $this->siteId));
879 private static function getIblockPropInfo($value, $propData, $arSize = array(
"WIDTH" => 90,
"HEIGHT" => 90), $orderId = 0)
883 if ($propData[
"MULTIPLE"] ===
"Y")
886 if (!is_array($value))
888 $value = (string)$value;
889 if (mb_strpos($value,
",") !==
false)
891 $arVal = explode(
",", $value);
903 if (count($arVal) > 0)
905 foreach ($arVal as $key => $val)
907 if ($propData[
"PROPERTY_TYPE"] ===
"F")
912 $res .=
"<br/> ".self::showImageOrDownloadLink(trim($val), $orderId, $arSize);
916 $res = self::showImageOrDownloadLink(trim($val), $orderId, $arSize);
935 if ($propData[
"PROPERTY_TYPE"] ===
"F")
937 $res = self::showImageOrDownloadLink($value, $orderId, $arSize);
939 elseif($propData[
"PROPERTY_TYPE"] ===
"S" && $propData[
"USER_TYPE"] ===
"HTML" && isset($value[
"TEXT"]))
941 $res = $value[
"TEXT"];
957 private static function showImageOrDownloadLink($fileId, $orderId = 0, $arSize = array(
"WIDTH" => 90,
"HEIGHT" => 90))
960 $arFile = \CFile::GetFileArray($fileId);
964 $isImage = \CFile::IsImage($arFile[
"FILE_NAME"], $arFile[
"CONTENT_TYPE"]);
966 $resultHTML = \CFile::ShowImage($arFile[
"ID"], $arSize[
"WIDTH"], $arSize[
"HEIGHT"],
"border=0",
"",
true);
968 $resultHTML =
"<a href=\"sale_order_detail.php?ID=".$orderId.
"&download=Y&file_id=".$arFile[
"ID"].
"&".bitrix_sessid_get().
"\">".$arFile[
"ORIGINAL_NAME"].
"</a>";