I have the following in my local.xml, to add a body class for logged in users (for styling purposes):

    <reference name="root">
        <action method="addBodyClass">

Works fine, however, I've now noticed that it kills the checkout at the "Payment Information" step, with the following popup error:

Unable to set Payment Method.

Anyone know why?

UPDATE: The logs show the following error:

exception 'Varien_Exception' with message 'Invalid method Mage_Checkout_Block_Onepage_Review_Info::addBodyClass(Array
    [0] => logged-in

I don't need that body class on the checkout, so is there perhaps some way to only apply this class to certain areas? Namely the cart page.

  • The exception that is thrown with this error should be logged somewhere. If you have logging enabled I would suggest you look into these files for a more detailed error message – David Manners Jun 20 '14 at 14:14
  • which pages do you what this class to be added on? – David Manners Jun 20 '14 at 14:26
  • It's really just for the cart page (checkout/cart/ or <checkout_cart_index>) – Marlon Creative Jun 20 '14 at 14:36

One possible option would be to create an observer that listens to the event controller_action_layout_generate_blocks_after. It would need to check that the action is only the one you desire and and then it could add the class if the user is logged in

if ($root = $this->getLayout()->getBlock('root')) {

The reason you get the error is that the block Mage_Checkout_Block_Onepage_Review_Info does not extend the class Mage_Page_Block_Html which has the function addBodyClass.

  • Thanks for that. I guess another way would be to extend the Mage_Page_Block_Html class and then add an if($this->helper('customer')->isLoggedIn()){$this->addBodyClass("logged-in");} – Marlon Creative Jun 20 '14 at 15:19
If_logged(true) == $this->addClass_body{
     var getCustomerStatus('Block(Referenced)');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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