add

Displaying the 1st image

16 posts in this topic

Hello, I have several images for each of my products. How can I make it just display the 1st image as my product thumbnail instead of randomly take it from my series of images?

Share this post


Link to post
Share on other sites

Hello tronghm. I've purchased your BT e-commerce template. Right now everything's great. The only thing that I need right now is to know how to make the bt product slider to display the 1st image from my several product images. I really need this asap so that I can put my website online. Hope to hear from you soon. Thanks.

Share this post


Link to post
Share on other sites

Hi

This is solution for you

Please use this code to change original one in file /classes/virtuemart.php at line 181


if ($this->_params->get('show_image')) {
$select[] = 'GROUP_CONCAT(i.`file_url` SEPARATOR \',\') as thumbnail';
$from .= ' LEFT JOIN (SELECT * FROM `#__virtuemart_product_medias` as sub_md ORDER BY sub_md.`ordering`) as md ON p.`virtuemart_product_id` = md.`virtuemart_product_id`';
$from .= ' LEFT JOIN `#__virtuemart_medias` as i ON md.`virtuemart_media_id` = i.`virtuemart_media_id`';
}

Look forward a good news

:)

Share this post


Link to post
Share on other sites

Hello

It still doesn't solve the problem. I've even deleted all the product images from the bt_productslider/images folder but it still take the thumbnail randomly. I'm using joomla 2.5.7 and virtuemart 2.0.16. Do you have any other solution?

Right now I've put the prefix "1." to all of the 1st image of my products. Maybe you can tweak the code to choose based on that?

Share this post


Link to post
Share on other sites

Hi

I tried this code on my local and it works. Please try to clear cache of your site and your browser.

If it doesn't still work, may be, i need to do it on your site directly with your url and admin account. Please give them to me via extensions@bowthemes.com

Then i could consider your solution.

Share this post


Link to post
Share on other sites

Hello. I still can't resolved the issue. I've sent the details to the email you mentioned. Hope to hear from you soon. Thanks!

Share this post


Link to post
Share on other sites

HI again

Sorry i forgot that the query still has a "Order" statement at end which you can choose in back end. As you are setting, it must be "Random".

I didn't include it in my query when I tested

So please change all above code to


if ($this->_params->get('show_image')) {
$select[] = 'GROUP_CONCAT(i.`file_url` SEPARATOR \',\') as thumbnail';
$from .= ' LEFT JOIN (SELECT * FROM (SELECT * FROM `js_virtuemart_product_medias` ORDER BY ordering) as sub_md GROUP BY sub_md.`virtuemart_product_id`) as md ON p.`virtuemart_product_id` = md.`virtuemart_product_id`';
$from .= ' LEFT JOIN `#__virtuemart_medias` as i ON md.`virtuemart_media_id` = i.`virtuemart_media_id`';
}

I insert a new sub Select statement. But it will make website slower when number of product becomes huge.

I hope this time will be fix problem :D

Share this post


Link to post
Share on other sites

Hello,

Same problem here. Images thumbs are displaying randomly and I'd like to show first image thumbnail only.

I am using T Product Slider Module Version 1.0.0 with BT Ecommerce template. I've tried to folow you advice but changing code resulted in some errors:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\mikoda\modules\mod_bt_productslider\classes\virtuemart.php on line 71

No result...

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\mikoda\modules\mod_bt_productslider\classes\virtuemart.php on line 66

No result...

I am using Virtuemart 2.0.20b.

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply but unfortunately replacing that file did not help. Flipbook layout was messed up (images are displayed in one column, one afrter another) and in responsive layou I got that message:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\mikoda\modules\mod_bt_productslider\classes\virtuemart.php on line 66

No result...

Share this post


Link to post
Share on other sites