Kalkarn Posted February 20, 2014 Share Posted February 20, 2014 (edited) Hi, I am using the blocksharefb module on a Prestashop 1.5.2.0 and have a little issue with it. Instead of opening the usual little popup where you can share the page on FB, It either opens a new tab or a new window (depends on the options I set in Firefox) but no popup. You can see it here : http://devmstd.castsds.com/index.php?id_product=46&controller=product&id_lang=5#left_share_fb Would anyone know how to change it to a popup? Thanks in advance, Kalkarn Edited February 21, 2014 by Kalkarn (see edit history) Link to comment Share on other sites More sharing options...
Krystian Podemski Posted February 20, 2014 Share Posted February 20, 2014 You should have link like that: javascript:shareFB('http://www.egustus.pl/glowna/217-przyrzad-do-pierogow.html'); And javascript function: function shareFB(url) { window.open( 'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url), 'facebook-share-dialog', 'width=626,height=436'); } Link to comment Share on other sites More sharing options...
Kalkarn Posted February 20, 2014 Author Share Posted February 20, 2014 Hi Krystian, Thanks for your answer, this is exactly the kind of button I want on my site. Did you use the Block Share Facebook in Prestashop or is it another one? Because yours is wrapped in an iframe, and mine is basically juste an <a> element with the class "js-new-window" and redirecting to Facebook's sharer.php Link to comment Share on other sites More sharing options...
Krystian Podemski Posted February 20, 2014 Share Posted February 20, 2014 I use a simple sharer as you can see, not the default PrestaShop module. Link to comment Share on other sites More sharing options...
Kalkarn Posted February 21, 2014 Author Share Posted February 21, 2014 (edited) Could you tell me where you got it? I am trying with Facebook's default one, all I get is a button to share a Facebook page, not the page I am currently on. -Edit- Nevermind, I found a way around it. In case someone needs it later : I took Facebook's sharer and then put it in the blocksharefb's .tpl file : <li id="left_share_fb"> <a href="http://www.facebook.com/sharer.php?u={$product_link}&t={$product_title}&display=popup" > <div class="fb-share-button" data-type="button_count"> {l s='Share on Facebook' mod='blocksharefb'} </div> </a> </li> Removed the background declaration in the product.css (to hide the little F icon) : #usefull_link_block li#left_share_fb{ display: block !important; padding-left:20px; /*background:url(../img/icon/picto_fb.png) no-repeat 0 0;*/ } I also put this in my theme's header.tpl : <!-- FACEBOOK OG--> <meta property="og:title" content="{$meta_title|escape:'htmlall':'UTF-8'}"/> <meta property="og:url" content="http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}"/> <meta property="og:site_name" content="{$shop_name|escape:'htmlall':'UTF-8'}"/> <meta property="og:type" content="website"> <meta property="og:description" content="{$meta_description|escape:html:'UTF-8'}"> <meta property="og:image" content="{$img_ps_dir}logo-1.jpg"> <!-- /FACEBOOK OG--> </head> <body {if isset($page_name)}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if} {if $hide_left_column OR $hide_right_column}class="{if $hide_left_column}hide-left-column{/if} {if $hide_right_column}hide-right-column{/if}"{/if}> <!-- FACEBOOK --> <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/fr_FR/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <!-- /FACEBOOK --> And it gets me the button I need, opening as a popup. Thanks for your answers anyway Krystian, it helped me a lot. Edited February 21, 2014 by Kalkarn (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now