kieranbarnes Independent PHP, WordPress & CubeCart Programmer

CubeCart – Product Thumbnail in viewProd.tpl

Posted on October 19, 2007

Here's something that bugged me for a while. I'm working on an alternative image viewer for CC4, I don't like the old style pop up window and I don't think LightBox is really suitable.

Anyway, I needed the original product thumbnail visible on the view product page along with the additional images.
Here's how it's done.

After line 135 in includes/content/viewProd.inc.php add this

$thumbRoot = imgPath($prodArray[0]['image'], $thumb=1, $path="root");
$thumbRootRel = imgPath($prodArray[0]['image'], $thumb=1, $path="rel");

if (file_exists($thumbRoot)) {
$view_prod->assign("IMG_SRC_THUMB", $thumbRootRel);
} else {
$view_prod->assign("IMG_SRC_THUMB", $GLOBALS['rootRel']."skins/". SKIN_FOLDER . "/styleImages/thumb_nophoto.gif");
}

You can then reference it in yourskin/content/viewProd.tpl like this

<a href="#" OnClick="document.MainProdImage.src='{IMG_SRC}';"><img src="{IMG_SRC_THUMB}" class="imageThumb"></a>

Also posted on these threads; CubeCart.com & CubeCartForums.org


Related posts

  1. CubeCart Tax Classes on Product Page
    A client of mine sells a mix of VAT and VAT exempt products via a...
  2. CubeCart and WordPress Integration
    Following my 100% CubeCart orientated posts, here's another late night hack. It integrates a WordPress...
  3. Using WP-Ecommerce Product Downloads without checking out
    I've used WP-Ecommerce for a few clients who required an online catalogue, rather than an...
  4. Shopp Product Importer Download
    Here are the latest versions of the Shopp Product Importer. I did not write these,...
  5. CubeCart Mod – Side by Side Products Mod
    This universal modification allows you to show your products side by side on the "View...

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.