How to call a Block Class Method from a View


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $className = Mage::getConfig()->getBlockClassName('mycompany_catalog/product_list');
  2. $block = new $className();
  3. $block->_prepareData();
  4. if($block->getItems()->getSize()){
  5. $items = $block->getItems();
  6. foreach($items as $_item){
  7. // your code...
  8. }
  9. }

URL: http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/call_class_method_from_view

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.