2

I am trying to update order summary block on payment method change but it display

Fatal error: Call to a member function toHtml() on boolean in C:\xampp\htdocs\young\app\code\local\Mage\Checkout\controllers\OnepageController.php on line 172

170 protected function _getReviewHtml()
171 {
172    return $this->getLayout()->getBlock('root')->toHtml();
173 }


public function orderupdateAction()
{
    if ($this->_expireAjax()) {
        return;
    }
    $result['goto_section'] = 'review';
    $result['update_section'] = array(
        'name' => 'review',
        'html' => $this->_getReviewHtml()
    );
    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
4

This will be an issue with the layout.xml and your custom controller action.

Magento cannot find the root block for your action and fatals when trying to call toHtml on it.

Adding the following to create an empty root block into your checkout.xml layout should allow you to not fatal.

<checkout_onepage_orderupdate>
    <block name="root" type="core/template"/>
</checkout_onepage_orderupdate>

(Obviously if you want _getReviewHtml to return something viable you will have to pop a valid block in the layout definition, as currently it will just return nothing)

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.