Unleash the Full Potential of Your PrestaShop Store

Welcome to MyPresta.eu – Your reliable partner in the e-commerce world. Find innovative modules that will take your business to a new level.

PrestaShop and Google+ badge

 
 

How to create Google+ badge

Want to create own google plus badge widget exactly the same as you can see on the left hand side here? Read this free tutorial. I will show you step by step how easily you can create own google plus badge. I willl use our free html block prestashop module. This awesome addon allows you to use any code you want in most important places (hooks) in PrestaShop store. 

 

As always I want to say, that you have to install html block module  first in your back office. It is necessary because without this module it will be hard to use this widget (You will need to edit the template files), with this addon it will be very easy.

 

Google+ widget code

Here is the widget code for our Google+ profile. Of course if you want to use widget for own profile - you have to change several variables in the code below. I will show you step by step what to change.

<!-- Place this tag where you want the widget to render. -->
<div class="g-page" data-width="200" data-href="//plus.google.com/116184657854665082523" data-rel="publisher"></div>

<!-- Place this tag after the last widget tag. -->
<script type="text/javascript">
  window.___gcfg = {lang: 'en-GB'};

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

 

Most important variables in the code

  1. data-width="200"  - this param defines the width of the widget block, you can use own width value (you can decrease / increase it if you want)
  2. //plus.google.com/116184657854665082523 - this is an URL to our Google+ profile. You have to use own URL inster our. Change the value of this param.
  3. window.___gcfg ={lang: 'en-GB'}; this is the definition of the language used in widget, en-GB means that widget will use english language for Great Britain.  You can use own language ISO code there, for example: pl, es, fr, de, it etc.

 

You can also define own widget code on page: Google+ widget code generator. Ok, so I suppose that you've got now own valid Google+ badge widget code. So please follow instruction below.

 

Html block and widget  code

Now it is time to use the widget code in html block module. Open your modules tab in your back office and search for html box module. This is how the module looks like in your BO.

 

html block free presatshop module in back office

html box free module

 

Click on configure button and you will see the module configuration page

html block configuration page

 

From the left hand side column select the position where you want to put the widget. I selected left column, so it mean that widget will appear in the main left column of your store. Now paste the code to the field in the right hand side column and hit Save Settings button. That's all, your widget will appear in your front - end.

 

This tutorial will work also in old prestashop versions like 1.2, 1.3, 1.4

Zdjęcie autora: Milosz Myszczuk

Artykuł napisany przez Milosza Myszczuka, eksperta PrestaShop i oficjalnego moderatora społeczności PrestaShop. CEO i założyciel agencji interaktywnej VEKIA. Dowiedz się więcej.

If you like this article, support our work!

Comments