News:

Support the VirtueMart project and become a member

Main Menu

virtuemart3 shows 2 images with mouse hover

Started by aminweb, April 14, 2016, 09:21:57 AM

Previous topic - Next topic

aminweb


I need to show 2 images per products in categories menu. Please http://velikorodnov.com/virtuemart/reviver/index.php/men
this link for more clarification. To do this ,I have used below code in sublayouts folder and products.php files:


<div class="img-wrapper">
                               <?php
                                        $image 
$product->images[0]->displayMediaThumb('class="browseProductImage featuredProductImageFirst" id="Img_to_Js_'.$product->virtuemart_product_id.'" border="0"',false) ;
                                        if(!empty(
$product->images[1])){
                                         
$image2 $product->images[1]->displayMediaThumb('class="browseProductImage featuredProductImageSecond"  border="0"',false) ;
                                        } else {
$image2$product->images[0]->displayMediaThumb('class="browseProductImage featuredProductImageSecond"  border="0"',false) ;}
                                        echo 
JHTML::_('link'JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),'<div class="front">'.$image.'</div><div class="back">'.$image2.'</div>');
                                
?>

                                </div>



but didn't work out.It shows only one image live demo: http://new.decoricor.com/decoricor-jewelery/hair-style

Studio 42

VIrtuemart get only 1 image in category display using $productModel->addImages($this->products,1);

If you need more, in the template overide for eg.:
$productModel = VmModel::getModel('product');
$productModel->addImages($product,2);
//Add this before your code you can remove 2, if you need all

Not this is not very optimised, but is safe.


farketmez99

aminweb, I see you resolve it. how do you do? I can not find second image code