Problem with Product Images
russianradiantsaDOTcom
ZC 1.5.8a
PHP 7.4.33
bootstrap 3.6.4
OPC
EO
DBIO
Options' Stock Manager
All mods are current from forum Plugins not Github
Don't think this is a boostrap problem but bootstrap and MagicThumb are not doing well together. I have removed MagicThumb for now.
This site if fed by an Excel file from the manufacture with generally four to five images of each product. The original is in the format XXXX####.jpg where XXXX is the product code and #### is the model number. The additional images are in the format XXXX####_L.jpg where L is a through c or d depending on whether there are four or five total images.
Zen Cart has no problem with properly labeling and showing the images as set witht the original as the main images and the underscores as additionals with their L in alphabetical order as expected.
The problem lies in that Zen Cart is overzealous in trying to select images for a product.
If you go to the site and search for 11, you will be shown eight items with 11 in the model number.
Clicking on the first available, results in the product page for STTK110. HOWEVER, the first set of additional images for the item are for STTK1100. It also shows images for 1101 thru 1109.
The selection is basing the results on 110 being anywhere in the image's filename. Since it is NOT showing images for 1110, we can assume (I know) that it looks at the images from the front of the image name until the first character/number does not match.
That is reinforced by the fact that, when selecting the second choice of STK1100, it results in a proper product listing of only the images matching sttk1100.jpg or sttk1100_L.jpg.
I have not experienced this before as we have been using responsive_classic with MagicThumb (a commercial image handler). It's selection proces works with responsive_classic but not with bootstrap.
I am hoping to find a way to modify the selection process to more correctly select images for a product. With over 2,000 products in a feed, it is impossible to try to manipulate image naming so that products starting with 11, 12, 13, 14, 15, 16, 17, 18, 19, and 20 would not show images not related to them.
Is it a simplle matter of having the search only look for a strict match from the filename beginning to the . or _?
Is there a change to the #image_modal that could accomplish this or is in the main zen_image? Perhaps a change in the includes/functions/htim_output.com?
Suggestions?
Re: Problem with Product Images
Have you flipped this particular site to responsive classic to see the behavior?
Re: Problem with Product Images
I suspect if you actually flip this site to responsive classic you will see the same behavior, as I found testing.
Additionally I found that if I move the images from the main images folder into an images/sub-folder then the rules for naming are stricter (base image name + the underscore for the match) and the problem goes away....
Re: Problem with Product Images
Thanks for checking. Sorry I did not mention that I had dropped to RC with the same results. That's why I pulled the thread out of bootstrap.
I can easily move images and do a mass change to the database but, I think it would be beneficial to all if I can come up with the correct sanitation for the images directory.
If you can point me in the direction of each, I'll work it out.
Re: Problem with Product Images
well, includes/modules/additional_images.php
and for the bootstrap template
includes/modules/bootstrap/bootstrap_additional_images.php
Though I think it may be on purpose that it is setup this way, looser matching in the main images folder and stricter in a sub-folder... the why I have no idea about.
staring at this https://docs.zen-cart.com/user/image...e_conventions/ made me test it.
Changing it at this point is likely to break additional images on older sites that have done their naming in a particular way.
I have no idea what your import process is but with 2009 products with ~5 images each there is somewhere between 9-11K images in the main images folder... ackk, I hate that as it is only likely to grow. I would look to figure out in the import process a way to segregate the images into sub-folder, most likely based alphanumerically based on first letter/number, basically the way bmz cache is broken down
Re: Problem with Product Images
I've run into this before on a smaller scale.
I think this could just as easily happen with 100 images and have had to "massage" image names before.
The time it would take me to manipulate all the spreadsheets being input to POSM is just not cost effective.
I think I'll start a github discussion to see if we can't geet this fixed for the general populace as well.
Re: Problem with Product Images
Quote:
Originally Posted by
barco57
well, includes/modules/additional_images.php
and for the bootstrap template
includes/modules/bootstrap/bootstrap_additional_images.php
Though I think it may be on purpose that it is setup this way, looser matching in the main images folder and stricter in a sub-folder... the why I have no idea about.
staring at this
https://docs.zen-cart.com/user/image...e_conventions/ made me test it.
Changing it at this point is likely to break additional images on older sites that have done their naming in a particular way.
I have no idea what your import process is but with 2009 products with ~5 images each there is somewhere between 9-11K images in the main images folder... ackk, I hate that as it is only likely to grow. I would look to figure out in the import process a way to segregate the images into sub-folder, most likely based alphanumerically based on first letter/number, basically the way bmz cache is broken down
Quote:
Originally Posted by
dbltoe
I've run into this before on a smaller scale.
I think this could just as easily happen with 100 images and have had to "massage" image names before.
The time it would take me to manipulate all the spreadsheets being input to POSM is just not cost effective.
I think I'll start a github discussion to see if we can't geet this fixed for the general populace as well.
First, I'm guessing that you're talking about DbIo, not POSM. Second, that alternate-additional-images' matching convention has been around since zc138a (and probably earlier), so I'm not sure what you're looking to geet (sic) fixed.
Like @barco57 indicated in the provided link, users need to RTM.
Re: Problem with Product Images
geet (Grammarly quit working on the forum.):(
Yes, in realizing I left Products off POSM, I used it rather than DBIO in the text.:blush:
I'm very familiar with the page both barco57 and you point out as I make sure it's part of a starter email sent to customers.
Yet, look at https://docs.zen-cart.com/user/image...al-information and the example using fred.jpg.
If the search for additional images was set to match all up to an underscore or ".", only options 2, 3, and 4 would be selected for fred.jpg. Espeically if the following paragraph (advising the use of the underscore) is followed.
I feel that it's not right to go beyond an underscore or period in a filename when pulling images and just the fact that it has been that way since I came to Zen Cart doesn't mean it can't be modernized.
If the main file is fred.xxx, the system would look for fred_. If the main image were freddy.xxx, the system would look for freddy_. One could go further and have fred-1.xxx, fred-2.xxx, etc where each could have their own additional images as the system is (again) matching all until the file extension.
Granted, I'm biased towards change but didn't we make it through the language changes in 1.5.8a? Seems that was pretty major. How many mods are now reporting to be not compatible with pre 1.5.8?
I'm not able to test whether seaching only for the filename up the period as I'm not sure where it is done.
Perhaps if the code doing this is pointed out, it can be modified it for a particular site's use.
Re: Problem with Product Images
I did a quick test on my site, (Image Handler in use) using imagename.jpg as the main image.
/images/subdirectory/imagename.jpg : loaded, correct
/images/subdirectory/imagename_1.jpg: loaded, correct
/images/subdirectory/imagename00.jpg: NOT loaded, correct
/images/imagename.jpg : loaded, correct
/images/imagename_1.jpg: loaded, correct
/images/imagename00.jpg: loaded, NOT CORRECT
So, looks like a bug to me.
Never spotted this as I have always used subdirectories.
Re: Problem with Product Images
Quote:
Originally Posted by
torvista
I did a quick test on my site, (Image Handler in use) using imagename.jpg as the main image.
/images/subdirectory/imagename.jpg : loaded, correct
/images/subdirectory/imagename_1.jpg: loaded, correct
/images/subdirectory/imagename00.jpg: NOT loaded, correct
/images/imagename.jpg : loaded, correct
/images/imagename_1.jpg: loaded, correct
/images/imagename00.jpg: loaded, NOT CORRECT
So, looks like a bug to me.
Never spotted this as I have always used subdirectories.
I beg to differ on the "correctness" of the highlighted image name. From the docs (https://docs.zen-cart.com/user/image...-information):
Quote:
Original Image: fred.jpg
All of these are considered additional images because they contain the base image name:
/images/fredabc.jpg
/images/fred_73b2.jpg
/images/fred_01.jpg
/images/fred_02.jpg
/images/freddy.jpg
/images/fredrick.jpg