Please suggest me the right approach, I want to customize the "EMAIL to Friend" page into pop up window, when user click on the button (email this product). By enabling template hinting, I found out that the button is rendered with
frontend/rwd/default/template/catalog/product/view/sharing.phtml
And the corresponding layout file is catalog.xml
(in frontend/rwd/default/layout)
So I created a local.xml
in the same folder where catalog.xml
exist with the following code (just that I have given test.phtml
instead of sharing.phtml
, just to 'Debug')
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<catalog-product-view>
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<block type="catalog/product_view" name="product.info.sharing" as="sharing" template="catalog/product/view/test.phtml"/>
</block>
</reference>
</catalog-product-view>
</default>
</layout>
But nothing happens, I mean how I can change (overwrite) the default design of theme, without modifying existing xml
and phtml
files?
Best Answer
This is what you should put inside your
local.xml
file.Mistakes that you have done
You used two layout update handles:
default
andcatalog-product-view
. That is wrong. You only need one layout update handle. The right one that you should use here iscatalog_product_view
So
catalog-product-view
is unknown for magento. The proper name iscatalog_product_view
Since sharing block is already defined via
catalog.xml
, now you need to refer that block and then change the template by adding actionsetTemplate
. That is what the above script does.Hope you get the idea