View Single Post
Old June 20th, 2012, 12:49 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
Join Date: Feb 2008
Posts: 16,902

If you want to add a Like button to each product in a Category, you can add the following code between the [product.each] and [product.end] tags in your Product list module:

HTML Code:
<iframe src="//<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . '/' . $product->site_link); ?>&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80" 
style="border:none; overflow:hidden; width:450px; height:80px;" 
If you are having problems with that, you may need to check this line:

<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . '/' . $product->site_link); ?>
Let's break it down:
  • <?php echo - Open the PHP statement. Don't change.
  • urlencode( - We run the entire URL through a built in PHP URL encoder.
  • 'http://' . - This is the beginning of the URL. If you are using an SSL connection, it should be 'https://' .
  • $_SERVER['HTTP_HOST'] . - This is your site's domain name. If you need to change your domain name, you do that here.
  • '/' . - This is the forward slash / between your domain name and the beginning of the path in the URL.
  • $product->site_link - This is the path to the product page.
  • ) - Close the urlencode( function.
  • ; ?> - Close the PHP statement. Don't change.