Next and Previous using lightbox?

13 posts by 5 authors in: Forums > CMS Builder
Last Post: December 6, 2010   (RSS)

By Codee - December 6, 2010

Hi Jason,

After hitting "submit" I knew my mesg wasn't going to be as clear as I wanted to be.

I don't want images from products to cross over. I want a single product that has many photos to automatically have those photos in a group upon upload into that product's data fields. I was trying to ask how that's set up to occur. Since all the photos in a same group will be part of the prev/next display; then each product needs to have its own unique group name - to avoid the issue you mentioned.

Re: [equinox69] Next and Previous using lightbox?

By Jason - December 6, 2010

Hi,

All you need to do is ensure that the photos for a particular product record has a unique group name. The easiest field to use would be the "num" field of the product record, since it will be unique across all records in the product table.

Here is a small example of how it would look. In this example, all the product records are stored in a variable called $productRecords and the products table has an upload field called photos:

<?php foreach($productRecords as $product): ?>
<?php foreach($product['photos'] as $photo): ?>
<a href="<?php echo $photo['urlPath'] ?>" rel="lightbox[<?php echo $product['num'];?>]" title="<?php echo $photo['info1'] ?>">
<img src="<?php echo $photo['thumbUrlPath'] ?>" width="<?php echo $photo['thumbWidth'] ?>" height="<?php echo $photo['thumbHeight'] ?>" alt="" title="<?php echo $photo['info1'] ?>" />
</a>
<?php endforeach ?>
<?php endforeach ?>


This will output all of the photos stored in each of the product records. The group name of each photo will be the record number of the product record they are associated with.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/