Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Gud Morning All,

I want to add facebook button with counts showing into a ecommerce website which has products.

I am new to facebook integration guys please help out :)

Thanks and Regards
Harsha
Posted

1 solution

This is standard facebook recomend-botton:
HTML
<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/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>


And place this html where you want your button:
HTML
<div class="fb-like" data-href="http://www.myshop.com/products/123" data-send="false" data-width="450" data-show-faces="false" data-action="recommend"></div>

The onlye thing you should change on every productpage is fex the product-id. As you can see the div-tag (at bottom) contains an attribute "data-href" (permanent link to each product). This is the unique url to "like" when you hit the like-button.



http://developers.facebook.com/docs/reference/plugins/like/[^]
 
Share this answer
 
v2
Comments
AshishChaudha 13-Jul-12 8:48am    
my5!..Good answer..It will surely work..I have used too previously
Sandeep Mewara 13-Jul-12 10:09am    
Good answer. 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900