VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: pokeseb on February 16, 2012, 00:53:22 AM

Title: Display product images in cart
Post by: pokeseb on February 16, 2012, 00:53:22 AM
Hello,

I would like to know how to make the thumbs of product image can be displayed when accessing to the cart (one image by line of the product table in the cart view). I troubleshooted a bit and found that the error might be due to that line in the file com_virtuemart/views/cart/tmpl/default_pricelist.php :
         
         if(!empty($prow->images)) echo $prow->image->displayMediaThumb('',false);

$prow->images seems to be whereas I can confirm that the corresponding product do have images attached. Do you have any clue on this one ?

Thanks in advance !

Sebastien
Title: Re: Display product images in cart
Post by: craftyweb on March 09, 2012, 10:18:07 AM
Yes, $prow->image always seems to be null. Anyone have any idea how to fix this?

EDIT: actually this IS working on some products I'll do some more testing
Title: Re: Display product images in cart
Post by: Smile on March 11, 2012, 16:44:41 PM
I think the following is for Virtuemart 1 but maybe its useful to you....

Edit 2 files to show product thumbnails in shopping cart and the checkout process:


1. basket.php
2. ro_basket.php

Files 1 & 2 are in: /administrator/components/com_virtuemart/html


Then you have to add code to create the field 'product_thumb_image' in the product records. To do that you must edit basket.php and ro_basket.php and add this code at line 90:

Code:

// prepare thumb image

if( $ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_thumb_image") ) {
$product_thumb_image = $ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_thumb_image");
}
else {
$product_thumb_image = 0;
}

if( $product_thumb_image ) {
if( substr( $product_thumb_image, 0, 4) != "http" ) {
if(PSHOP_IMG_RESIZE_ENABLE == '1') {
$product_thumb_image = $mosConfig_live_site."/components/com_virtuemart/show_image_in_imgtag.php?filename=".urlencode($product_thumb_image)."&newxsize=".PSHOP_IMG_WIDTH."&newysize=".PSHOP_IMG_HEIGHT."&fileout=";
}
else {
if( file_exists( IMAGEPATH."product/".$product_thumb_image )) {
$product_thumb_image = IMAGEURL."product/".$product_thumb_image;
}
else {
$product_thumb_image = IMAGEURL.NO_IMAGE;
}
}
}
}
else {
$product_thumb_image = IMAGEURL.NO_IMAGE;
}

$product_rows[$i]['product_thumb_image'] = "". ""
. "
";
//end of prepare thumb image
Title: Re: Display product images in cart
Post by: murat on May 26, 2012, 09:45:19 AM
Virtuemart 2.0.6 ploblem exists. Has it been fixed in 2.0.7 version?
Title: Re: Display product images in cart
Post by: gxHL on May 26, 2012, 18:29:30 PM
Hi...maybe i dont understand this correctly but there is an option for that at "Configuration" - "Checkout (Tab) - "Show product images"
Title: Re: Display product images in cart
Post by: murat on May 26, 2012, 19:23:28 PM
Has been worked right now, however this option was ON before.