当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockPriceTools::getFillProductProperties方法代码示例

本文整理汇总了PHP中CIBlockPriceTools::getFillProductProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPriceTools::getFillProductProperties方法的具体用法?PHP CIBlockPriceTools::getFillProductProperties怎么用?PHP CIBlockPriceTools::getFillProductProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockPriceTools的用法示例。


在下文中一共展示了CIBlockPriceTools::getFillProductProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getItems

 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $elementIterator = CIBlockElement::GetList(array(), $this->filter, false, false, $this->selectFields);
     $elementIterator->SetUrlTemplates($this->arParams["DETAIL_URL"]);
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     while ($elementObj = $elementIterator->GetNextElement()) {
         $item = $elementObj->GetFields();
         $item['ID'] = intval($item['ID']);
         $item['ACTIVE_FROM'] = $item['DATE_ACTIVE_FROM'];
         $item['ACTIVE_TO'] = $item['DATE_ACTIVE_TO'];
         // Inherited Properties
         $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($item["IBLOCK_ID"], $item["ID"]);
         $item["IPROPERTY_VALUES"] = $ipropValues->getValues();
         $item["PREVIEW_PICTURE"] = 0 < $item["PREVIEW_PICTURE"] ? CFile::GetFileArray($item["PREVIEW_PICTURE"]) : false;
         if ($item["PREVIEW_PICTURE"]) {
             $item["PREVIEW_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
             if ($item["PREVIEW_PICTURE"]["ALT"] == "") {
                 $item["PREVIEW_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["PREVIEW_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
             if ($item["PREVIEW_PICTURE"]["TITLE"] == "") {
                 $item["PREVIEW_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $item["DETAIL_PICTURE"] = 0 < $item["DETAIL_PICTURE"] ? CFile::GetFileArray($item["DETAIL_PICTURE"]) : false;
         if ($item["DETAIL_PICTURE"]) {
             $item["DETAIL_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
             if ($item["DETAIL_PICTURE"]["ALT"] == "") {
                 $item["DETAIL_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["DETAIL_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
             if ($item["DETAIL_PICTURE"]["TITLE"] == "") {
                 $item["DETAIL_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $itemIblockId = (int) $item['IBLOCK_ID'];
         $needItemProperties = isset($this->arParams['PROPERTY_CODE'][$itemIblockId]) && !empty($this->arParams['PROPERTY_CODE'][$itemIblockId]) || isset($this->arParams['ADDITIONAL_PICT_PROP'][$itemIblockId]) || isset($this->arParams['LABEL_PROP'][$itemIblockId]);
         $item["PROPERTIES"] = array();
         $item["DISPLAY_PROPERTIES"] = array();
         if ($needItemProperties) {
             $item["PROPERTIES"] = $elementObj->getProperties();
             CCatalogDiscount::SetProductPropertiesCache($item['ID'], $item["PROPERTIES"]);
         }
         if (isset($this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']])) {
             $properties = $this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']];
             foreach ($properties as $propertyName) {
                 if (!isset($item["PROPERTIES"][$propertyName])) {
                     continue;
                 }
                 $prop =& $item["PROPERTIES"][$propertyName];
                 $boolArr = is_array($prop["VALUE"]);
                 if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                     $item["DISPLAY_PROPERTIES"][$propertyName] = CIBlockFormatProperties::GetDisplayValue($item, $prop, "catalog_out");
                 }
             }
         }
         $item["PRODUCT_PROPERTIES"] = array();
         $item['PRODUCT_PROPERTIES_FILL'] = array();
         if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']])) {
             $item["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($item['IBLOCK_ID'], $item["ID"], $this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']], $item["PROPERTIES"]);
             if (!empty($item["PRODUCT_PROPERTIES"])) {
                 $item['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($item['PRODUCT_PROPERTIES']);
             }
         }
         if (!isset($item["CATALOG_MEASURE_RATIO"])) {
             $item["CATALOG_MEASURE_RATIO"] = 1;
         }
         if (!isset($item['CATALOG_MEASURE'])) {
             $item['CATALOG_MEASURE'] = 0;
         }
         $item['CATALOG_MEASURE'] = intval($item['CATALOG_MEASURE']);
         if (0 > $item['CATALOG_MEASURE']) {
             $item['CATALOG_MEASURE'] = 0;
         }
         if (!isset($item['CATALOG_MEASURE_NAME'])) {
             $item['CATALOG_MEASURE_NAME'] = '';
         }
         $item['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
         $item['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
         $items[$item['ID']] = $item;
     }
     return $items;
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:91,代码来源:class.php

示例2: foreach

         }
         if ($bGetProperties) {
             foreach ($arParams["PROPERTY_CODE"] as $pid) {
                 if (!isset($arItem["PROPERTIES"][$pid])) {
                     continue;
                 }
                 $prop =& $arItem["PROPERTIES"][$pid];
                 $boolArr = is_array($prop["VALUE"]);
                 if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                     $arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $prop, "catalog_out");
                 }
             }
             if ($bGetProductProperties) {
                 $arItem["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($arParams["IBLOCK_ID"], $arItem["ID"], $arParams["PRODUCT_PROPERTIES"], $arItem["PROPERTIES"]);
                 if (!empty($arItem["PRODUCT_PROPERTIES"])) {
                     $arItem['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($arItem['PRODUCT_PROPERTIES']);
                 }
             }
         }
     }
     if (isset($arItem)) {
         unset($arItem);
     }
 }
 if ($bIBlockCatalog) {
     if (!empty($arResult["ELEMENTS"])) {
         $rsRatios = CCatalogMeasureRatio::getList(array(), array('PRODUCT_ID' => $arResult["ELEMENTS"]), false, false, array('PRODUCT_ID', 'RATIO'));
         while ($arRatio = $rsRatios->Fetch()) {
             $arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
             if (isset($arElementLink[$arRatio['PRODUCT_ID']])) {
                 $intRatio = (int) $arRatio['RATIO'];
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例3: getItems

 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $this->separateItemsByIblock();
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     foreach (array_keys($this->arParams['SHOW_PRODUCTS']) as $iblock) {
         $this->linkItems = array();
         if (empty($this->iblockItems[$iblock])) {
             continue;
         }
         $filter = $this->filter;
         $filter['IBLOCK_ID'] = $iblock;
         $filter['ID'] = $this->iblockItems[$iblock];
         $elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $this->selectFields);
         $elementIterator->SetUrlTemplates($this->arParams['DETAIL_URL']);
         while ($element = $elementIterator->GetNext()) {
             $element['ID'] = (int) $element['ID'];
             $element['ACTIVE_FROM'] = $element['DATE_ACTIVE_FROM'];
             $element['ACTIVE_TO'] = $element['DATE_ACTIVE_TO'];
             $buttons = CIBlock::GetPanelButtons($element['IBLOCK_ID'], $element['ID'], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true));
             $element['EDIT_LINK'] = $buttons['edit']['edit_element']['ACTION_URL'];
             $element['DELETE_LINK'] = $buttons['edit']['delete_element']['ACTION_URL'];
             $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($element["IBLOCK_ID"], $element["ID"]);
             $element["IPROPERTY_VALUES"] = $ipropValues->getValues();
             $element["PREVIEW_PICTURE"] = $element["PREVIEW_PICTURE"] > 0 ? CFile::GetFileArray($element["PREVIEW_PICTURE"]) : false;
             if ($element["PREVIEW_PICTURE"]) {
                 $element["PREVIEW_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
                 if ($element["PREVIEW_PICTURE"]["ALT"] == "") {
                     $element["PREVIEW_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["PREVIEW_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
                 if ($element["PREVIEW_PICTURE"]["TITLE"] == "") {
                     $element["PREVIEW_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["DETAIL_PICTURE"] = $element["DETAIL_PICTURE"] > 0 ? CFile::GetFileArray($element["DETAIL_PICTURE"]) : false;
             if ($element["DETAIL_PICTURE"]) {
                 $element["DETAIL_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
                 if ($element["DETAIL_PICTURE"]["ALT"] == "") {
                     $element["DETAIL_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["DETAIL_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
                 if ($element["DETAIL_PICTURE"]["TITLE"] == "") {
                     $element["DETAIL_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["PROPERTIES"] = array();
             $element["DISPLAY_PROPERTIES"] = array();
             $element["PRODUCT_PROPERTIES"] = array();
             $element['PRODUCT_PROPERTIES_FILL'] = array();
             if (!isset($element["CATALOG_MEASURE_RATIO"])) {
                 $element["CATALOG_MEASURE_RATIO"] = 1;
             }
             if (!isset($element['CATALOG_MEASURE'])) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             $element['CATALOG_MEASURE'] = (int) $element['CATALOG_MEASURE'];
             if ($element['CATALOG_MEASURE'] < 0) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             if (!isset($element['CATALOG_MEASURE_NAME'])) {
                 $element['CATALOG_MEASURE_NAME'] = '';
             }
             $element['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
             $element['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
             $items[$element['ID']] = $element;
             $this->linkItems[$element['ID']] =& $items[$element['ID']];
         }
         unset($element, $elementIterator);
         $propFilter = array('ID' => $this->iblockItems[$iblock], 'IBLOCK_ID' => $iblock);
         CIBlockElement::GetPropertyValuesArray($this->linkItems, $iblock, $propFilter);
         unset($propFilter);
         foreach ($this->linkItems as &$element) {
             CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']);
             if (isset($this->arParams['PROPERTY_CODE'][$iblock])) {
                 $properties = $this->arParams['PROPERTY_CODE'][$iblock];
                 foreach ($properties as $propertyName) {
                     if (!isset($element['PROPERTIES'][$propertyName])) {
                         continue;
                     }
                     $prop =& $element['PROPERTIES'][$propertyName];
                     $boolArr = is_array($prop["VALUE"]);
                     if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                         $element['DISPLAY_PROPERTIES'][$propertyName] = CIBlockFormatProperties::GetDisplayValue($element, $prop, 'catalog_out');
                     }
                     unset($prop);
                 }
             }
             if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$iblock])) {
                 $element["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($element['IBLOCK_ID'], $element["ID"], $this->arParams['CART_PROPERTIES'][$iblock], $element["PROPERTIES"]);
                 if (!empty($element["PRODUCT_PROPERTIES"])) {
                     $element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']);
                 }
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:class.php


注:本文中的CIBlockPriceTools::getFillProductProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。