Tom Muck

Alpha Dog Blues Band
Home page
All articles
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Add Image To Show Cart

Add an Image to the Cart

In CWIncShowCartSetup.php, add the product id to the query:

$query_rsCWGetCart = "SELECT P.product_Sort

to this:

$query_rsCWGetCart = "SELECT P.product_ID, P.product_Sort

then in the CWIncShowCart.php, whereever you want to display the image, some code like this:

<?php
/* Variables for manipulating product images */
$imageRoot = $cartweaver->settings->imageThumbFolder;
$imagePath = "";
$imageSRC = "";
$tempProdId = $row_rsCWGetCart["product_ID"];
$rsCWThumbnail_query = "SELECT prdctImage_FileName
FROM tbl_prdtimages
WHERE prdctImage_ProductID = $tempProdId
AND prdctImage_ImgTypeID = 1";
$rsCWThumbnail = $cartweaver->db->executeQuery($rsCWThumbnail_query);
$row_rsCWThumbnail = $cartweaver->db->db_fetch_assoc($rsCWThumbnail);
$imageSRC = $imageRoot . $row_rsCWThumbnail["prdctImage_FileName"];
$imagePath = expandPath($imageSRC);
if (file_exists($imagePath) && is_file($imagePath)) {
  echo("<img src=\"$imageSRC\" border=\"0\">");
}else{
  echo("No Image Available");
} ?>

 

Back to Cartweaver PHP FAQ, code changes, and samples

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2025 Tom Muck | Dreamweaver Extensions