$_helper = $this->helper('catalog/output');

i received this error on browser when I run the code.

Using $this when not in object context in C:\xampp\htdocs\magento\test.php

What should i do for this .


you should have this:

        $app = Mage::app();

Basically the $this->helper is calling the function that is contained inside the current template's block class. The Mage::helper is calling the function in the "God" class.

The $this->helper normally calls a function in the class Mage_Core_Block_Abstract which checks the layout for a helper and then simply calls the normal Mage::helper if it cannot find one.


I think you are creating a stand alone script.

so you can try below things to work

require_once("$Magento_Root_DIR/app/Mage.php"); // include Mage.php file 
$app = Mage::app(); //init Mage::app()
$_helper = Mage::helper('catalog/output'); //calling helper class

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.