Thursday, April 2, 2015

Magento Overriding My Downloadable Products Block

EDIT Configuration file app/code/local/<NameSpace>/<Module>/etc/config.xml
==================================================
<config>
<global>
    <blocks>
            <modulename>
                <class><NameSpace>_<Module>_Block</class> <!--this is a new block page for that custom module-->
            </module>
            <downloadable>
                <rewrite>
                    <customer_products_list><NameSpace>_<Module>_Block_Products_List</customer_products_list>
                </rewrite>
            </downloadable>
        </blocks>
</global>
</config>
==================================================
Class app/code/local/<NameSpace>/<Module>/Block/Products/List.php
==================================================
<?php
class <NameSpace>_<Module>_Block_Products_List extends Mage_Downloadable_Block_Customer_Products_List
{
  public function _toHtml()
  {
    $this->setTemplate('<module>/products/list.phtml');

    return parent::_toHtml();
  }
}
==================================================
PHTML
copy app/design/frontend.base/default/template/downloadable/product/list.phtml to
app/design/frontend/base/default/template/<module>/product/list.phtml
and do the layout modifications as you want.

No comments:

Post a Comment