Jump to content

Facebook Like button module


Recommended Posts

Hi Marty,

Tried doing that...problem is it doesn't post to FB. Like count increases but doesn't post on user timeline or anywhere else for that matter.

This is what I added to product.tpl (this is for most popular social networks) None of them are working.

---------------------------------------------

IN head section

<!-- Pinterest js file -->

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js">

</script>

 

<!-- Google +1 js file --> <script type="text/javascript"> window.___gcfg = { lang: 'en-US' }; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script>

 

<!-- Twitter js file --> <script> !function(d,s,id){ var js,fjs=d.getElementsByTagName(s)[0]; if(!d.getElementById(id)){ js=d.createElement(s); js.id=id; js.src="//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js,fjs); } }(document,"script","twitter-wjs"); </script>

 

<!-- Facebook js file --> <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&appId=220483648084612"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>

 

--------------------

AND CODE WHERE I WANT BUTTONS TO DISPLAY

 

 

<div style="height:30px;margin-top:5px;display:inline-block">

<!-- Facebook like button -->

<div style="float:left; margin-right:20px">

<div class="fb-like" data-href="{$link->getProductLink($product->id, $product->link_rewrite)}" data-send="false" data-layout="button_count" data-width="100" data-show-faces="true"></div>

</div>

<!-- Pinterest Pin it button -->

<div style="float:left; margin-right:20px">

<a href="http://pinterest.com/pin/create/button/?url={$link->getProductLink($product->id, $product->link_rewrite)}&media={$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}&description={$product->name|escape:'htmlall':'UTF-8'}" class="pin-it-button" count-layout="horizontal" always-show-count="true"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>

</div>

<!-- Google +1 button -->

<div style="float:left">

<g:plusone href="{$link->getProductLink($product->id, $product->link_rewrite)}" size="medium"></g:plusone>

</div>

<!-- Twitter tweet button -->

<div style="float:left">

<a href="https://twitter.com/share" class="twitter-share-button" data-lang="en" data-url="{$link->getProductLink($product->id, $product->link_rewrite)}" data-text="{$product->name}">Tweet</a>

</div></div>

--------------------------------

Link to comment
Share on other sites

try to add meta tag for facebook opengraph in header.

 

 

<meta property="og:title" content="{$product->name|escape:'htmlall':'UTF-8'}" />

<meta property="og:image" content="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large')}" />

<meta property="og:description" content="{$meta_description|escape:html:'UTF-8'}" />

<meta property="og:type" content="product" />

<meta property="og:url" content="http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}" />

<meta property="og:site_name" content="Your Site Name" />

 

 

Also above the <head>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="{$lang_iso}">

Edited by yaniv14 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 11 months later...
×
×
  • Create New...