Search code examples
cs-cart

Cs-cart category menu descriptions


I am trying to show category description in category menu. Under each category link i would like to display a short description that is added through admin when creating the category. This is the code in the tpl that displays the category menu:

{hook name="blocks:sidebox_dropdown"}{strip}
{assign var="foreach_name" value="item_`$iid`"}

{foreach from=$items item="item" name=$foreach_name}

{hook name="blocks:sidebox_dropdown_element"}

<li class="{if $separated && !$smarty.foreach.$foreach_name.last}b-border {/if}{if $item.$childs}dir{/if}{if $item.active || $item|fn_check_is_active_menu_item:$block.type} cm-active{/if}">
    {if $item.$childs}

        {hook name="blocks:sidebox_dropdown_childs"}

        <div class="hide-border">&nbsp;</div>
        <ul>
            {include file="blocks/sidebox_dropdown_chiled.tpl" items=$item.$childs separated=true submenu=true iid=$item.$item_id}
        </ul>

        {/hook}

    {/if}
    {assign var="item_url" value=$item|fn_form_dropdown_object_link:$block.type}

    <a{if $item_url} href="{$item_url}"{/if} {if $item.new_window}target="_blank"{/if} class="my_main_navlinks">{$item.$name}</a>
</li>

{/hook}

{/foreach}
{/strip}{/hook}

Solution

  • It is not a right way to change the sidebox_dropdown.tpl file, because this file is used everywhere.

    The right way is to create a new block template for categories. Open this folder: /design/themes/[YOUR_SKIN]/templates/blocks/categories/

    You will find (basically) 4 files:

    • categories_dropdown_horizontal.tpl
    • categories_dropdown_vertical.tpl
    • categories_multicolumn_list.tpl
    • categories_text_links.tpl

    Create a new one and add any code you need. Put the sidebox_dropdown.tpl code inside your new file too.

    After that just open Admin area -> Design -> Layouts. Open properties of the categories block and select your new file.