Hey, we're running Magento 1.4.0.1 and would like to hide active categories fro开发者_开发技巧m the navigation. When we do this, the parent category's URL 404s but all the children categories' URLs are still valid.
i.e.
magentostore.ex/brands/company is valid
magentostore.ex/brands is not
We would like magentostore.ex/brands to point to a page, but we don't want a tab saying "Brands" in our top-level navigation.
How can we hide the parent from navigation while keeping it active? Thanks!
Be very careful of rushing into an upgrade to 1.4.1.0 - there were some major changes, particularly to the Sales_Order modules. Any extensions that you have related to Orders may break.
One option is to create a version of the Mage_Catalog_Block_Navigation file under app/code/local (do not edit the core directly!) and override the drawItem function to exclude that category from the navigation. It requires writing some PHP, but not particularly difficult to copy/paste the existing code and add your condition.
Something like this at the top of the function should work (keep in mind that this function is recursive... and check your regex!!)
if(preg_match('/\b(brands)/i',$category->getName())!=0){
return '';
}
Well, it's a bit of a cop-out, but we just upgraded to 1.4.1.0 from 1.4.0.1 and the "Include in Navigation Menu" option has been returned to the Category properties. This solves our problem. We can now keep the category from appearing in the top-level navigation while retaining the possibility of a landing page. EDIT: JD's solution is a better solution.
Have you tried going through the CMS and making a page with a SEF URL Identifier of "brands" ? That should achieve what you would like, if I'm understanding correctly.
精彩评论