How do I create a custom price.phtml
file and display it on the product view page?
Use case: I have updated the price.phtml
file under product > view to add rich snippets / structured data. And, I would like to create a new price.phtml
file so that I can use it for 'Related Products' which appear on the Product View page.
=== Update ===
I have updated catalog.xml as below,
<catalog_product_view>
<reference name="right">
<block type="enterprise_targetrule/catalog_product_list_related" name="catalog.product.related" as="relatedProducts" template="targetrule/catalog/product/list/related.phtml">
<action method="setColumnCount"><columns>3</columns></action>
<block type="enterprise_targetrule/catalog_product_item" name="catalog.product.related.item" template="targetrule/catalog/product/list/related/item.phtml">
<action method="addPriceBlockType">
<type>simple</type>
<block name="myprice">catalog/product_price</block>
<template>catalog/product/myprice.phtml</template>
</action>
</block>
</block>
</reference>
</catalog_product_view>
Note that I have only added the simple price type block for now. And, the default related products block is being overridden by a module (as you can see in the above XML).
In myprice.phtml, I just have a simple echo statement.
As a follow up, can I call the custom price template in the related item block as below?
<?php echo $this->getChildHtml('myprice'); ?>