VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: icelucio on May 09, 2013, 02:05:16 AM

Title: change product thumb in category view
Post by: icelucio on May 09, 2013, 02:05:16 AM
Hi, I don't want the first thumb as default preview of the product in category view... I want the last image/thumb of the product

Where can I edit the db query (from first to last, from "ASC" to "DESC") ?

In $product->images there ins't an array with all the images of the product but only AN IMAGE ($product->images[0]) so I can't take the last or invert the array.

Can you help me please? Thank you, Lucio
Title: Re: change product thumb in category view
Post by: icelucio on May 09, 2013, 10:36:07 AM
Hi all, I've found a solution that worked fine for me and for my question

http://forum.virtuemart.net/index.php?topic=97744.0;prev_next=next#new

in the 8th answer there is "the light"  ;)

Edit  "/components/com_virtuemart/views/category/view.html.php" @ about line 170.
change this line:      $productModel->addImages($products,1);
to:                          $productModel->addImages($products);
... now all images of the product will be loaded from db

In my override folder "com_virtuemart\category\default.php"
I've added:              $product->images = array_reverse($product->images);
Just before:             echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
... now the first image is the last of the product.

Have a nice day, Lucio