Jump to content

Showing thumbnail in product description


Guest 1XCape

Recommended Posts

Guest 1XCape

Hi all, I'm new here. Running CC 3.0.6 but soon to upgrade to the 7 that has the working security patches. I'm just testing it right now. Here's my problem. I add a product and upload an image and it generates a thumbnail fine. On the product page though it shows the full sized image. I'd rather it show a thumbnail in the corner with a "click to see larger". My images are extremely small filesize-wise but I'd still like the smaller image, since it looks more streamlined that way.

I'm using the Killer template btw if that's important.

Thanks much!

Link to comment
Share on other sites

As classic 'template system' CubeCart manages every template with own php file. If we are talking about product page that means we ar talking about viewProd.inc.php and viewProd.tpl. You have to search for appropriate template variable for generated image.

Have look at viewProd.tpl and here is code like:

<img src="{IMG_SRC}"
and {IMG_SRC} is our template variable - path to one image.



Have look at viewProd.inc.php and search for IMG_SRC. What you are seeing? Something like this:
	if(!empty($prodArray[0]['image'])){

		$view_prod->assign("IMG_SRC","images/uploads/".$prodArray[0]['image']);

	} else {

		$view_prod->assign("IMG_SRC","skins/".$config['skinDir']."/styleImages/nophoto.gif");

	 }

Simple PHP code with one condition: If we have got an image name IMG_SRC will be filled with image path else with thumbnail path.

This was an explanation how it works. :sourcerer:

Link to comment
Share on other sites

Simple if you want it to show the Thumbnail instead of the full sized image just change

if(!empty($prodArray[0]['image'])){

		$view_prod->assign("IMG_SRC","images/uploads/".$prodArray[0]['image']);

	} else {

		$view_prod->assign("IMG_SRC","skins/".$config['skinDir']."/styleImages/nophoto.gif");

	 }




to




	if(!empty($prodArray[0]['image'])){

		$view_prod->assign("IMG_SRC","images/uploads/thumbs/thumb_".$prodArray[0]['image']);

	} else {

		$view_prod->assign("IMG_SRC","skins/".$config['skinDir']."/styleImages/nophoto.gif");

	 }

that will substute it with a thumbnail if you want to create a link too then contact me and ill give you the rest the code...

Edited by aikdo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...