I’m using Magento, and I want to rewrite Mage_Catalog_Block_Product_Price, but a community codePool module has already rewritten that block. I know that in my xml, I need
<config>
<global>
<blocks>
<WHAT_GOES_HERE?>
<rewrite>
<product_price>Display_Price_Block_Product_Price</product_price>
</rewrite>
</WHAT_GOES_HERE?>
</blocks>
But I’m not sure what should be placed into the classgroup node (which i’ve labeled WHAT_GOES_HERE?) The community module makes no <[classgroup]> declaration, so I’m not sure what should go in the node I’m missing.
Thanks in advance for any help.
All of the configuration XML is merged into a single DOM structure in a way that means colliding xpaths will have their text values overridden. An example:
This community module is currently rewriting the resolved classname via configuration:
The framework invokes block classes using
Mage_Core_Model_Layout::createBlock(), with the argument in this case beingcatalog/product_price(note how those two strings map to the configuration). The community module is changing the classname which is calculated from this information, and pointing it to the classname specified i.e.Community_Module_Block_Example_Price. That classname is then fed to PHPnewto invoke a class.What you need to do is copy this exact configuration to your module config – specifying your block classname – and (important!) make sure that the following occur:
How do you make sure that your module configuration is loaded after the community module? Just open the community module’s declaration file in app/etc/modules, note the node name under the
<modules>node (in the example above, would almost certainly beCommunity_Module), and then in your module declaration file (also in app/etc/modules), add this to your module declaration:HTH