I am writing a module to extend the Core/Catalog/Product/View/Media.php class so I can expose new methods in my template. I followed a number of guides online, including Alan Storms excellent series, but have had little success. ( http://alanstorm.com/magento_config )
I posted my code on Github: https://github.com/razialx/Magento-Overwrite-Block
I am not getting any errors in the logs, it just isn't loading my class. Very perplexed.
One thought I had was that I may only be able to rewrite classes that are explicitly defined. I know the Mage_Catalog_Block_Product_View_Media class is never defined in a config file, though I assume it is referenced by the layout xml file catalog.xml
<block type="catalog/product_view_media" name="product.info.media" as="media" template="cat开发者_如何学JAVAalog/product/view/media.phtml"/>
Your config.xml is slightly off. Give the following a try.
<config>
<modules>
<Test_Catalog>
<version>1.0.0.0.0</version>
</Test_Catalog>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<product_view_media>Test_Catalog_Block_Product_View_Media</product_view_media>
</rewrite>
</catalog>
</blocks>
</global>
</config>
Your <blocks>
node needs to be enclosed in a <global>
node.
精彩评论