I'm trying to load a layout and set my custom phtml after the cart page.
But when I put the directives to load the layout, I have the following error:
Fatal error: Call to a member function getRequestedRouteName() on a non-object in /var/www/html/magento/edubras.dev/html/app/code/core/Mage/Core/Controller/Varien/Action.php on line 226
config.xml:
<?xml version="1.0"?>
<config>
<modules>
<GrupoNDB_EmailCatcher>
<version>0.0.1</version>
</GrupoNDB_EmailCatcher>
</modules>
<global>
<blocks>
<grupondb_emailcatcher>
<class>GrupoNDB_EmailCatcher_Block</class>
</grupondb_emailcatcher>
</blocks>
<helpers>
<grupondb_emailcatcher>
<class>GrupoNDB_EmailCatcher_Helper</class>
</grupondb_emailcatcher>
</helpers>
<models>
<grupondb_emailcatcher>
<class>GrupoNDB_EmailCatcher_Model</class>
</grupondb_emailcatcher>
</models>
<events>
<controller_action_predispatch_onestepcheckout_index_index>
<observers>
<grupondb_emailcatcher>
<class>grupondb_emailcatcher/observer</class>
<method>displayEmailCatcherPage</method>
</grupondb_emailcatcher>
</observers>
</controller_action_predispatch_onestepcheckout_index_index>
</events>
</global>
</config>
My observer code:
<?php
class GrupoNDB_EmailCatcher_Model_Observer {
public function __construct() {
}
public function displayEmailCatcherPage($observer) {
$frontA = new Mage_Core_Controller_Front_Action;
$frontA->loadLayout()->getLayout();
$eCookie = Mage::getModel('core/cookie')->get("email");
if( $eCookie == 'none'|| !isset($eCookie) || empty($eCookie) ) {
echo Mage::app()->getLayout()->createBlock('core/template')->setTemplate('grupondb/email-catcher/cadastroEmail.phtml')->toHtml();
die;
}
// Call the block to fill the fields in checkout
echo Mage::app()->getLayout->createBlock('core/template')->setTemplate('grupondb/email-catcher/set-email-field.phtml')->toHtml();
}
}
Someone can help me with this?
Cheers!