magento - Can't render layout with observer event -


i'm trying load layout , set custom phtml after cart page.

but when put directives load layout, have following error:

fatal error: call member function getrequestedroutename() on 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 block fill fields in checkout         echo mage::app()->getlayout->createblock('core/template')->settemplate('grupondb/email-catcher/set-email-field.phtml')->tohtml();       }  } 

someone can me this?

cheers!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -