Jump to content

Subcategories in Dropdown menu


Recommended Posts

Hi,

I was wondering if there was a way to put the subcategories into a dropdown menu, but only on the 4th level depth.

For example I have a site and the category structure is as follows:

Laptop Batteries (1st level)->Acer (2nd level)->TravelMate (3rd level)->200 (4th level).

The problem is that in some categories the 4th level could have hundreds of subcategories, see example:
http://prestashop.ltmnd.com/4303-travelmate

What I'd like to do is to have the 1st to 3rd categories to display as normal, but the 4th level to be displayed as a dropdown menu.

Is this possible and if so, how do I do it?

Thanks,
Shannon

p.s. I'd like to offer a search option on the subcategories page that will search the category names. The current search only searches for product name/description.

Link to comment
Share on other sites

I would settle for all subcategories on all levels in a dropdown menu if this is possible. I'm open to other suggestions. I just need a way to make such a high number of subcategories to look more professional and practical.

If you can help it would be appreciated.

Shannon

Link to comment
Share on other sites

In that case, I think you can simply rewrite the subcategory code as a dropdown. For example, change lines 32-53 of category.tpl from:

{if isset($subcategories)}
<!-- Subcategories -->

{l s='Subcategories'}

   {foreach from=$subcategories item=subcategory}

           <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
               {if $subcategory.id_image}
                   <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
               {else}
                   <img src="{$img_cat_dir}default-medium.jpg" alt="" />
               {/if}



           <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}

   {/foreach}




{/if}



to:

{if isset($subcategories)}

{l s='Choose subcategory'}
   {foreach from=$subcategories item=subcategory}
{$subcategory.name|escape:'htmlall':'UTF-8'}
   {/foreach}

{/if}



I haven't actually tested this code though. Hopefully, it will work.

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...