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


PHP mslib_fe::globalCrumbarTree方法代码示例

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


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

示例1: compareDatabaseRebuildProductsToCategoryTree

 function compareDatabaseRebuildProductsToCategoryTree($pid, $deepest_cat_id, $dataArray = array())
 {
     if (!is_numeric($pid)) {
         return false;
     }
     if (!is_numeric($deepest_cat_id)) {
         return false;
     }
     $level = 1;
     $cats = mslib_fe::globalCrumbarTree($deepest_cat_id);
     $cats = array_reverse($cats);
     //
     $crumbar_ident_string = '';
     $crumbar_ident_array = array();
     foreach ($cats as $item) {
         $crumbar_ident_array[] = $item['id'];
     }
     $crumbar_ident_string = implode(',', $crumbar_ident_array);
     $count_cats = count($cats);
     /*if ($count_cats>1) {
           // remove the deepest cat id record
           // disabled by bas
           //unset($cats[$count_cats-1]);
           //recount
           //$count_cats=count($cats);
       }*/
     if ($count_cats > 0) {
         foreach ($cats as $item) {
             if ($item['id']) {
                 $rec = tx_mslib_catalog::isProductToCategoryLinkingExist($pid, $item['id'], $crumbar_ident_string);
                 if (!$rec) {
                     $insertArray = array();
                     if (!is_array($dataArray) || is_array($dataArray) && !count($dataArray)) {
                         $insertArray['categories_id'] = $deepest_cat_id;
                         $insertArray['products_id'] = $pid;
                         $insertArray['page_uid'] = $item['page_uid'];
                         $insertArray['sort_order'] = time();
                         $insertArray['related_to'] = 0;
                     } else {
                         foreach ($dataArray as $idx => $val) {
                             $insertArray[$idx] = $val;
                         }
                     }
                     $insertArray['node_id'] = $item['id'];
                     if ($item['id'] == $deepest_cat_id) {
                         $insertArray['is_deepest'] = 1;
                     } else {
                         $insertArray['is_deepest'] = 0;
                     }
                     $insertArray['crumbar_identifier'] = $crumbar_ident_string;
                     $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_products_to_categories', $insertArray);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 } else {
                     $updateArray = array();
                     if (!empty($rec['crumbar_identifier'])) {
                         $tmp_cid = explode(',', $rec['crumbar_identifier']);
                         $last_index = count($tmp_cid) - 1;
                         if ($tmp_cid[$last_index] == $deepest_cat_id) {
                             if ($item['id'] == $deepest_cat_id) {
                                 $updateArray['is_deepest'] = 1;
                             } else {
                                 $updateArray['is_deepest'] = 0;
                             }
                             $updateArray['crumbar_identifier'] = $crumbar_ident_string;
                             $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_products_to_categories', 'products_to_categories_id=\'' . $rec['products_to_categories_id'] . '\'', $updateArray);
                             $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                         }
                     } else {
                         if ($item['id'] == $deepest_cat_id) {
                             $updateArray['is_deepest'] = 1;
                         } else {
                             $updateArray['is_deepest'] = 0;
                         }
                         $updateArray['crumbar_identifier'] = $crumbar_ident_string;
                         $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_products_to_categories', 'products_to_categories_id=\'' . $rec['products_to_categories_id'] . '\'', $updateArray);
                         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                     }
                 }
                 $level++;
                 /*if ($pid==508) {
                       echo "<pre>";
                       var_dump($query);
                       echo "<br/>";
                   }*/
             }
         }
         //return true;
     }
 }
开发者ID:bvbmedia,项目名称:multishop,代码行数:89,代码来源:class.tx_mslib_catalog.php

示例2: foreach

 //die();
 // finally get the category ids that we must remove
 if (is_array($catOldIds) && count($catOldIds)) {
     foreach ($catOldIds as $page_uid => $catOldArray) {
         $catIdsToRemove = $catOldArray;
         if (is_array($catIds[$page_uid]) && count($catIds[$page_uid])) {
             $catIdsToRemove = array_diff($catOldIds[$page_uid], $catIds[$page_uid]);
         }
         //print_r($catIdsToRemove);
         if (is_array($catIdsToRemove) && count($catIdsToRemove)) {
             foreach ($catIdsToRemove as $catId) {
                 if (strpos($catId, '::rel_') !== false) {
                     list($tmpcatId, ) = explode('::rel_', $catId);
                     $catId = $tmpcatId;
                 }
                 $cats = mslib_fe::globalCrumbarTree($catId);
                 $cats = array_reverse($cats);
                 //
                 $crumbar_ident_string = '';
                 $crumbar_ident_array = array();
                 foreach ($cats as $item) {
                     $crumbar_ident_array[] = $item['id'];
                 }
                 $crumbar_ident_string = implode(',', $crumbar_ident_array);
                 //
                 if (!empty($crumbar_ident_string)) {
                     $query = $GLOBALS['TYPO3_DB']->DELETEquery('tx_multishop_products_to_categories', 'products_id=\'' . $prodid . '\' and crumbar_identifier=\'' . $crumbar_ident_string . '\' and page_uid=' . $page_uid);
                     //var_dump($query);
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                     // remove the custom page desc if the cat id is not related anymore in p2c
                     $query = $GLOBALS['TYPO3_DB']->DELETEquery('tx_multishop_products_description', 'products_id=\'' . $prodid . '\' and layered_categories_id=\'' . $catId . '\' and page_uid=' . $page_uid);
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:admin_edit_product.php

示例3: globalCrumbarTree

 public function globalCrumbarTree($c, $languages_id = '', $output = array())
 {
     if (is_numeric($c)) {
         if ($this->ms['MODULES']['CACHE_FRONT_END']) {
             if (!isset($this->ms['MODULES']['CACHE_TIME_OUT_CRUM'])) {
                 $this->ms['MODULES']['CACHE_TIME_OUT_CRUM'] = $this->ms['MODULES']['CACHE_TIME_OUT_SEARCH_PAGES'];
             }
             if (!count($output) && $this->ms['MODULES']['CACHE_TIME_OUT_CRUM']) {
                 $CACHE_FRONT_END = 1;
             } else {
                 $CACHE_FRONT_END = 0;
             }
         } else {
             $CACHE_FRONT_END = 0;
         }
         if ($CACHE_FRONT_END) {
             $this->cacheLifeTime = $this->ms['MODULES']['CACHE_TIME_OUT_CRUM'];
             $options = array('caching' => true, 'cacheDir' => $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/cache/', 'lifeTime' => $this->cacheLifeTime);
             $Cache_Lite = new Cache_Lite($options);
             $string = $this->cObj->data['uid'] . '_crum_' . $c . '_' . $languages_id . '_' . md5(serialize($output));
         }
         if ($this->ROOTADMIN_USER || !$CACHE_FRONT_END || $CACHE_FRONT_END && !($content = $Cache_Lite->get($string))) {
             $sql = $GLOBALS['TYPO3_DB']->SELECTquery('c.status, c.custom_settings, c.categories_id, c.parent_id, c.page_uid, cd.categories_name, cd.meta_title, cd.meta_description', 'tx_multishop_categories c, tx_multishop_categories_description cd', 'c.categories_id = \'' . $c . '\' and cd.language_id=\'' . $this->sys_language_uid . '\' and c.categories_id = cd.categories_id', '', '', '');
             $qry = $GLOBALS['TYPO3_DB']->sql_query($sql);
             if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry)) {
                 $data = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry);
                 if ($data['categories_name']) {
                     $output[] = array('name' => $data['categories_name'], 'url' => mslib_fe::rewritenamein($data['categories_name'], 'cat', $data['categories_id']), 'id' => $data['categories_id'], 'custom_settings' => $data['custom_settings'], 'meta_title' => $data['meta_title'], 'meta_description' => $data['meta_description'], 'status' => $data['status'], 'page_uid' => $data['page_uid']);
                 }
                 if ($data['parent_id'] > 0 && $data['parent_id'] != $this->categoriesStartingPoint) {
                     if ($data['categories_id'] == $data['parent_id']) {
                         echo 'globalCrumbar is looping.';
                         die;
                     } else {
                         $output = mslib_fe::globalCrumbarTree($data['parent_id'], '', $output);
                     }
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($qry);
             }
             if ($CACHE_FRONT_END) {
                 $Cache_Lite->save(serialize($output));
             }
         } else {
             $output = unserialize($content);
         }
     }
     return $output;
 }
开发者ID:bvbmedia,项目名称:multishop,代码行数:48,代码来源:class.mslib_fe.php


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