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


PHP Category::getParentsCategories方法代码示例

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


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

示例1: getData

 public function getData()
 {
     if (!isset($this->_data)) {
         $shop = $this->getShop();
         $lang = $this->getLang();
         if (empty($this->_root_category)) {
             $root_category = Category::getRootCategory($lang, new Shop((int) Configuration::get('PS_SHOP_DEFAULT')))->id;
         }
         $categories = $new_selected_categories = array();
         $selected_categories = Category::getAllCategoriesName($root_category, $lang, false, null, false);
         $categories[$root_category] = Category::getChildren($root_category, $lang, false, (int) Configuration::get('PS_SHOP_DEFAULT'));
         foreach ($selected_categories as $selected_category) {
             $category = new Category($selected_category['id_category'], $lang, (int) Configuration::get('PS_SHOP_DEFAULT'));
             $new_selected_categories[] = $selected_category['id_category'];
             $parents = $category->getParentsCategories($lang);
             foreach ($parents as $value) {
                 $new_selected_categories[] = $value['id_category'];
             }
         }
         $new_selected_categories = array_unique($new_selected_categories);
         foreach ($new_selected_categories as $selected_category) {
             $current_category = Category::getChildren($selected_category, $lang, false, (int) Configuration::get('PS_SHOP_DEFAULT'));
             if (!empty($current_category)) {
                 $categories[$selected_category] = $current_category;
             }
         }
         $tree = $this->fillTree($categories, $root_category);
         if (!empty($children)) {
             $tree[$root_category]['children'] = $children;
         }
         $this->setData($tree);
     }
     return $this->_data;
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:34,代码来源:HelperTreeProducts.php

示例2: __construct

 public function __construct()
 {
     global $cookie;
     $this->table = 'category';
     $this->className = 'Category';
     $this->lang = true;
     $this->edit = true;
     $this->view = true;
     $this->delete = true;
     $this->fieldImageSettings = array('name' => 'image', 'dir' => 'c');
     $this->fieldsDisplay = array('id_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'name' => array('title' => $this->l('Name'), 'width' => 100, 'callback' => 'hideCategoryPosition'), 'description' => array('title' => $this->l('Description'), 'width' => 480, 'maxlength' => 90, 'orderby' => false), 'physical_products_quantity' => array('title' => $this->l('In stock Products'), 'align' => 'center', 'width' => 50), 'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
     $this->_category = AdminCatalog::getCurrentCategory();
     $this->_filter = 'AND `id_parent` = ' . intval($this->_category->id);
     $children = Category::getChildren($this->_category->id, $cookie->id_lang);
     foreach ($children as &$child) {
         $tmp_list = $this->_category->id . ',';
         $obj = new Category($child['id_category']);
         $parents = $obj->getParentsCategories();
         foreach ($parents as $parent) {
             $tmp_list .= $parent['id_category'] . ',';
         }
         $child['parent_id_list'] = rtrim($tmp_list, ',');
     }
     parent::__construct();
 }
开发者ID:sealence,项目名称:local,代码行数:25,代码来源:AdminCategories.php

示例3: getData

 public function getData()
 {
     if (!isset($this->_data)) {
         $shop = $this->getShop();
         $lang = $this->getLang();
         $root_category = (int) $this->getRootCategory();
         if ($this->_full_tree) {
             $this->setData(Category::getNestedCategories($root_category, $lang, false, null, $this->useShopRestriction()));
             $this->setDataSearch(Category::getAllCategoriesName($root_category, $lang, false, null, $this->useShopRestriction()));
         } elseif ($this->_children_only) {
             if (empty($root_category)) {
                 $root_category = Category::getRootCategory()->id;
             }
             $categories[$root_category] = Category::getChildren($root_category, $lang, false, $shop->id);
             $children = $this->fillTree($categories, $root_category);
             $this->setData($children);
         } else {
             if (empty($root_category)) {
                 $root_category = Category::getRootCategory()->id;
             }
             $new_selected_categories = array();
             $selected_categories = $this->getSelectedCategories();
             $categories[$root_category] = Category::getChildren($root_category, $lang, false, $shop->id);
             foreach ($selected_categories as $selected_category) {
                 $category = new Category($selected_category, $lang, $shop->id);
                 $new_selected_categories[] = $selected_category;
                 $parents = $category->getParentsCategories($lang);
                 foreach ($parents as $value) {
                     $new_selected_categories[] = $value['id_category'];
                 }
             }
             $new_selected_categories = array_unique($new_selected_categories);
             foreach ($new_selected_categories as $selected_category) {
                 $current_category = Category::getChildren($selected_category, $lang, false, $shop->id);
                 if (!empty($current_category)) {
                     $categories[$selected_category] = $current_category;
                 }
             }
             $tree = Category::getCategoryInformations(array($root_category), $lang);
             $children = $this->fillTree($categories, $root_category);
             if (!empty($children)) {
                 $tree[$root_category]['children'] = $children;
             }
             $this->setData($tree);
             $this->setDataSearch(Category::getAllCategoriesName($root_category, $lang, false, null, $this->useShopRestriction()));
         }
     }
     return $this->_data;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:49,代码来源:HelperTreeCategories.php

示例4: getCategoryLink

 public function getCategoryLink($category, $alias = NULL, $id_lang = NULL, $selected_filters = NULL, $id_shop = NULL)
 {
     $dispatcher = Dispatcher::getInstance();
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     $url = _PS_BASE_URL_ . __PS_BASE_URI__ . $this->getLangLink($id_lang);
     if (!is_object($category)) {
         $category = new Category($category, $id_lang);
     }
     // Set available keywords
     $params = array();
     $params['id'] = $category->id;
     $params['rewrite'] = !$alias ? $category->link_rewrite : $alias;
     $params['meta_keywords'] = Tools::str2url($category->meta_keywords);
     $params['meta_title'] = Tools::str2url($category->meta_title);
     // Selected filters is used by the module blocklayered
     $selected_filters = is_null($selected_filters) ? '' : $selected_filters;
     if (empty($selected_filters)) {
         $rule = 'category_rule';
     } else {
         $rule = 'layered_rule';
         $params['selected_filters'] = $selected_filters;
     }
     if ($dispatcher->hasKeyword('category_rule', $id_lang, 'parent_categories')) {
         //RETRIEVING ALL THE PARENT CATEGORIES
         $cats = array();
         foreach ($category->getParentsCategories() as $cat) {
             if (!in_array($cat['id_category'], array(1, 2, $category->id))) {
                 //remove root, home and current category from the URL
                 $cats[] = $cat['link_rewrite'];
             }
         }
         //THE CATEGORIES ARE BEING ASSIGNED IN THE WRONG ORDER (?)
         $params['parent_categories'] = implode('/', array_reverse($cats));
         //ADD THE URL SLASHES TO THE CATEGORIES IN REVERSE ORDER
     }
     return $url . Dispatcher::getInstance()->createUrl($rule, $id_lang, $params, $this->allow);
 }
开发者ID:andyalber,项目名称:PrestaShop-modules-CleanURLs,代码行数:39,代码来源:Link.php

示例5: getCategoryLink

 /**
  * Create a link to a category
  *
  * @param mixed $category Category object (can be an ID category, but deprecated)
  * @param string $alias
  * @param int $id_lang
  * @param string $selected_filters Url parameter to autocheck filters of the module blocklayered
  * @return string
  */
 public function getCategoryLink($category, $alias = null, $id_lang = null, $selected_filters = null, $id_shop = null, $relative_protocol = false)
 {
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     $url = $this->getBaseLink($id_shop, null, $relative_protocol) . $this->getLangLink($id_lang, null, $id_shop);
     if (!is_object($category)) {
         $category = new Category($category, $id_lang);
     }
     // Set available keywords
     $params = array();
     $params['id'] = $category->id;
     $params['rewrite'] = !$alias ? $category->link_rewrite : $alias;
     $params['meta_keywords'] = Tools::str2url($category->getFieldByLang('meta_keywords'));
     $params['meta_title'] = Tools::str2url($category->getFieldByLang('meta_title'));
     // Selected filters is used by the module blocklayered
     $selected_filters = is_null($selected_filters) ? '' : $selected_filters;
     if (empty($selected_filters)) {
         $rule = 'category_rule';
     } else {
         $rule = 'layered_rule';
         $params['selected_filters'] = $selected_filters;
     }
     $dispatcher = Dispatcher::getInstance();
     if ($dispatcher->hasKeyword('category_rule', $id_lang, 'parent_categories')) {
         // Retrieve all parent categories
         $p_cats = array();
         foreach ($category->getParentsCategories($id_lang) as $p_cat) {
             // remove root and current category from the URL
             if (!in_array($p_cat['id_category'], array_merge(self::$category_disable_rewrite, array($category->id)))) {
                 $p_cats[] = $p_cat['link_rewrite'];
             }
         }
         // add the URL slashes among categories, in reverse order
         $params['parent_categories'] = implode('/', array_reverse($p_cats));
     }
     return $url . $dispatcher->createUrl($rule, $id_lang, $params, $this->allow, '', $id_shop);
 }
开发者ID:krikstaniuks,项目名称:zzCleanURLs,代码行数:47,代码来源:Link.php

示例6: getCategoryLink

 /**
  * Override method getCategoryLink for use "categories" in category rule keyword on route
  *
  * @module now_seo_links
  *
  * @param mixed $category
  * @param null $alias
  * @param null $id_lang
  * @param null $selected_filters
  * @param null $id_shop
  * @return string
  * @see LinkCore::getCategoryLink()
  */
 public function getCategoryLink($category, $alias = null, $id_lang = null, $selected_filters = null, $id_shop = null)
 {
     if (!$id_lang) {
         $id_lang = Context::getContext()->language->id;
     }
     $url = $this->getBaseLink($id_shop) . $this->getLangLink($id_lang, null, $id_shop);
     if (!is_object($category)) {
         $category = new Category($category, $id_lang);
     }
     // Set available keywords
     $params = array();
     $params['id'] = $category->id;
     $params['rewrite'] = !$alias ? $category->link_rewrite : $alias;
     $params['meta_keywords'] = Tools::str2url($category->meta_keywords);
     $params['meta_title'] = Tools::str2url($category->meta_title);
     // Selected filters is used by the module blocklayered
     $selected_filters = is_null($selected_filters) ? '' : $selected_filters;
     if (empty($selected_filters)) {
         $rule = 'category_rule';
     } else {
         $rule = 'layered_rule';
         $params['selected_filters'] = $selected_filters;
     }
     $dispatcher = Dispatcher::getInstance();
     if ($dispatcher->hasKeyword('category_rule', $id_lang, 'categories', $id_shop)) {
         $cats = array();
         foreach ($category->getParentsCategories($id_lang) as $cat) {
             if (!in_array($cat['id_category'], array_merge(Link::$category_disable_rewrite, array($category->id)))) {
                 //remove root and home category from the URL
                 $cats[] = $cat['link_rewrite'];
             }
         }
         krsort($cats);
         $params['categories'] = implode('/', $cats);
     }
     return $url . $dispatcher->createUrl($rule, $id_lang, $params, $this->allow, '', $id_shop);
 }
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:50,代码来源:Link.php

示例7: hookLeftColumn

 public function hookLeftColumn()
 {
     if (get_class($this->context->controller) == 'ConvermaxSearchModuleFrontController') {
         $this->context->smarty->assign(array('pagesize' => abs((int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')))));
         return $this->display(__FILE__, 'views/templates/hook/facets.tpl');
     }
     $home_category = Configuration::get('PS_HOME_CATEGORY');
     $id_category = (int) Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
     if ($id_category != $home_category) {
         $category = new Category($id_category);
         $categories = $category->getParentsCategories();
         $category_full = array();
         foreach ($categories as $cat) {
             if ($cat['id_category'] != $home_category) {
                 $category_full[] = $cat['name'];
             }
         }
         if (!empty($category_full)) {
             $category_full = implode('>', array_reverse($category_full));
         }
         $facet = array('category_full' => array($category_full));
         $n = abs((int) Tools::getValue('n', isset($this->context->cookie->nb_item_per_page) ? (int) $this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE')));
         $search = Cmsearch::find($this->context->language->id, ' ', 1, $n, 'position', 'desc', false, true, null, $facet);
         if ($search) {
             $facets_params = '';
             $is_ranged = 'IsRanged';
             $field_name = 'FieldName';
             $values = 'Values';
             $display_name = 'DisplayName';
             foreach ($search['cm_result']->Facets as $facet) {
                 if ($facet->{$is_ranged}) {
                     $rangemin = preg_replace('|TO .*\\]|', '', $facet->{$values}[0]->Term);
                     $rangemax = preg_replace('|\\[.*? |', '', $facet->{$values}[count($facet->{$values}) - 1]->Term);
                     $facets_params .= 'cm_params.sliders.' . $facet->{$field_name} . ' = []' . ";\r\n";
                     $facets_params .= 'cm_params.sliders.' . $facet->{$field_name} . '[0] = "' . $rangemin . $rangemax . "\";\r\n";
                 } else {
                     $values_count = count($facet->{$values});
                     for ($i = 0; $i < $values_count; $i++) {
                         if ($facet->{$values}[$i]->Selected == true) {
                             $facets_params .= 'cm_params.facets.' . $facet->{$field_name} . ' = []' . ";\r\n";
                             $facets_params .= 'cm_params.facets.' . $facet->{$field_name} . '[' . $i . '] = "' . $facet->{$values}[$i]->Term . "\";\r\n";
                             $facets_params .= 'cm_params.facets_display.' . $facet->{$field_name} . ' = "' . $facet->{$display_name} . "\";\r\n";
                         }
                     }
                 }
             }
             $this->context->smarty->assign(array('facets' => $search['cm_result']->Facets, 'query' => ' ', 'pagenumber' => 1, 'pagesize' => $n, 'facets_params' => isset($facets_params) ? $facets_params : false));
             return $this->display(__FILE__, 'views/templates/hook/facets.tpl');
         }
     }
     return '';
 }
开发者ID:nickolay-v,项目名称:convermax,代码行数:52,代码来源:convermax.php

示例8: getBreadCrumb

 /**
  * Returns a simple breacrumb from a categoryId, the delimiter can be choosen
  * @param $categoryId
  * @param string $delimiter
  * @return string
  */
 public function getBreadCrumb($categoryId, $delimiter = " > ")
 {
     $currentCategory = new \Category($categoryId);
     $categories = $currentCategory->getParentsCategories();
     $categories = array_reverse($categories, true);
     $breadCrumb = '';
     foreach ($categories as $category) {
         $breadCrumb .= ' > ' . $category['name'];
     }
     return substr($breadCrumb, strlen($delimiter));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:17,代码来源:CategoryDataProvider.php

示例9: getBreadCrumbs

 private function getBreadCrumbs($product)
 {
     if (!method_exists('Product', 'getProductCategoriesFull')) {
         return '';
     }
     $result = array();
     $lang_id;
     if (isset($this->context)) {
         $lang_id = (int) $this->context->language->id;
     } else {
         global $cookie;
         $lang_id = (int) $cookie->id_lang;
     }
     $all_product_subs = Product::getProductCategoriesFull((int) $product->id, (int) $lang_id);
     if (isset($all_product_subs) && count($all_product_subs) > 0) {
         foreach ($all_product_subs as $subcat) {
             $sub_category = new Category((int) $subcat['id_category'], (int) $lang_id);
             $sub_category_path = $sub_category->getParentsCategories();
             foreach ($sub_category_path as $key) {
                 $result[] = $key['name'];
             }
         }
     }
     return implode(';', $result);
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:25,代码来源:yotpo.php

示例10: hookLeftColumn

 public function hookLeftColumn($params)
 {
     $from_category = Configuration::get('PS_HOME_CATEGORY');
     $all_categories = Category::getCategories($this->context->language->id, true, true, 'AND `c`.`hide_on_left` = \'0\'');
     $menu_categories = blockcategories::createMenuCategories($all_categories, $from_category, 1);
     if (Tools::getIsset('id_category')) {
         $current_category = new Category(Tools::getValue('id_category'));
     } else {
         if (Tools::getIsset('id_product')) {
             $product = new Product(Tools::getIsset('id_product'));
             $current_category = new Category($product->id_category_default);
         } else {
             $current_category = new Category($from_category);
         }
     }
     $current_tree = array_reverse($current_category->getParentsCategories());
     array_shift($current_tree);
     if (!empty($current_tree)) {
         $level = 1;
         $categories =& $menu_categories;
         $maxLevel = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
         do {
             $category = array_shift($current_tree);
             $categories[$category['id_category']]['open'] = true;
             if (empty($current_tree) || $level == $maxLevel) {
                 $categories[$category['id_category']]['current'] = true;
                 $this->context->smarty->assign('title', $categories[$category['id_category']]['name']);
             }
             if ($level < $maxLevel - 1) {
                 $categories[$category['id_category']]['childs'] = blockcategories::createMenuCategories($all_categories, $category['id_category'], $level);
                 $categories =& $categories[$category['id_category']]['childs'];
             }
             $level++;
         } while (!empty($current_tree) && $level < $maxLevel);
     }
     $this->context->smarty->assign('menu_categories', $menu_categories);
     $this->smarty->assign('branche_tpl_path', _PS_THEME_DIR_ . 'modules/blockcategories/category-tree-branch.tpl');
     return $this->display(__FILE__, 'blockcategories.tpl');
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:39,代码来源:blockcategories.php

示例11: makeMenu

 private function makeMenu()
 {
     $menu = '';
     $menu_items = $this->getMenuItems();
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     $head = $this->_itemHead;
     $tail = $this->_itemTail;
     foreach ($menu_items as $item) {
         if (!$item) {
             continue;
         }
         preg_match($this->pattern, $item, $value);
         $id = (int) substr($item, strlen($value[1]), strlen($item));
         switch (substr($item, 0, strlen($value[1]))) {
             case 'CAT':
                 $activeCategories = array();
                 $id_cat = (int) Tools::getValue('id_category', false);
                 if ($id_cat && $this->page_name == 'category') {
                     $categ = new Category($id_cat, $id_lang, $id_shop);
                     $activeCategories = $categ->getParentsCategories($id_lang);
                 }
                 $menu .= $this->generateCategoriesMenu(Category::getNestedCategories($id, $id_lang, true, $this->user_groups), $activeCategories, false);
                 break;
             case 'PRD':
                 $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' active' : '';
                 $product = new Product((int) $id, true, (int) $id_lang);
                 if (!is_null($product->id)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . Tools::HtmlEntitiesUTF8($product->getLink()) . '" title="' . $product->name . '"><span>' . $product->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="active"' : '';
                 $cms = CMS::getLinks((int) $id_lang, array($id));
                 if (count($cms)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . '"><a href="' . Tools::HtmlEntitiesUTF8($cms[0]['link']) . '" title="' . Tools::safeOutput($cms[0]['meta_title']) . '"' . $selected . '><span>' . Tools::safeOutput($cms[0]['meta_title']) . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS_CAT':
                 $selected = $this->page_name == 'cms' ? ' class="active"' : '';
                 $category = new CMSCategory((int) $id, (int) $id_lang);
                 if (count($category)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . '"><a href="' . Tools::HtmlEntitiesUTF8($category->getLink()) . '" title="' . $category->name . '"' . $selected . '><span>' . $category->name . '</span></a>';
                     $this->getCMSMenuItems($menu, $category->id);
                     $menu .= '</li>' . $tail . PHP_EOL;
                 }
                 break;
                 // Case to handle the option to show all Manufacturers
             // Case to handle the option to show all Manufacturers
             case 'ALLMAN':
                 $selected = $this->page_name == 'manufacturer' ? ' class="active"' : '';
                 $link = new Link();
                 $menu .= $head . '<li class="' . $this->_itemClass . '"><a href="' . $link->getPageLink('manufacturer') . '" title="' . $this->l('All manufacturers') . '"' . $selected . '><span>' . $this->l('All manufacturers') . '</span></a>';
                 $manufacturers = Manufacturer::getManufacturers();
                 $sub_menu_active = '';
                 $sub_menu = '';
                 foreach ($manufacturers as $key => $manufacturer) {
                     $id_man = (int) $manufacturer['id_manufacturer'];
                     $active = Tools::getValue('id_manufacturer') == $id_man ? ' class="active"' : '';
                     $sub_menu_active = empty($active) ? $sub_menu_active : ' active';
                     $sub_menu .= $this->_subItemHead . '<li class="' . $this->_subItemClass . '"><a href="' . $link->getManufacturerLink($id_man, $manufacturer['link_rewrite']) . '" title="' . Tools::safeOutput($manufacturer['name']) . '"' . $active . '><span>' . Tools::safeOutput($manufacturer['name']) . '</span></a></li>' . $this->_subItemTail . PHP_EOL;
                 }
                 $menu .= $this->_subMenuHead . '<ul class="' . $this->_subMenuClass . $sub_menu_active . '">' . $sub_menu . '</ul>' . $this->_subMenuTail;
                 $menu .= '</li>' . $tail;
                 break;
             case 'MAN':
                 $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="active"' : '';
                 $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . '"><a href="' . Tools::HtmlEntitiesUTF8($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '" title="' . Tools::safeOutput($manufacturer->name) . '"' . $selected . '><span>' . Tools::safeOutput($manufacturer->name) . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
                 // Case to handle the option to show all Suppliers
             // Case to handle the option to show all Suppliers
             case 'ALLSUP':
                 $selected = $this->page_name == 'supplier' ? ' class="active"' : '';
                 $link = new Link();
                 $menu .= $head . '<li class="' . $this->_itemClass . '"><a href="' . $link->getPageLink('supplier') . '" title="' . $this->l('All suppliers') . '"' . $selected . '><span>' . $this->l('All suppliers') . '</span></a>';
                 $suppliers = Supplier::getSuppliers();
                 $sub_menu_active = '';
                 $sub_menu = '';
                 foreach ($suppliers as $key => $supplier) {
                     $id_sup = (int) $supplier['id_supplier'];
                     $active = Tools::getValue('id_supplier') == $id_sup ? ' class="active"' : '';
                     $sub_menu_active = empty($active) ? $sub_menu_active : ' active';
                     $sub_menu .= $this->_subItemHead . '<li class="' . $this->_subItemClass . '"><a href="' . $link->getSupplierLink($id_sup, $supplier['link_rewrite']) . '" title="' . Tools::safeOutput($supplier['name']) . '"' . $active . '><span>' . Tools::safeOutput($supplier['name']) . '</span></a></li>' . $this->_subItemTail . PHP_EOL;
                 }
                 $menu .= $this->_subMenuHead . '<ul class="' . $this->_subMenuClass . $sub_menu_active . '">' . $sub_menu . '</ul>' . $this->_subMenuTail;
                 $menu .= '</li>' . $tail;
                 break;
             case 'SUP':
                 $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="active"' : '';
                 $supplier = new Supplier((int) $id, (int) $id_lang);
                 if (!is_null($supplier->id)) {
//.........这里部分代码省略.........
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:101,代码来源:blocktopmenu_mod.php

示例12: getCategoryPathsFromModel

 /**
  * returns the parent categories
  *
  * @param int $categoryId
  *
  * @return array
  */
 protected function getCategoryPathsFromModel($categoryId)
 {
     $categoryModel = new Category($categoryId, $this->getPlugin()->getLanguageId());
     return $categoryModel->getParentsCategories($this->getPlugin()->getLanguageId());
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:12,代码来源:Item.php

示例13: getCurrentCategoriesId

 public function getCurrentCategoriesId($lang_id = NULL)
 {
     if (isset($_GET['id_category'])) {
         $lastCateId = $_GET['id_category'];
     } else {
         $lastCateId = 0;
     }
     $lastCate = new Category((int) $lastCateId);
     //echo $lastCate->name[1]; echo '--------';
     $parentCate = $lastCate->getParentsCategories($lang_id);
     $arrayCateCurrent = array();
     foreach ($parentCate as $pcate) {
         $arrayCateCurrent[] = $pcate['id_category'];
     }
     return $arrayCateCurrent;
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:16,代码来源:posvegamenu.php

示例14: isParentCategoryProductDiscount

 public static function isParentCategoryProductDiscount($id_category_product, $id_category_discount)
 {
     $category = new Category(intval($id_category_product));
     $parentCategories = $category->getParentsCategories();
     foreach ($parentCategories as $parentCategory) {
         if ($id_category_discount == $parentCategory['id_category']) {
             return true;
         }
     }
     return false;
 }
开发者ID:sealence,项目名称:local,代码行数:11,代码来源:Discount.php

示例15: dirname

        foreach (Product::getIndexedCategories($product->id) as $row) {
            $category_ids[] = $row['id_category'];
        }
        $category_id = $product->id_category_default;
        if (isset($cookie->last_visited_category) && in_array(intval($cookie->last_visited_category), $category_ids)) {
            $category_id = intval($cookie->last_visited_category);
        }
        $category = new Category($category_id, intval($cookie->id_lang));
    }
    if (!$category && isset($cookie->last_visited_category)) {
        $category = new Category($cookie->last_visited_category, intval($cookie->id_lang));
    }
}
/* Theme */
$theme = _THEME_NAME_;
if ($category) {
    $category_path = $category->getParentsCategories(intval($cookie->id_lang), true);
    foreach ($category_path as $cat) {
        if ($cat['theme']) {
            $theme = $cat['theme'];
            break;
        }
    }
}
define('_THEME_IMG_DIR_', _THEMES_DIR_ . $theme . '/img/');
define('_THEME_CSS_DIR_', _THEMES_DIR_ . $theme . '/css/');
define('_THEME_JS_DIR_', _THEMES_DIR_ . $theme . '/js/');
define('_THEME_DIR_', _THEMES_DIR_ . $theme . '/');
define('_PS_THEME_DIR_', _PS_ROOT_DIR_ . '/themes/' . $theme . '/');
/* Smarty */
include dirname(__FILE__) . '/smarty.config.inc.php';
开发者ID:redb,项目名称:prestashop,代码行数:31,代码来源:config.inc.php


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