How to call a Block Class Method from a View

Last modified by slith on Thu, June 24, 2010 17:15
Source|Old Revisions  

this is assuming you have a method called getItems()

 $className = Mage::getConfig()->getBlockClassName('mycompany_catalog/product_list');
 $block = new $className();               
 $block->_prepareData();
 if($block->getItems()->getSize()){
     $items = $block->getItems();  
     foreach($items as $_item){
     // your code...
     }
 }



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs