News:

Looking for documentation? Take a look on our wiki

Main Menu

Put product images in the cart module.

Started by ARTIFIEDWEB, November 30, 2016, 13:32:01 PM

Previous topic - Next topic

ARTIFIEDWEB

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>



Websites that STAND OUT!
Contact me if you want an amazing upgrade

ARTIFIEDWEB

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?
Websites that STAND OUT!
Contact me if you want an amazing upgrade

Studio 42

I think it not work on add to cart a new product.

ARTIFIEDWEB

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?
Websites that STAND OUT!
Contact me if you want an amazing upgrade

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ARTIFIEDWEB

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!
Websites that STAND OUT!
Contact me if you want an amazing upgrade

Milbo

I think you know, you have to thank Spyros for it, he committed the "mounting point" in vm core
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ARTIFIEDWEB

Websites that STAND OUT!
Contact me if you want an amazing upgrade

Kuubs

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?