News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Image not showing up in the product page and administration

Started by Kuubs, January 28, 2021, 14:25:12 PM

Previous topic - Next topic

Kuubs

I have a very weird and strange issue. My images are not showing into the administration section of the product and also not on the product page on the frontend. I checked the media manager of virtuemart and the picture is there. I also checked the database and in the media products table the link is there. But it is not showing. Anyone has any idea why this happens?

Jörgen

VM version ...
Php version ...
Joomla version ...
Upgraded ...
Alway been this way ...
Screen shots ....

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Kuubs

VM version 3.8.6
PHP version 7.2
Joomla version 3.9.24

What do you mean by upgraded and Always has been this way?

Of what do you want screenshots?

Jörgen

Shooting in the dark here but I think I meant:

Screenshots front end, showing no images
Screenshots back end showing no images
Has it always been this way ? OR have You upgraded something VM, PHP, Joomla etc ?

Jörgen @ Kreativ Fotografi

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Kuubs

Quote from: Jörgen on January 28, 2021, 15:29:50 PM
Shooting in the dark here but I think I meant:

Screenshots front end, showing no images
Screenshots back end showing no images
Has it always been this way ? OR have You upgraded something VM, PHP, Joomla etc ?

Jörgen @ Kreativ Fotografi

It just displays the standard no image... I find it just really strange behaviour, because everything always worked, maybe there are too mcuh products? I don't really know how this happens. Everything seems to be correct, the files are accessible, the database relations are correct but the images just aren't showing up.

Kuubs

Here is a video:

https://streamable.com/sxjsq2

I did some debugging and it seems that every image is there, in the database, but it is just not showing up. Maybe it has something do with memory of the server?

I tried increasing the max_input_vars and the memory limit, but that didn't do much. I tried enabling the developer mode to see what happens but i don't see anythign weird about it.

EDIT: Ok i did some more debugging,, maybe it could be the xref table? How can I fix this?

Jörgen

Are the images visible in the product view in back end ?

This is just some guesswork, are You having more than 10 000 images in one directory ? This can lead to some funny behaviour on some servers and some file commands.
I have divided my product images into subdirectories under products, just to avoid issues I had with to many images in one directory. Could be worth checking out.

Jörgen @ Kreativ Fotografi

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Kuubs

Quote from: Jörgen on January 28, 2021, 20:41:22 PM
Are the images visible in the product view in back end ?

This is just some guesswork, are You having more than 10 000 images in one directory ? This can lead to some funny behaviour on some servers and some file commands.
I have divided my product images into subdirectories under products, just to avoid issues I had with to many images in one directory. Could be worth checking out.

Jörgen @ Kreativ Fotografi

Yes, yes yes yes. That's it. I have more that 10.000 in one directory.

How did you manage? Is there a possibility to change server behaviour? Or do i need to go your way and split it all up? And how did you do that with so many products and so many images?

Jörgen

Hello

I made this directory structure :

products/category1
products/category2

You can make other structure choises f.e manufacturer.

Then I use the the Regular Labs DB replacer to batch change the URLs in the virtuemart dbase for images. If the images are some how structured named this is quite easy.
https://regularlabs.com/extensions/dbreplacer
This is actually a kind of wysiwyg PhpMyAdmin and is quite useful when you get the hang of it :)

Finally I got help from Patrick at studio42 and he changed the behaviour of his image upload plugin to accept one level of subdirectory under products.
https://shop.st42.fr/en/products/multi-upload-images.htm

I use this for uploading new images.

If Your image structure is some what chaotic you have a more tedious work ahead. But one idea is just to move enough images to a subdirectory to go below 10 000 and from there on using the new structure and adding new images in subdirectories as you go along.

I hope it will work for you too.

Jörgen @ Kreativ Fotografi


Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

huubs, you get same problem if you try to display by FTP the files. It only display 10 000 files
The only safe solution is to create and use sub directories in product media folder for eg. 2020/ 2021/ ...

Jörgen

Thanks studio42 for agreeing with me, using subdirectories does the trick. But std VM does not handle the upload very well. But once uploaded with your plugin it works like a charm.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Kuubs

Ok I completely removed all the images, products and so forth, and imported all back in. But now I have 3771 images in my product folder, and it still causes issues. When I check a product i shows no image:

https://i.imgur.com/fOBE0wk.png

But when I click on the image, so that I go to the media manager in Virtuemart, it shows the image:

https://i.imgur.com/uzZnViG.png

I seriously don't understand what is wrong. When I check the database all is correct. The relations are set in the media_product table and the image itself is also there. Anyone encountered this bug before? What is the issue?


Jörgen

What is the URL for the image in product view ? Is it really correct ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Kuubs

Quote from: Jörgen on February 10, 2021, 11:11:54 AM
What is the URL for the image in product view ? Is it really correct ?

Jörgen @ Kreativ Fotografi

What do you mean?

When I open the product there is no image linked. But in the database the relations are there. The ID of the image and the ID of the product are linked. But it does not show up. I am wondering why this happens.

I import the images via a plugin and write it directly to the database, maybe that's the issue?

These are the 2 lines of code I use to add it to the database:

$db->insertObject('#__virtuemart_medias', $obj ,'virtuemart_media_id');
$db->insertObject('#__virtuemart_product_medias', $p ,'id');


I don't know how this happens. I seriously cannot wrap my head around it. Can some experienced Virtuemart developer tell me why this happens? This should be not happening? The relations are there, why is the product media not shown??





EDIT: I found the solution!!!

In the __virtuemart_products table there is a column which indicates whether a product has images or not (has_media) when I change these to 1 it works. Not sure why the developers choose for this column (if it's in the media relations table that should be the indicator but w/e) now it works. So if anyone encounters these issues, you should look into that.

Jörgen

Nice that it works for You now.
It can be nice to restrict the number of files in one directory and make sure you do not hit 10 000 items. Have You divided the images in subdirectories ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.