CubeCart - Product Thumbnail in viewProd.tpl

October 19th, 2007
No Gravatar

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

Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo


Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the CubeCart category.

Leave a Reply