News:

Support the VirtueMart project and become a member

Main Menu

How can I add facebook like option to product details page?

Started by websmith, December 21, 2016, 05:15:56 AM

Previous topic - Next topic

websmith

Joomla 3.6.4
VM 3.0.18.5

Is there a plugin or way to add a facebook like button to the product details page? Would it have to be added to each product page or can it be added to a template override to be added to all products in one shot? Really appreciate any help with this. Thank you.

Spiros Petrakis

You can create a template override for the product page if you dont have one already and add the following code :

<!-- Load Facebook SDK for JavaScript -->
<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";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
  </script>

<!-- Your like button code -->
<div class="fb-like"
data-href="<?php echo JURI::current(); ?>"
data-layout="standard"
data-action="like"
data-show-faces="true">
</div>
Joomla templates and extensions development
https://www.yourgeek.gr