Quote Originally Posted by Georgecy View Post
Hi Guys trying to reset all products master master directory ids in 1.5.7c php 7.4 mysql 5.7 (ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION)
I get PHP Fatal error: 1366:Incorrect integer value as shown in the log below.

[17-Oct-2021 13:25:56 UTC] Request URI: /admin/index.php?cmd=store_manager&action=update_all_master_categories_id, IP address: xx.xx.xx.xx
#1 trigger_error() called at [/includes/classes/db/mysql/query_factory.php:170]
#2 queryFactory->show_error() called at [/includes/classes/db/mysql/query_factory.php:142]
#3 queryFactory->set_error() called at [/includes/classes/db/mysql/query_factory.php:269]
#4 queryFactory->Execute() called at [/admin/store_manager.php:175]
#5 require(/admin/store_manager.php) called at [/admin/index.php:11]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column 'master_categories_id' at row 1 :: UPDATE products SET master_categories_id='' WHERE products_id='2691' ==> (as called by) /admin/store_manager.php on line 175 <== in /includes/classes/db/mysql/query_factory.php on line 170.
While the existence of the log is likely because of strict mode, the real problem is that product 2691 has an undefined master category. Considering that there are or were some previous 2690 other product in your store, you likely have categories in your store. By having a master category effectively set to 0, that means you have a product within a category that has categories... A central design consideration of Zen Cart is that product are not to exist in a category that has categories.

That product needs to have its master category changed to one of the categories at the end of a branch. One way to do this is to manually navigate to any product in your store to support editing that product.

Then once on the product edit page, change the browser address so that pID=2691 and load that page.

At the top of the listing, the product likely is assigned to more than one category and a dropdown will be provided with the first option identifying something like an "error" or some other description that I can not remember at the moment. The dropdown is associated with the category(ies) to which it is assigned. Pick one of the other categories, preferably the one to which this product really should be assigned.

If that dropdown is not available, then the issue is "resolvable" (though I've found not so easily so in more recent versions of ZC) by use of the multiple categories Link manager that in 1.5.7 I find accessible through at least 2 methods. One is to navigate to a category that has product (which shouldnt have a category in it if all things have been managed "properly") and then select to copy a product.

Scroll down to the bottom of the right side window, select the button: Multiple Categories Link Manager.

Then on the right side, click the button: Select Another Product by ID# and then enter in 2691.

Now, from here it is where there may be some difficulties. I haven't sussed out why/when there are problems, but I know that in more recent versions it has not been as user friendly to reassign the master category and/or to add the product to another category so that the master category can be modified/reset. But, there is an option to update the product master category and below that there is an option to link the product to another category. In my past experience with this version of ZC, one or more of these operations just results in error messages either on screen or in the logs directory because of the way it has been reworked to also provide more options and in a way for the code to appear easier to understand. At any rate, should be able to get there after some in store operations instead of having to access the database directly.