News:

Looking for documentation? Take a look on our wiki

Main Menu

Display product images in cart

Started by pokeseb, February 16, 2012, 00:53:22 AM

Previous topic - Next topic

pokeseb

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

craftyweb

#1
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
Joomla: 2.5.20
VirtueMart 2.0.26d

Smile

#2
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

murat

Virtuemart 2.0.6 ploblem exists. Has it been fixed in 2.0.7 version?

gxHL

Hi...maybe i dont understand this correctly but there is an option for that at "Configuration" - "Checkout (Tab) - "Show product images"
VM 2.0.10 J 2.5.7

murat

#5
Has been worked right now, however this option was ON before.