Magento - Block/layout issues with addPriceBlockType
I am having a little trouble with the addPriceBlockType in Magento.
I am trying to extend Mage_Catalog_Block_Product_Price for configurable products only. I want to define my own block type and template which handle prices for configurable products.
In my modules layout file I have the following:
<default>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>configurable<开发者_如何学Go/type>
<block>myblocktype/product_price</block>
<template>myblocktype/catalog/product/price.phtml</template></action>
</reference>
</default>
The price block disappears from the configurable products - which suggests I am heading in the right direction - but the block is never output. Further, the _toHtml method in my custom block is never reached with the above layout XML. My custom block is extending Mage_Catalog_Block_Product_Price.
If however, I supply a block type of Mage_Catalog_Block_Product_Price in my layout xml as in:
<default>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>configurable</type>
<block>catalog/product_price</block>
<template>myblocktype/catalog/product/price.phtml</template></action>
</reference>
</default>
The the block is output, with my custom template.
I need a custom block type though so this inst a good enough solution.
Can anyone advise on why my custom block will not output but the core block does using identical layout xml. Also I am using the same method as the core bundle and msrp modules use.
I am running this code on Magento CE 1.6
Drew (OP) already self-answered the question.
Quote:
EDIT: Issue sorted. Was a naming issue.
Note: It's absolutely OK to self-answer your own question. Please just post it as an real answer, but not in a question or comment. Posting as real answer helps to keep the "Unanswered" list more clear (avoids making other people wasting their time).
精彩评论