Tuesday, December 3, 2013

Category sub-levels number in prestashop

This tutorial shows how to manage number of displayed category levels in PrestaShop categories menu. Categories menu in PrestaShop is created using tmcategries module. So we need to edit this module to set the number of sub-levels.


Open modules\tmcategories\tmcategories.tpl file


Replace the existing code:



foreach from=$blockCategTree.children item=child name=blockCategTree
if $smarty.foreach.blockCategTree.last
include file="$branche_tpl_path" node=$child last='true'
else
include file="$branche_tpl_path" node=$child
/if
/foreach

 



with the following



foreach from=$blockCategTree.children item=child name=blockCategTree
if $smarty.foreach.blockCategTree.index < 5
if $smarty.foreach.blockCategTree.last
include file="$branche_tpl_path" node=$child last='true'
else
include file="$branche_tpl_path" node=$child
/if
/if
/foreach

 



Where value 5 in the condition if $smarty.foreach.blockCategTree.index < 5 is the number of submenu levels allowed



Category sub-levels number in prestashop

No comments:

Post a Comment