How to make magento use a different category than the "Default Category" to generate the-nav header?

I have 4 categories in the "Default Category" category. Currently, by default, Magento generates a nav header from the "Default Category" and displays 4 categories at the top of my site. The Products category is in the Default Cateogry. In the "Products" category are subcategories that I want to display in the top navigation bar.

Default Category:

  • Products
  • Featured Products
  • Featured Products
  • Applications

Setting up a product / category is what was given to me in this project, and this is what I want to do without redoing (since there are already several hundred products). If I started from scratch, the product / category setting would be different.

In app / code / core / Mage / Catalog / Block / Navigation.php, I found that the menu is created using the getStoreCategories() function, which apparently removes everything from the "Default Category" category.

So, I think that I am looking for 1 of 3 solutions:

  • Inside the Magento admin, you can choose which category to use to create the top menu.

  • Which function to use, not getStoreCategories , so I can specify the parent category and change app / code / core / Mage / Catalog / Block / Navigation.php

  • Or is this something that I can manipulate somewhere in the XML layout files along with the custom part of the template, if necessary.

Any suggestions would be greatly appreciated. Thank you in advance.

+4
source share
2 answers

In the configuration of the site store, you can select the "root" category to use as a store category layout. Please note that only root categories can be selected for this. Please change your message so that you intend here if you need additional help in structuring your categories.

Go to the system → Store Management and click one of the links in the "Store Name" section

+3
source

You can also specify the identifier of the root category used for the main navigation by changing the file located in:

 app > code > core > Mage > Catalog > Helper > Category.php 

Looks for the function "getStoreCategories ()" and change

 $parent = Mage::app()->getStore()->getRootCategoryId(); 

with the identifier of your root category

 $parent = YOUR-ID; 

Everything works great for me with this trick.

-1
source

Source: https://habr.com/ru/post/1315136/


All Articles