View Single Post
  #23  
Old 03-21-2009, 10:44 AM
 
rshandel rshandel is offline
 

Senior Member
  
Join Date: Feb 2009
Posts: 125
 

Default Re: thumbnails in cart pages

Did anyone every come up with a solution to this problem? It seems that without being able to add thumbnail images to variants, you'd have to resize the product images in the cart.

This is how I did it:

I created an new template call cart_product_thumbnail.tpl:

and made the width and height to the desired size (in this example "75):

{if $config.Appearance.show_thumbnails eq "Y"}<img{if $id ne ''} id="{$id}"{/if} src="{if $tmbn_url}{$tmbn_url}{else}{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?type={$type|default:"T"}&amp;id={$produc tid}{/if}"
{if $image_x ne 0} width="75"{/if}{if $image_y ne 0} height="75"{/if}
alt="{$product|escape}" />{/if}


I changed the code in cart.tpl to call the new template:

before:


<a href="product.php?productid={$products[product].productid}">{if $products[product].is_pimage eq 'W' }{assign var="imageid" value=$products[product].variantid}{else}{assign var="imageid" value=$products[product].productid}{/if}{include file="product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}</a>

after:

<a href="product.php?productid={$products[product].productid}">{if $products[product].is_pimage eq 'W' }{assign var="imageid" value=$products[product].variantid}{else}{assign var="imageid" value=$products[product].productid}{/if}{include file="cart_product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}</a>

It does produce grainy images but at least it will show the customer the correct product image in the shopping cart.
__________________
x-cart 4.1.12
x-cart 4.2
Reply With Quote