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


PHP CIBlockElement::getPropertyValuesArray方法代码示例

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


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

示例1: getProductData

 /**
  * Returns product data.
  *
  * @param array &$productData			Product data.
  * @param array $entityData				Entity data.
  * @param array $iblockData				Iblock list data.
  * @return void
  */
 protected static function getProductData(&$productData, $entityData, $iblockData)
 {
     if (!empty($iblockData['iblockElement'])) {
         $productList = array_keys($productData);
         if (!empty($entityData['iblockFields'])) {
             $elementIterator = Iblock\ElementTable::getList(array('select' => array_merge(array('ID'), array_keys($entityData['iblockFields'])), 'filter' => array('@ID' => $productList)));
             while ($element = $elementIterator->fetch()) {
                 $element['ID'] = (int) $element['ID'];
                 $fields = array();
                 foreach ($entityData['iblockFields'] as $key => $alias) {
                     $fields[$alias] = $element[$key];
                 }
                 unset($key, $alias);
                 $productData[$element['ID']] = empty($productData[$element['ID']]) ? $fields : array_merge($productData[$element['ID']], $fields);
                 unset($fields);
             }
         }
         if ($entityData['sections']) {
             $productSection = array_fill_keys($productList, array());
             $elementSectionIterator = Iblock\SectionElementTable::getList(array('select' => array('*'), 'filter' => array('@IBLOCK_ELEMENT_ID' => $productList)));
             while ($elementSection = $elementSectionIterator->fetch()) {
                 $elementSection['IBLOCK_ELEMENT_ID'] = (int) $elementSection['IBLOCK_ELEMENT_ID'];
                 $elementSection['IBLOCK_SECTION_ID'] = (int) $elementSection['IBLOCK_SECTION_ID'];
                 $elementSection['ADDITIONAL_PROPERTY_ID'] = (int) $elementSection['ADDITIONAL_PROPERTY_ID'];
                 if ($elementSection['ADDITIONAL_PROPERTY_ID'] > 0) {
                     continue;
                 }
                 $productSection[$elementSection['IBLOCK_ELEMENT_ID']][$elementSection['IBLOCK_SECTION_ID']] = true;
                 $parentSectionIterator = \CIBlockSection::getNavChain(0, $elementSection['IBLOCK_SECTION_ID'], array('ID'));
                 while ($parentSection = $parentSectionIterator->fetch()) {
                     $parentSection['ID'] = (int) $parentSection['ID'];
                     $productSection[$elementSection['IBLOCK_ELEMENT_ID']][$parentSection['ID']] = true;
                 }
                 unset($parentSection, $parentSectionIterator);
             }
             unset($elementSection, $elementSectionIterator);
             foreach ($productSection as $element => $sections) {
                 $productData[$element]['SECTION_ID'] = array_keys($sections);
             }
             unset($element, $sections, $productSection);
         }
         if (!empty($entityData['needProperties'])) {
             $propertyValues = array_fill_keys($productList, array());
             foreach ($entityData['needProperties'] as $iblock => $propertyList) {
                 if (empty($iblockData['iblockElement'][$iblock])) {
                     continue;
                 }
                 $filter = array('ID' => $iblockData['iblockElement'][$iblock], 'IBLOCK_ID' => $iblock);
                 \CTimeZone::disable();
                 \CIBlockElement::getPropertyValuesArray($propertyValues, $iblock, $filter, array('ID' => $propertyList));
                 \CTimeZone::enable();
             }
             unset($filter, $iblock, $propertyList);
             self::convertProperties($productData, $propertyValues, $entityData, $iblockData);
         }
         if (!empty($entityData['catalogFields'])) {
             $productIterator = Catalog\ProductTable::getList(array('select' => array_merge(array('ID'), array_keys($entityData['catalogFields'])), 'filter' => array('@ID' => $productList)));
             while ($product = $productIterator->fetch()) {
                 $product['ID'] = (int) $product['ID'];
                 $fields = array();
                 foreach ($entityData['catalogFields'] as $key => $alias) {
                     $fields[$alias] = $product[$key];
                 }
                 unset($key, $alias);
                 $productData[$product['ID']] = empty($productData[$product['ID']]) ? $fields : array_merge($productData[$product['ID']], $fields);
                 unset($fields);
             }
             unset($product, $productIterator);
         }
         if (!empty($iblockData['skuIblockList'])) {
             self::getParentProducts($productData, $entityData, $iblockData);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:82,代码来源:discountmanager.php


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