VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: ARTIFIEDWEB on November 30, 2016, 13:32:01 PM

Title: Put product images in the cart module.
Post by: ARTIFIEDWEB on November 30, 2016, 13:32:01 PM
I have made an addition to the cart module to display the images of the products.

Go to components/com_virtuemart/helpers/cart.php
Line 1769
Add:
$data->products[$i]['image'] = $product->images[0];

So that the final Result is:
$data->products[$i]['image'] = $product->images[0];
$data->products[$i]['product_sku'] = $product->product_sku;


Then go to modules/mod_virtuemart_cart/tmpl/default.php
Line 31
Add:
<span class="image"><img src="<?php echo $product['image']->getFileUrlThumb(); ?>" alt="" /></span></br>

So that the final Result is:
<span class="image"><img src="<?php echo $product['image']->getFileUrlThumb(); ?>" alt="" /></span></br>
<span class="quantity"><?php echo  $product['quantity'?></span>&nbsp;x&nbsp;<span class="product_name"><?php echo  $product['product_name'?></span>



Title: Re: Put product images in the cart module.
Post by: ARTIFIEDWEB on November 30, 2016, 13:42:08 PM
Could I suggest that you update the helper file in virtuemart core to always include that line, so that we don't have to re-insert the code on each virtuemart update?
Title: Re: Put product images in the cart module.
Post by: Studio 42 on December 01, 2016, 10:44:17 AM
I think it not work on add to cart a new product.
Title: Re: Put product images in the cart module.
Post by: ARTIFIEDWEB on December 01, 2016, 10:47:49 AM
It was tested on a clean virtuemart install.
Make sure that in the "Virtuemart Shopping Cart" module both of the following options are set to yes:
Show Product Price?
Show Product list in cart?
Title: Re: Put product images in the cart module.
Post by: Milbo on December 15, 2016, 14:31:37 PM
Please use this version

http://dev.virtuemart.net/attachments/download/1037/com_virtuemart.3.0.18.6_extract_first.zip

it loads now the products. It needs your layout changes.
Title: Re: Put product images in the cart module.
Post by: ARTIFIEDWEB on December 15, 2016, 14:42:19 PM
Thank you VERY MUCH!
I will continue posting some changes that I include in my core overrides on every website in case you want to also import them in the main version!
Title: Re: Put product images in the cart module.
Post by: Milbo on December 15, 2016, 14:43:08 PM
I think you know, you have to thank Spyros for it, he committed the "mounting point" in vm core
Title: Re: Put product images in the cart module.
Post by: ARTIFIEDWEB on December 15, 2016, 14:44:55 PM
I do know!
I have already thanked him ;)
Title: Re: Put product images in the cart module.
Post by: Kuubs on November 26, 2018, 15:24:49 PM
Is this still correct? Do I need to switch the function prepareAjaxData($withProductImages=false) to function prepareAjaxData($withProductImages=true)?

Or can I use prodct images in my cart module without altering the core?