Magento : Add a Facebook LIKE button in product view page

As we all know, There have many Magento extensions for social bookmarking services. But if you want to add just single Facebook like button in product view page then read following steps :

1. Open your Magento project directory then GO to app/design/frontend/default/template/catalog/product/ and open view.phtml file.

2. Add the following code snippet where you want to show Facebook LIKE button on view.phtml page.

<!--Facebook like button code starts here  -->

    <?php $CurrentUrl = urlencode(Mage::helper('core/url')->getCurrentUrl()); ?>
   <iframe src="<?php echo $CurrentUrl; ?>&layout=button_count&show_faces=true&width=450&action=like&font=arial&colorscheme=light&height=21"  
 schrollowing="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px" allowTransparency="true"> </iframe> 

<!--Facebook like button code ends here  -->

3. Save it. Now open product detail page, you should see Facebook Like button.

Enjoy :)

Tags:  ,


Duan T 23-03-2013, 16:17

Hey, cool this really worked… i found most posts are outdated i didnt think it would be this easy. Now if i can figure out how to add a “Like” icon on my main page… so the likes will count towards my facebook business page. I can get the code from facebook for that but i do not know how to incorporate it into magento. i think i have to add the code somewhere in the magento files then the other code to display where i want it to show any ideas? Please email me if you can . Thanks


Leave a Reply

two × nine =