atif
atif

Reputation: 1693

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?

Upvotes: 1

Views: 16299

Answers (6)

yatin patle
yatin patle

Reputation: 11

 <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>

Upvotes: 1

Manzurul
Manzurul

Reputation: 128

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>

Upvotes: 0

guru
guru

Reputation: 11

It is always advisable to use an module. There is a 3-in-one module available for Social sharing. i.e. Google+1 Button, Facebook LIke and Twitter Share.

you can check it at magento connect http://www.magentocommerce.com/magento-connect/Modulesoft/extension/7258/google_1_plus_button_with_facebook_and_tweet

Hope the information is helpful

Upvotes: 1

zokibtmkd
zokibtmkd

Reputation: 2183

  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>

Upvotes: 2

mivec
mivec

Reputation: 327

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

Upvotes: 1

Sven
Sven

Reputation: 952

I added a Facebook plugin at a front page, see it here: http://www.boardcorner.se on the right side. By adding a piece of code in the TinyMCE javascript it allows the Facebook iframe to be inserted by a standard copy & paste. You'll find the piece of code needed here: Magento - How to allow certain tags (iframe, embed) in Magento's CMS editor?

Upvotes: 0

Related Questions