0

I am trying to implement some dynamic remarketing on for my magento store. Currently every page on my site is listed the exact same as opposed to ‘product page’, ‘cart page’, etc.

In order to properly implement the dynamic remarketing I need each of these page types (home, category, product, cart, purchase) to be defined like this:

<body id="product" class="product product-580 product-gerber-river-shorty-knife category-172 category-knives hide-left-column hide-right-column lang_en">

I am new to magento and am not sure where to look. I found this thread Getting current admin username into <body> class or id and think it's on the right track but i'm not really sure.

Here is an example of a store that implements what I mean although i don't think it's run on the magento platform. https://www.roofrackscalgary.com/store/113-base-racks

1
  • You are familiar with php and basic OOP concepts? The choice you linked is easily adjustable for front-end pages, if you are explained some Magento code concepts, but if that doesn't help you, I can add some more detail.
    – user4351
    Apr 10, 2015 at 18:06

1 Answer 1

1

What you want to do is add css class to the body.

You can add css class by getting the body like this:

Mage::app()->getLayout()->getBlock('root')->addBodyClass()

Have a look into \Mage_Page_Block_Html::addBodyClass to make sure you understand the little magic the method is doing, it lowercases everything and then replaces all characters which are not a-z0-9 with a dash -.

This method can be done everywhere, I recommend to implement a bunch of observers on events, where you know what type of page you are dealing with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.