One of the most requested features from my clients and Lille Boutique is to show multiple photos for each product in Xsilva. Xsilva itself only allows for a single image to be displayed - great if your user knows the product, like an iPod, but if you have clothing or another product that requires multiple views this is for you.
The first thing you need are, well, the photos. For each product view you want, name the images with the product name (you can see the product name when you click on a product - it is in the URL product=NAME) and add a count or identifier that is unified through all the images. I chose NAME_01.jpg, NAME_02.jpg but you can go deeper into that if you have all the same products and want to do more with this hack.
Next step, upload them to the photos directory that is already there and has the Xsilva exported images in it already. Once you are done with that, we need to get into the nitty-gritty. I am sure there might be a better way to do this with some recursion, etc - but this is a method I found that works very well. I am purposefully not including some security code that is used for this to stop any kind of malicious use of these function.
If you are not comfortable with editing PHP, don’t try this. If you don’t know what you are doing and can’t remember what to change with Xsilva updates the web store code, don’t try this.
In xls_product_view.php we are going to create a call to out images, since this php file already knows a few things like out product code, it is relatively easy. Right after all the template calls, but before the $tpl-fetch echo, we are going to add this:
// Added By Alan Wizemann
$dir = "photos";
$prodcode = $_GET[product];
$prodname = strtolower($product->name);
$mfilename = $dir . '/' . $prodcode . '_01.jpg';
$breadcrum = explode(" ", $prodname);
if(file_exists($mfilename)) {
$aw_main = '
‘; }
$tpl->set(’aw_main’, $aw_main);
Now we should grab some more images, and make a gallery for the listing:
$photo_count = "5";
for($i; $i< $photo_count; $i++) {
$filename = $dir . '/' . $prodcode . '_0' . $i . '.jpg';
if(file_exists($filename)) {
$aw_gallery .= '
‘; }
}
$tpl->set(’aw_gallery’, $aw_gallery);
Now you have to edit the product_detail.tpl file in the template directory that you are using to make sure and call the new template names we created.
Comment out the Xsilva call to their image and replace it with {tag:aw_main}, then,after the form close tag add the folowing:
{tag:aw_gallery}
There you have it. You can see an example of this used on: