RawDev.net - Just another Zabreznik.si Sites site
Home - Mail - About

Archive for the Category "Magento"

Magento Category Style

Thursday, February 19th, 2009 by Marko Zabreznik

Its frequent that a webpage needs styles specific to categories, like one background for Store, another for Company info etc… But Magento fails in that area unless you want to make specific designs for each section you are out of luck.

CSS might be the ansver trough. The only thing missing is a class that each section has.
addBodyClass(‘category-’.Mage::getBlockSingleton(‘catalog/navigation’)
->getCurrentCategory()
->getParentCategory()
->getUrlKey()
);
?>
This piece of code adds the urlkey of the current categories parent category inside body’s class tag. And the class added is the same that is present on the parent page of the category. How cool is that :D

For pages with multiple level childs, it is also possible to loop that untill you get to the top parent.

Posted in Magento - 2 Comments