Kinetic Pulse
  • Home
  • Services
  • Portfolio
  • Blog
  • Terms
  • Contact

How to get correct Zen Cart product thumbnail when posting to Facebook [Updated: 26th Aug 13]

November 8, 2011

When users post a link to your products on Facebook, its nice for the automatic link to show a picture of an actual product.

Unfortunately Zen Cart doesn’t have this facility out of the box, but its not too tricky to add it yourself.

In your template’s html_header.php add the following lines for all the Facebook Open Graph tags:





" />

/includes/templates/YOU_TEMPLATE/images/logo.png"  />

/images/" />




  




Note: this is using a new DEFINE variable called META_TAG_PRODUCT_IMAGE.

This needs to be defined in your modules/meta_tags.php file.

(use an override for your template obviously by copying the existing one into a folder called YOUR_TEMPLATE. Also check what the default directory for your product images is – this code is assuming they are directly beneath the images folder. You’ll need to do extra work to figure ou if they are in more complex subdirectories)

In the line around 194 that is building the SQL to pull data from the products table add the following  field to the list:

p.products_image

Then around line 208 below where it says // custom meta tags per product  add the following line:

$meta_products_image = $product_info_metatags->fields['products_image'] ;
define('META_TAG_PRODUCT_IMAGE', $meta_products_image);
 

(Note: I have moved both lines together as it seemed to make it work on ZenCart 1.5. It looks like there were more if statements added in this version!)

Thats it. You can see it in work here http://www.thepartypirate.com and in version 1.5 http://www.framecraftonline.com

 

Testimonials

It’s been fab working with you – we love the site and certainly going to recommend you!
James DaviesThirty Eight Degrees North
Thank you guys so much for all that you’ve done helping us to create a really awesome website!! We get such great feedback – everyone loves it & we couldn’t be prouder! Look forward to working with you again soon!
Wild Thyme PlantsWild Thyme Plants
Amazing and brilliant, Kinetic Pulse have lifted a dream to reality, Highly recommended and great if you are total novice, they know their stuff…Thanks again
Annie LindridgeSalt Yourself Out
Thanks so much for all your work on this, really appreciated. It’s come on in leaps and bounds since you took over.
Pete KewRedwood Strip Curtains
Absolutely fantastically professional web developer – I would highly recommend!!! Thank you so much Kinetic Pulse!
Tania MarstonDoris Designs
Thank you for all of your hard work its looks fab and I am over the moon with it!
Amanda MercerAmanda Mercer Ceramics
I like it.  I like it a lot !!!

 You have interpreted what I wanted to achieve perfectly considering what you have to play with i.e not redoing the whole thing in the process.

Fiona Simmons-MooreSouth Gloucestershire Parents & Carers

Copyright 2026 Kinetic Pulse