Magento – How to add a button on the Product page / How to add size-chart in magento /

magento-1.7magento-1.8magento-1.9magento-enterprise

Website URL- niraame.com

This is our website URL. We want to add size-chart option in our cloth section.
I have little knowledge of JavaScript and HTML so i have created a button which does exactly what i wanted to do.

JavaScript and HTML code which i stored as a Static block in Magento-

<p>
<script type="text/javascript">// <![CDATA[
 function popup(){
  sizeWindow = window.open("http://localhost/magento/media/wysiwyg/s.jpg", "sizeWindow", "location=no,width=520,height=520"); 
}
// ]]></script>
</p>
 <p><strong><a href="javascript:popup()">Size Chart</a></strong></p>

This code displays a button on the screen and after clicking it we gets the sizechart loaded on a popup window.

I am not able to figure out how to put this button on the Product page.
I tried finding an answer on the Community page.

Can anyone please tell me how to add a button on Product page.

Best Answer

The template that renders the html for the product page is app/design/frontend/{package}/{theme}/catalog/product/view.phtml.
Put your code in there.
But please don't use hard coded links like http://localhost/magento/media/wysiwyg/s.jpg.
Use

window.open("<?php echo Mage::getBaseUrl('media')?>/s.jpg", "sizeWindow", "location=no,width=520,height=520"); 
Related Topic