|
Hi, i was fooling around trying to understand the way to overriding magento methods (so i wouldn’t need to hack core files each time).
I’ve chosen to override getToolbarBlock() of Product list.
My files:
/app/etc/modules/Testcompany_All.xml
<?xml version="1.0"?> <config> <modules> <Testcompany_Catalog> <active>true</active> <codePool>local</codePool> </Testcompany_Catalog> </modules> </config>
app/code/local/Testcompany/Catalog/Block/Product/List.php
<?php class Testcompany_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List { public function getToolbarBlock() { $test = ""; if ($blockName = $this->getToolbarBlockName()) { if ($block = $this->getLayout()->getBlock($blockName)) { return $block; } } $block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime()); return $block; } }
app/code/local/Testcompany/etc/config.xml
<?xml version="1.0" ?> <config> <global> <blocks> <catalog> <rewrite> <product_list>Testcompany_Catalog_Block_Product_List</product_list> </rewrite> </catalog> </blocks> </global> </config>
But it seems that i’m missing something since it doesn’t work. Any ideas?
Thx in advance
|