Forums / General Questions / Can't Add any new categories?

Can't Add any new categories?

Views: 578

Results 1 to 4 of 4
14 Feb 2020, 10:07 PM
#1
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

Can't Add any new categories?

Fresh Install 1.5.6c
PHP 7.1

All of a sudden Can't add any new categories.

[14-Feb-2020 21:02:14 UTC] Request URI: /admin/categories.php?action=insert_category&cPath=, IP address: 100.2.167.42#1 trigger_error() called at [/home/teer/public_html/includes/classes/db/mysql/query_factory.php:171]
#2 queryFactory->show_error() called at [/home/teer/public_html/includes/classes/db/mysql/query_factory.php:143]
#3 queryFactory->set_error() called at [/home/teer/public_html/includes/classes/db/mysql/query_factory.php:270]
#4 queryFactory->Execute() called at [/home/teer/public_html/admin/includes/functions/database.php:51]
#5 zen_db_perform() called at [/home/teer/public_html/admin/categories.php:103]
--> PHP Fatal error: 1364:Field 'categories_promotion_id' doesn't have a default value :: insert into categories (sort_order, parent_id, date_added) values ('0', '0', now()) ==> (as called by) /home/teer/public_html/admin/includes/functions/database.php on line 51 <== in /home/teer/public_html/includes/classes/db/mysql/query_factory.php on line 171.

the files in question have not been touched.
Thanx
Mike

14 Feb 2020, 10:33 PM
#2
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

Re: Can't Add any new categories?

My SQL mode is

MySQL Mode: 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

is this the problem?

14 Feb 2020, 11:08 PM
#3
mikebr avatar

mikebr

Zen Follower

Join Date:
May 2007
Posts:
124
Plugin Contributions:
0

Re: Can't Add any new categories?

With PHPmyadmin
In the Categories Table I changed the Default value for the field categories_promotion_id from none to Null.
Everything is working now.
Why did i get this error now after many new categories were added?
thanx
Mike

15 Feb 2020, 12:44 AM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: Can't Add any new categories?

The field categories_promotion_id is not native to Zen Cart, so it's not handled by the Zen Cart core code.
When you added it, it was added with no default, probably under MySQL 5.6.
Your hoster updated to MySQL 5.7. Now, this is not allowed - you either have to set the value in the insert, or say null is allowed, or have a default value.

That's why.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.