Add A Facebook Like Button

Sharing is Caring

A while ago, Facebook created the Facebook Like Button that works by using an iframe of FBML. The Like button allows you to easily get some free social media coverage with consumers.

Many websites and blogs are making use of the Facebook Like button and any other ways possible of sharing on social media networks because the cost is so minimal and publicity is so important to any business.

Adding the button is extremely simple, although it does require some editing of .phtml files, an ftp client, or experience with VI or EMACS if you have SSH access.

Step 1: Open up app/design/frontend/default/{{YOURTHEMENAMEHERE}}/template/catalog/product/view.phtml

Step 2: Search for the following code.

getReviewsSummaryHtml($_product, false, true)?>
getChildHtml('alert_urls') ?>

Step 3: Paste this code between the two lines of above code.

<iframe src="<?php echo $_product->getProductUrl(); ?>&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>

Step 4: Open up your website and view a product. If you can’t see the Facebook Like button you may need to clear the Magento Cache.

Hope this helps and good luck with your business!

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.