VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: johnknit on September 28, 2021, 16:54:07 PM

Title: choose other product image in category view
Post by: johnknit on September 28, 2021, 16:54:07 PM
I want to show the 3 image in the category view.
In the category template (category/default) i changed the number$product->image[0] from 0 to 2 in this line
But nothing changes.It still showing the first image
      // Show Products
      ?>
      <div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
         <div class="spacer" style="min-height:auto;">
            <div class="width90 floatleft center">
                <a title="<?php echo $product->link ?>" rel="vm-additional-images" href="<?php echo $product->link; ?>">
                  <?php
                     echo $product->images[0]->displayMediaThumb('class="browseProductImage"', true);
                  ?>
How can this be done?
Title: Re: choose other product image in category view
Post by: GJC Web Design on September 28, 2021, 21:03:29 PM
first in config set the number of images

administrator\components\com_virtuemart\virtuemart.cfg

prodimg_browse=3

then the images are available in your template as

echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
echo $product->images[1]->displayMediaThumb('class="browseProductImage"', false);
echo $product->images[2]->displayMediaThumb('class="browseProductImage"', false);
Title: Re: choose other product image in category view
Post by: johnknit on September 29, 2021, 15:45:36 PM
Thanks for your reply.

I follow the instuctions but in the virtuemart.cfg was no prodimg_browse.
So i addid it in the shopfront part.

after i changed echo $product->images[1]->displayMediaThumb('class="browseProductImage"', false);
nothing changed stil using the first image

i emptied the caches.
I am uising VM VirtueMart 3.8.8 10472 Joomla! 3.9.28 Stable [ Amani ] 6-July-2021 15:00 GMT
Title: Re: choose other product image in category view
Post by: Jörgen on September 29, 2021, 20:33:49 PM
I guess you are using overrides in the templates directory.

Jörgen
Title: Re: choose other product image in category view
Post by: johnknit on September 30, 2021, 07:46:20 AM
Yes, indeed.
We need it because it only in 1 category where need to show the 3e image.
Title: Re: choose other product image in category view
Post by: Jörgen on September 30, 2021, 20:36:34 PM
Then You have to modify your override file.

Jörgen
Title: Re: choose other product image in category view
Post by: johnknit on October 01, 2021, 09:55:16 AM
I have copied and renamed the default.php and saved it to the joomla override folder; /tempalte/html/.................
After in made also several other changes these changes are showed but the "image[1]" is still not working.
Gives error  Call to a member function displayMediaThumb() on null
Only when the first image[0] is showed the page is working
Title: Re: choose other product image in category view
Post by: GJC Web Design on October 02, 2021, 19:20:37 PM
QuoteI follow the instuctions but in the virtuemart.cfg was no prodimg_browse.
So i addid it in the shopfront part.

what does this mean?

have you now saved your VM config in the admin?
Title: Re: choose other product image in category view
Post by: Studio 42 on October 04, 2021, 14:55:34 PM
If you change as explained by GJC Web Design
administrator\components\com_virtuemart\virtuemart.cfg
prodimg_browse=3
You need to go in admin>virtuemart>config and save it, to be sure this parameter is update