News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Add product image to "Add to cart" popup VirtueMart 3

Started by yegor, February 06, 2016, 13:10:34 PM

Previous topic - Next topic

yegor

In file templates\YOUR_TEMPLATE\html\com_virtuemart\cart\padded.php

After the code:
if($this->products){
foreach($this->products as $product){
if($product->quantity>0){


Add next code:

/* Add images to product */
if (!class_exists( 'VmModel' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'vmmodel.php');
$productModel = VmModel::getModel('Product');
$productModel->addImages($product);

/* Display first image */
echo($product->images[0]->displayMediaThumb('class="browseProductImage"', false));


-----
Yegor Kaliberda

prokops

Does not work on my VM 3.0.14. Popup never displays, indicating a php error.

Anyone care to review the code to make it work ? I would also love to have the modal to show images.

Cheers,
prokop

Ghost

This works for me on 3.0.16:
VmModel::getModel('Product')->addImages($product);
echo $product->images[0]->displayMediaThumb('class="popupProductImage"', false);

AH

prokops

post your configuration - you are having issues with displaymediaThumb

Check php and Vm versions etc
Regards
A

Joomla 3.10.11
php 8.0

prokops

It seems the fault was on my outdated "padded.php" in my html override folder.

I corrected the mistake and now it works! Thanks a lot, problem solved :)

AH

Regards
A

Joomla 3.10.11
php 8.0