lat9 / zen_Image-Handler

Image Handler 5 is really meant to ease the management of product images (particularly the management of additional product images), and to help improve page performance by optimizing the product images.
GNU General Public License v2.0
2 stars 3 forks source link

Account for products in `products_to_categories` but not `products` or `products_description` #16

Closed lat9 closed 5 months ago

lat9 commented 5 months ago

As identified in this Zen Cart support-thread posting, IH's database query for products to populate in the previous/next dropdown will include products that are present in the products_to_categories table, but not in either the products or products_description. That results in logs of the ilk.

[04-Jun-2024 11:56:29 America/New_York] Request URI: /justuptown/justoffice/index.php?cmd=image_handler, IP address: 127.0.0.1, Language id 1
#0 \justoffice\includes\modules\products_previous_next.php(94): zen_debug_error_handler()
#1 \justoffice\includes\ih_manager.php(64): require('E:\\xampp\\htdocs...')
#2 \justoffice\image_handler.php(98): require('E:\\xampp\\htdocs...')
#3 \justoffice\index.php(16): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined variable $previous in \justoffice\includes\modules\products_previous_next.php on line 94.

[04-Jun-2024 11:56:29 America/New_York] Request URI: /justuptown/justoffice/index.php?cmd=image_handler, IP address: 127.0.0.1, Language id 1
#0 \justoffice\includes\modules\products_previous_next_display.php(24): zen_debug_error_handler()
#1 \justoffice\image_handler.php(195): require('E:\\xampp\\htdocs...')
#2 \justoffice\index.php(16): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined variable $position in \justoffice\includes\modules\products_previous_next_display.php on line 24.

[04-Jun-2024 11:56:29 America/New_York] Request URI: /justuptown/justoffice/index.php?cmd=image_handler, IP address: 127.0.0.1, Language id 1
#0 \justoffice\includes\modules\products_previous_next_display.php(30): zen_debug_error_handler()
#1 \justoffice\image_handler.php(195): require('E:\\xampp\\htdocs...')
#2 \justoffice\index.php(16): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined variable $previous in \justoffice\includes\modules\products_previous_next_display.php on line 30.

[04-Jun-2024 11:56:29 America/New_York] Request URI: /justuptown/justoffice/index.php?cmd=image_handler, IP address: 127.0.0.1, Language id 1
#0 \justoffice\includes\modules\products_previous_next_display.php(47): zen_debug_error_handler()
#1 \justoffice\image_handler.php(195): require('E:\\xampp\\htdocs...')
#2 \justoffice\index.php(16): require('E:\\xampp\\htdocs...')
--> PHP Warning: Undefined variable $next_item in \justoffice\includes\modules\products_previous_next_display.php on line 47.
torvista commented 5 months ago

This does not appear to be a bug with IH, but a faulty database? I would have thought that maybe producing a more informative warning would be the most appropriate response, to prompt correction of the root problem. But not silent handling?

lat9 commented 5 months ago

I agree that it's a bug in the database, but since IH was the only element of the admin that was 'catching it', I've changed to be similar to other tools, e.g. the Attributes Controller.

One thing that's been on my mind for a while is coming up with a tool that has a collection of 'checkers', one of which would report this condition.