Jump to content

Category on header menu


Recommended Posts

Hi guys,

 

I'm new to prestashop so if my questions sound silly, please don't get upset.

 

I have three questions to ask.

 

1) How do I get categories to display on header menu.

2) How do I take off side category menu on home page.

3) How do I display only subcategories of the selected parent category by the side.

 

These are my questions for now. Also if these questions have been asked before and solutions were please send me the links

 

Thanks for you help.

  • Like 1
Link to comment
Share on other sites

Hello,

 

1. the category block module needs to be hooked to the header

2. if it is hooked only to the header it will not be displayed at all in the columns

3. use the 'getSubCategories' method of Category class.

 

In your case, if you want only the subcategories to be displayed,you will need to add an exception to block categories, this requires a lot of extra coding to do.

Link to comment
Share on other sites

Sorry, I don't want to hijack the thread, but you say the module needs to be hooked to the header, so if I accidentally unhook it from the header (which I did), how do I get it back?

 

EDIT: Nevermind, I figured it out. For anyone wonder, go into Modules > Positions and click "Transplant a module," you can also go into the module list and click "Reset" on the module you want to rehook.

Link to comment
Share on other sites

Thanks guys I have figured out adding category on header menu but my problems still havent finished. I'm still trying to figure out how to display subcategories of the selected parent category by the side.

 

I have about 10 categories and more than 100 sub categories that drops down . So I want when a category is selected is selected from the menu, all the subcat of that category will display.

Link to comment
Share on other sites

Hello,

 

You need to create a new instance of the Category class:

 

$category = new Category([CATEGORY_ID], [LANGUAGE_ID]);

 

Then you can get the list of subcategories:

 

$subcategories = $category->getSubCategories([LANGUAGE_ID])

 

Assign the $subcategories to smarty and process it with {foreach} in the template file.

 

[CATEGORY_ID] = retrieved from URL, eg. Tools::getValue("id_category")

[LANGUAGE_ID] = retrieved from cookies, eg. $cookie->id_lang

Link to comment
Share on other sites

  • 2 weeks later...

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