// maj
This commit is contained in:
@@ -167,10 +167,20 @@ class BlockCategories extends Module
|
||||
$id_lang = (int)($params['cookie']->id_lang);
|
||||
$smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
|
||||
|
||||
Tools::enableCache();
|
||||
/*Tools::enableCache();
|
||||
if (!$this->isCached('blockcategories.tpl', $smartyCacheId))
|
||||
{
|
||||
{*/
|
||||
$maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
|
||||
/*p('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
||||
AND cg.`id_group` IN ('.pSQL($groups).')
|
||||
GROUP BY id_category
|
||||
ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC'));*/
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
@@ -193,10 +203,10 @@ class BlockCategories extends Module
|
||||
$resultParents[$row['id_parent']][] = &$row;
|
||||
$resultIds[$row['id_category']] = &$row;
|
||||
}
|
||||
|
||||
//p($resultParents);
|
||||
$blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
|
||||
unset($resultParents, $resultIds);
|
||||
|
||||
//d($blockCategTree);
|
||||
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
|
||||
if (Tools::isSubmit('id_category'))
|
||||
{
|
||||
@@ -220,7 +230,7 @@ class BlockCategories extends Module
|
||||
else
|
||||
$this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
|
||||
$this->context->smarty->assign('isDhtml', $isDhtml);
|
||||
}
|
||||
//}
|
||||
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
$display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId);
|
||||
Tools::restoreCacheSettings();
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
*}
|
||||
|
||||
<li {if isset($last) && $last == 'true'}class="last"{/if}>
|
||||
<a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a>
|
||||
<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
|
||||
{if $node.children|@count > 0}
|
||||
<ul>
|
||||
{foreach from=$node.children item=child name=categoryTreeBranch}
|
||||
{if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last}
|
||||
{if $smarty.foreach.categoryTreeBranch.last}
|
||||
{include file="$branche_tpl_path" node=$child last='true'}
|
||||
{else}
|
||||
{include file="$branche_tpl_path" node=$child last='false'}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 165 B |
Reference in New Issue
Block a user