How to add a Facebook “Like” button with full functionality?

I’m trying to add a Facebook “Like” button and I’m using a free extension for it but it’s giving me an error as they are not compatible with Magento version 1.5.

I’m trying to do it manually but a little help which I found was to get a Facebook developer code and paste in static URL etc.
…but I didn’t understand that.

So can you kindly tell me how to do what I want? From where do I get which code and where to paste please?

7 thoughts on “How to add a Facebook “Like” button with full functionality?”

    1. Go to http://developers.facebook.com/docs/reference/plugins/like/ and obtain the proper code for your site. (It will generate iframe HTML code that you need to copy)
    2. Determine where you want to show the like button, options are: all pages, product view, category view, etc…(your choice)
      For example if you want it on product page, then you need to add the previously generated HTML to the catalog/product/view.phtml template.
      If you want the url that needs to be liked to be fixed:
    <iframe src="http://www.facebook.com/plugins/like.php?href=http://yoursite.com?other_params_go_here"></iframe>
    

    If you want the url to be the current one:

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $this->helper('core/url')->getCurrentUrl(); ?>?other_params_go_here"></iframe>
    

  1. you need login Facebook account panel & create your own code for your website
    then you can paste code in any block template .
    if you can not template you can login magento admin panel to enable development mode

  2. Try this for product detail page

    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js#appId=181097698614858&amp;xfbml=1"></script>
    <fb:like href="<?php echo $_product->getProductUrl() ?>" send="false" show_faces="false"></fb:like>
    

  3.  <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=157602984730324";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like"></div>
    

Leave a Reply

Your email address will not be published. Required fields are marked *