Subcategories -> Categories

Hi, please see the attached images. How to fulfill these empty spaces? Is it possible just to delete the line breaks?


Cell heights are equal to the height of the cell with highest amount of 3rd level categories. I can only suggest you to review categories tree or pay attention to 3rd party menus on the marketplace

Is it possible to put there any images? Because it is like empty box

Yes it is, it is a basic functionality in the grid view and you could customize it to show an image if the data of the third level is empty.

Yes it is, it is a basic functionality in the grid view and you could customize it to show an image if the data of the third level is empty.

Thanks for your respond. Could you please explain this process step by step?

Thanks for your respond. Could you please explain this process step by step?

Hello,

First you will need to go the the respective category and upload the image.

After that you go to the template editor and go to [THEME]/templates/blocks/top_menu.tpl.

Now what you do is detect whether there is a second level item which can be done by using the smarty tag {if $item1.$childs} (assuming your code looks like blow):

Now what you do is give that item an {else} tag and import the category image and the url (because when people click on the image you want them to be redirected:

{assign var="cat_image" value=$item1.category_id|fn_get_image_pairs:'category':'M':true:true}
{assign var="item1_url" value=$item1|fn_form_dropdown_object_link:$block.type}

Next, we add the following code snippet in the {else} tag:

{if $cat_image.pair_id}
    
{include file="common/image.tpl" images=$cat_image.detailed}
{/if}

Now the only thing left to do is apply proper styling in the stylesheet, however, I think you will manage to do that by yourself.

Kind regards,

{foreach from=$items item="item1" name="item1"}
            {assign var="item1_url" value=$item1|fn_form_dropdown_object_link:$block.type}
            {assign var="unique_elm_id" value=$item1_url|md5}
            {assign var="unique_elm_id" value="topmenu_`$block.block_id`_`$unique_elm_id`"}
        {if $subitems_count}

        {/if}
        
  • {if $item1.$childs} {/if} {$item1.$name} {if $item1.$childs} {if !$item1.$childs|fn_check_second_level_child_array:$childs} {* Only two levels. Vertical output *}
      {hook name="blocks:topmenu_dropdown_2levels_elements"} {foreach from=$item1.$childs item="item2" name="item2"} {assign var="item_url2" value=$item2|fn_form_dropdown_object_link:$block.type}
    • {$item2.$name}
    • {/foreach} {if $item1.show_more && $item1_url} {/if} {/hook}
    {else}
    {hook name="blocks:topmenu_dropdown_3levels_cols"}
      {foreach from=$item1.$childs item="item2" name="item2"}
    • {assign var="item2_url" value=$item2|fn_form_dropdown_object_link:$block.type}
      {$item2.$name}
      {if $item2.$childs} {/if}
        {if $item2.$childs} {hook name="blocks:topmenu_dropdown_3levels_col_elements"} {foreach from=$item2.$childs item="item3" name="item3"} {assign var="item3_url" value=$item3|fn_form_dropdown_object_link:$block.type}
      • {$item3.$name}
      • {/foreach} {if $item2.show_more && $item2_url} {/if} {/hook} {/if}
    • {/foreach} {if $item1.show_more && $item1_url}
    • {__("text_topmenu_more", ["[item]" => $item1.$name])}
    • {/if}
    {/hook}
    {/if} {/if}
  • {/foreach}

    Hello,

    First you will need to go the the respective category and upload the image.

    After that you go to the template editor and go to [THEME]/templates/blocks/top_menu.tpl.

    Now what you do is detect whether there is a second level item which can be done by using the smarty tag {if $item1.$childs} (assuming your code looks like blow):

    Now what you do is give that item an {else} tag and import the category image and the url (because when people click on the image you want them to be redirected:

    {assign var="cat_image" value=$item1.category_id|fn_get_image_pairs:'category':'M':true:true}
    {assign var="item1_url" value=$item1|fn_form_dropdown_object_link:$block.type}
    

    Next, we add the following code snippet in the {else} tag:

    {if $cat_image.pair_id}
        
    {/if}
    

    Now the only thing left to do is apply proper styling in the stylesheet, however, I think you will manage to do that by yourself.

    Kind regards,

    {foreach from=$items item="item1" name="item1"}
                {assign var="item1_url" value=$item1|fn_form_dropdown_object_link:$block.type}
                {assign var="unique_elm_id" value=$item1_url|md5}
                {assign var="unique_elm_id" value="topmenu_`$block.block_id`_`$unique_elm_id`"}
    
            {if $subitems_count}
    
            {/if}
            
  • {if $item1.$childs} {/if} {$item1.$name} {if $item1.$childs} {if !$item1.$childs|fn_check_second_level_child_array:$childs} {* Only two levels. Vertical output *}
      {hook name="blocks:topmenu_dropdown_2levels_elements"} {foreach from=$item1.$childs item="item2" name="item2"} {assign var="item_url2" value=$item2|fn_form_dropdown_object_link:$block.type}
    • {$item2.$name}
    • {/foreach} {if $item1.show_more && $item1_url} {/if} {/hook}
    {else}
    {hook name="blocks:topmenu_dropdown_3levels_cols"}
      {foreach from=$item1.$childs item="item2" name="item2"}
    • {assign var="item2_url" value=$item2|fn_form_dropdown_object_link:$block.type}
      {$item2.$name}
      {if $item2.$childs} {/if}
        {if $item2.$childs} {hook name="blocks:topmenu_dropdown_3levels_col_elements"} {foreach from=$item2.$childs item="item3" name="item3"} {assign var="item3_url" value=$item3|fn_form_dropdown_object_link:$block.type}
      • {$item3.$name}
      • {/foreach} {if $item2.show_more && $item2_url} {/if} {/hook} {/if}
    • {/foreach} {if $item1.show_more && $item1_url}
    • {__("text_topmenu_more", ["[item]" => $item1.$name])}
    • {/if}
    {/hook}
    {/if} {/if}
  • {/foreach}

    I could not fint top_menu.tpl. May be it is topmenu_dropdown.tpl ?

    I could not fint top_menu.tpl. May be it is topmenu_dropdown.tpl ?

    Yes correct.

    Hello

    I have another question...

    How can i change the size of image from drop menu?

    This is it

    http://prntscr.com/j0472e

    Any ideea?

    I try from topmenu_dropdown.tpl ti change this

    {include file="common/image.tpl" images=$cat_image.detailed image_width=137 image_height=137 vs_lazy_additional=true}
    But is not working.
    Thx