By the normal way, you can get a block by using object Layout.

For example,  in a controller:

$this->getLayout()->createBlock('module_name/block_name');

It is the same with a block or a template file.
But if you want to get a block in a helper, model or anywhere, what way?
In this case, you can use:

Mage::app()->getBlockSingleton('module_name/block_name');

Related Tutorials:

Author

Alex is the CTO & Co-founder of Magestore which has been providing retail solutions for Magento merchants since 2009. He started as a Magento developer just one year after the release of the first version of Magento. With over 10 years experience of working with Magento and clients all over the world, he gained great knowledge on e-commerce development, order management systems, inventory control & retail POS.

Write A Comment