Merge pull request #31 from tchauviere/feat/admin-hidden-categories-management

Feat/admin hidden categories management
This commit is contained in:
Jérôme Nadaud
2015-06-26 14:24:43 +02:00
+8 -3
View File
@@ -479,7 +479,7 @@ class Blocktopmenu extends Module
switch (substr($item, 0, strlen($value[1]))) switch (substr($item, 0, strlen($value[1])))
{ {
case 'CAT': case 'CAT':
$this->_menu .= $this->generateCategoriesMenu(Category::getNestedCategories($id, $id_lang, true, $this->user_groups)); $this->_menu .= $this->generateCategoriesMenu(Category::getNestedCategories($id, $id_lang, false, $this->user_groups));
break; break;
case 'PRD': case 'PRD':
@@ -609,6 +609,11 @@ class Blocktopmenu extends Module
else else
$link = $this->context->link->getPageLink('index'); $link = $this->context->link->getPageLink('index');
/* Whenever a category is not active we shouldnt display it to customer */
if ((bool)$cat->active === false) {
break;
}
$html .= '<li'.(($this->page_name == 'category' $html .= '<li'.(($this->page_name == 'category'
&& (int)Tools::getValue('id_category') == (int)$category['id_category']) ? ' class="sfHoverForce"' : '').'>'; && (int)Tools::getValue('id_category') == (int)$category['id_category']) ? ' class="sfHoverForce"' : '').'>';
$html .= '<a href="'.$link.'" title="'.$category['name'].'">'.$category['name'].'</a>'; $html .= '<a href="'.$link.'" title="'.$category['name'].'">'.$category['name'].'</a>';
@@ -1161,7 +1166,7 @@ class Blocktopmenu extends Module
$shops_to_get = Shop::getContextListShopID(); $shops_to_get = Shop::getContextListShopID();
foreach ($shops_to_get as $shop_id) foreach ($shops_to_get as $shop_id)
$html .= $this->generateCategoriesOption($this->customGetNestedCategories($shop_id, null, (int)$this->context->language->id, true), $items); $html .= $this->generateCategoriesOption($this->customGetNestedCategories($shop_id, null, (int)$this->context->language->id, false), $items);
$html .= '</optgroup>'; $html .= '</optgroup>';
// BEGIN Shops // BEGIN Shops
@@ -1206,7 +1211,7 @@ class Blocktopmenu extends Module
} }
public function customGetNestedCategories($shop_id, $root_category = null, $id_lang = false, $active = true, $groups = null, $use_shop_restriction = true, $sql_filter = '', $sql_sort = '', $sql_limit = '') public function customGetNestedCategories($shop_id, $root_category = null, $id_lang = false, $active = false, $groups = null, $use_shop_restriction = true, $sql_filter = '', $sql_sort = '', $sql_limit = '')
{ {
if (isset($root_category) && !Validate::isInt($root_category)) if (isset($root_category) && !Validate::isInt($root_category))
die(Tools::displayError()); die(Tools::displayError());