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


PHP CIBlockSection::getNavChain方法代码示例

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


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

示例1: onBeforeIndex

 /**
  * @param array $fields		Item fields.
  * @return array
  */
 public static function onBeforeIndex($fields)
 {
     if (!isset($fields['MODULE_ID']) || $fields['MODULE_ID'] != 'iblock') {
         return $fields;
     }
     if (empty($fields['PARAM2'])) {
         return $fields;
     }
     if (!isset(self::$catalogList[$fields['PARAM2']])) {
         self::$catalogList[$fields['PARAM2']] = false;
         $catalogIterator = CatalogIblockTable::getList(array('select' => array('IBLOCK_ID'), 'filter' => array('=IBLOCK_ID' => $fields['PARAM2'])));
         $catalog = $catalogIterator->fetch();
         if (!empty($catalog)) {
             self::$catalogList[$fields['PARAM2']] = $catalog['IBLOCK_ID'];
         }
         unset($catalog, $catalogIterator);
     }
     if (!empty(self::$catalogList[$fields['PARAM2']])) {
         $fields["PARAMS"]["iblock_section"] = array();
         if (strpos($fields['ITEM_ID'], 'S') === false) {
             $sections = \CIBlockElement::getElementGroups($fields["ITEM_ID"], true, array('ID'));
             while ($section = $sections->fetch()) {
                 $nav = \CIBlockSection::getNavChain($fields['PARAM2'], $section["ID"], array('ID'));
                 while ($chain = $nav->fetch()) {
                     $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
                 }
                 unset($chain, $nav);
             }
             unset($section, $sections);
         } else {
             $nav = \CIBlockSection::getNavChain($fields['PARAM2'], preg_replace('#[^0-9]+#', '', $fields["ITEM_ID"]), array('ID'));
             while ($chain = $nav->fetch()) {
                 $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
             }
             unset($chain, $nav);
         }
     }
     return $fields;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:43,代码来源:searchhandlers.php

示例2: onBeforeIndex

 /**
  * @param array $fields		Item fields.
  * @return array
  */
 public function onBeforeIndex($fields)
 {
     if ($fields["MODULE_ID"] == "iblock") {
         $catalogs = \CCatalog::getList(array(), array('IBLOCK_ID' => $fields['PARAM2']), false, false, array('IBLOCK_ID'));
         if ($catalogs->fetch()) {
             $fields["PARAMS"]["iblock_section"] = array();
             if (strpos($fields['ITEM_ID'], 'S') === false) {
                 $sections = \CIBlockElement::getElementGroups($fields["ITEM_ID"], true, array('ID'));
                 while ($section = $sections->fetch()) {
                     $nav = \CIBlockSection::getNavChain($fields['PARAM2'], $section["ID"], array('ID'));
                     while ($chain = $nav->fetch()) {
                         $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
                     }
                 }
             } else {
                 $nav = \CIBlockSection::getNavChain($fields['PARAM2'], preg_replace('#[^0-9]+#', '', $fields["ITEM_ID"]), array('ID'));
                 while ($chain = $nav->fetch()) {
                     $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:28,代码来源:searchhandlers.php

示例3: 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

示例4: getSectionParents

 /**
  * Returns all section parents.
  *
  * @param integer $sectionId Section identifier.
  *
  * @return mixed
  */
 public function getSectionParents($sectionId)
 {
     if (!isset(self::$sectionParents[$sectionId])) {
         $sections = array();
         $sectionList = \CIBlockSection::getNavChain($this->iblockId, $sectionId, array("ID"));
         while ($section = $sectionList->fetch()) {
             $sections[] = $section["ID"];
         }
         self::$sectionParents[$sectionId] = $sections;
     }
     return self::$sectionParents[$sectionId];
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:19,代码来源:element.php


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