These days, it is trendy to show a Facebook like
button on your website so that visitors can share the page with their friends.
In this recipe, we will add the like
button on every product page.
Open your browser and go to a product page. In your IDE, open your configured theme folder.
In the next steps, we will generate and add the code of a Facebook like
button to the product detail pages:
Open the
catalog/product/view.phtml
template from your theme. If it is not in the theme, copy it from theapp/design/frontend/base/default
folder.Go to http://developers.facebook.com/docs/reference/plugins/like from where you can use the Configurator page to customize the
like
button for your page, as shown in the following screenshot:Paste the code in your
view.phtml
file where it will be more readable; for example, at the end of the file as a child of thediv
tag with the classproduct-collateral
.Reload a product page and the
like
button will show...