Is it possible to add the product image in the add to cart popup.
tried some things in padded.php but it's not giving me the image.
Thanks
I need it too...please help us :) i have tried add: <?php echo $this->product->images[0]->displayMediaFull('class="product-image"',false) ?>
but nothing :(
You can do it, but you first have to load the image into the object and then you can call the image, something like this:
<?php
if (!class_exists('VmImage')) require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php');
$productModel = VmModel::getModel('product');
$productModel->addImages($this->products,1);
echo '<a class="continue" href="' . $this->continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . JText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
if($this->products){
foreach($this->products as $product){
echo '<h4>'.JText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity).'</h4>';
echo $product->images[0]->displayMediaFull('class="product-image"',false);
}
}
?>
Thanks that works great.
I only needed this bit:
if (!class_exists('VmImage')) require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php');
$productModel = VmModel::getModel('product');
$productModel->addImages($this->products,1);
if($this->products){
foreach($this->products as $product){
echo $product->images[0]->displayMediaThumb('class="product-image"',false);
}
}
the only thing I'm facing is that I want the image to be in the center instead of on the left. Tried a lot in Firebug but haven't found the right code. Any idea?
Hello,
You could try something like this for the image code
<?php
echo $product->images[0]->displayMediaThumb(' class="product-image" style="display:block;margin:0 auto;" ',false);
?>