Call to a member function insert() on a non-object Magento -


i using observer event in custom module's config.xml

<controller_action_layout_render_before>                 <observers>                     <test_check_model_observer>                         <class>test_check_helper_data</class>                         <method>checkvalidi</method>                     </test_check_model_observer>                 </observers> </controller_action_layout_render_before> 

now in test/check/helper/data checkvalidi method inserting block in content.

>

 class test_check_helper_data extends mage_core_helper_abstract { >   public function checkvalidi($observer) { >         $layout = mage::app()->getlayout(); >         $content = $layout->getblock('content'); >         $block = 'hello! working'; >         $content->insert($block); >     } 

but in frontend when filling checkout billing , other information gives me error call member function insert() on non-object in right side bar of checkout progress ,please give me solution thanks

if @ layout of checkout module checkout.xml can see handles not have content block. eg, checkout_onepage_progress_billing or checkout_onepage_progress_shipping

so, non-object error code. think should check $block variable before calling method.

      $layout = mage::app()->getlayout();       $content = $layout->getblock('content');        if ($content) {           $block = 'hello! working';           $content->insert($block);       }  

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -