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

Create a gallery in Zencart using your Flickr sets

November 24, 2011

Zen Cart is great an all but it really doesn’t do image galleries very well. There are some plugins available but to be honest the admin interface is always a bit erm “clonky” in my opinion. Why not use Flickr to serve up your glorious pictures as a gallery?

Here’s my attempt at getting it to work inspired by work done by Dan Coulter at the http://phpflickr.com/ project

(Please note: this has only been tested in Zen Cart 1.3.h – I’m sure with a bit of tinkering it could be made to work with 1.5, but I dont have the time/inclination)

1) Create a Flickr account

2) Upload your pictures into groups called “Sets” – giving each a title & description. These will be pulled into your Zen Cart

3) Create an EZ page called “Gallery”

4) In the tpl_page_default.php for your theme (as always ensure you override the default) add the following block of code:

<?php
 if($var_pageDetails->fields['pages_title']=="Gallery"){
// check if there is a query string 'set'
 if($_GET['set']!=""){
 //if there is a query string find out what pos it is in the photosets array
 $setName=$_GET['set'];
$pos=array_search($setName,$photoSetsNames);
echo "<h2>".$setName."</h2>";
 echo "<p>".$photoSetsDescriptions[$pos]."<br/></p>";
 echo $photoSetsPhotos[$pos];
 //print_r($photoSetsDescriptions);
}else{
 // if no query string then display list of all sets
 echo "<ul class=\"galThumbs\">";
foreach($photoSetsNames as $photoset){
 $pos=array_search($photoset,$photoSetsNames);
 ?>
 <li><a href="gallery/?set=<?=$photoset?>">
 <p><?=$photoset?></p>
 <? echo $photoSetsThumbs[$pos];?>
 </a></li>
 <? }
 echo "</ul>";
 }
}
 ?>

5) Upload the two attached files phpFlickr.php and phpFlickrGetSets.php to your “includes\modules” folder phpFlickrGetSets.zip

6) Change the lines indicated in your phpFlickrGetSets.php to be your Flickr App id and the absolute path to your new folder flickr_cache (Note: You absolutely must enable caching otherwise the lookups to Flickr can slow your site down horribly! Plus db caching I found to be woefully slow so stick to file system caching) And your Flickr User Name
(Get your Flickr App Id here: http://www.flickr.com/services/apps/create/apply)

7) Make sure you have created a folder called flickr_cache & set permissions to 755

8) Include your two new modules in the tpl_header.php file like so:

/**
 * load the module for getting the Flickr data
 */
require(DIR_WS_MODULES . zen_get_module_directory('phpFlickrGetSets.php'));

I’m putting it in the site header as I want to dynamically get the list of set names to use in the site menu. If you wanted it only on the gallery page then you could just add it to your tpl_page_template.php along with the other code above

And Bob’s your uncle:

See it working here: www.dorisdesigns.co.uk

As always any comments feedback appreciated!

UPDATE: May 2014

Please not the Flickr API is going SSL from June 2014 – so you will need to edit the paths in phpFlickr.php to use https:// rather than http://

More info can be found here: http://code.flickr.net/2014/04/30/flickr-api-going-ssl-only-on-june-27th-2014/

 

Share

Facebook Google+ Twitter Pinterest Email
  1. Tony Bateman says

    August 3, 2012 at 2:10 pm

    Doesn’t work, at least not on zen cart 1.5. Wish I had chosen an older version now as finding a gallery compatible with 1.5 is a nightmare!

  2. Adam says

    June 11, 2013 at 11:26 am

    Can you tell me if you got this to work on ZenCart v1.51 ?

Back to Blog

Testimonials

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
Absolutely fantastically professional web developer – I would highly recommend!!! Thank you so much Kinetic Pulse!
Tania MarstonDoris Designs
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
Thank you for all of your hard work its looks fab and I am over the moon with it!
Amanda MercerAmanda Mercer Ceramics
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
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

Copyright 2025 Kinetic Pulse