Jump to content

[Unsolved] How to limit the number # of categories shown on front page and left column?


Recommended Posts

  • 2 weeks later...

I suggest that you set the "Maximum depth" on the configuration page of the "Categories block" to 1 so that only the top-level categories are displayed, then change line 112 of modules/blockcategories/blockcategories.php from:

ORDER BY `level_depth` ASC, cl.`name` ASC'))



to:

ORDER BY `level_depth` ASC, cl.`name` ASC LIMIT 0, 6'))



This should display 5 categories only. You can then edit modules/blockcategories/blockcategories.tpl and add the following after line 15 (the ):


getCategoryLink(1, 'home')}">{l s='More...' mod='blockcategoriesnc'}

Link to comment
Share on other sites

  • 1 year later...

Hey Rocky, thank you very very much for your help.

 

I have never coded before but as my blockcategories.php was different from above, here is how I got my clients shop to display only 4 main categories.

 

 

blockcategories.php contained:

 

 

ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC'))

 

 

 

Changed to the following:

 

ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC LIMIT 5'))

 

 

 

If i have got this wrong, please let me know :)

 

Thanks

 

www.fantasy-costumes.co.uk

Link to comment
Share on other sites

  • 5 years later...

Hi Rocky,

 

The first line works:

 

ORDER BY `level_depth` ASC, cl.`name` ASC LIMIT 0, 6'))

 

But the second line seems to be not working, 

 

<p><a >getCategoryLink(1, 'home')}">{l s='More...' mod='blockcategoriesnc'}</a></p>

 

Where will you put the line in our blockcategories.tpl?

=================

{if $blockCategTree && $blockCategTree.children|@count}

<!-- Block categories module -->
<div id="categories_block_left" class="block">
  <h2 class="title_block">
    {if isset($currentCategory)}
        {$currentCategory->name|escape}
    {else}
        {l s='Categories' mod='blockcategories'}
    {/if}
</h2>
<div class="block_content">
    <ul class="tree {if $isDhtml}dhtml{/if}">
        {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}
    </ul>
  </div>
</div>
<!-- /Block categories module -->
{/if}
==========================
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...