Fatal error: Call to a member function setTitle() on a non-object
When I try to pl开发者_如何转开发acing an order, while selecting the shipping method an error is getting saying
Fatal error: Call to a member function setTitle() on a non-object in /home/exclus31/public_html/../../../app/code/core/Mage/Customer/Block/Form/Login.php on line 40
But there is no problem for placing the order and got the confirmation message for the particular order.
Any one know why this error is shown and a solution for this?
I had this error as well. It was because I was calling getLayout()
in my IndexAction()
before I had loaded the layout. Just call loadLayout()
first, like so:
public function IndexAction() {
$this->loadLayout(); // do this first
$this->getLayout()->getBlock('head')->setTitle($this->__('My Title')); // then this works
$this->renderLayout(); // render as usual
}
I hope this helps
精彩评论