如何只为句柄Mage_Catalog_Block_Product_Price重写catalog_product_view?这个块在布局中没有特定的名称。
<catalog_product_view>
<reference name="???">
<block type="test/price" name="test.price />
</reference>
</catalog_product_view>发布于 2013-09-24 22:03:27
因为在magento中,产品类型定义了用于渲染价格的块,所以有点棘手。也许这能行:
转到您最喜欢的布局xml文件并添加以下内容
<catalog_product_view>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>virtual</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>grouped</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>downloadable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>configurable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>bundle</type><block>yourmodule/bundle_catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
</reference>
</catalog_product_view>我不能百分之百肯定这会成功,但这也许是你的一个开始。
https://stackoverflow.com/questions/18992296
复制相似问题