Forums / General Questions / Error 1062:Duplicate entry for key 'PRIMARY' in products_description

Error 1062:Duplicate entry for key 'PRIMARY' in products_description

Views: 1,451

Results 1 to 7 of 7
16 Jun 2017, 9:38 AM
#1
carmokevin avatar

carmokevin

New Zenner

Join Date:
Nov 2016
Location:
Helmond
Posts:
5
Plugin Contributions:
0

Error 1062:Duplicate entry for key 'PRIMARY' in products_description

https://www.carmo.nl
ZC Version 1.5.4
PHP versie: 5.4.45-0+deb7u8 (Zend: 2.4.0)
Database: MySQL 5.5.55-0+deb7u1

Hi everyone. We are unable to modify or add new products to the website, this is new since a couple of weeks. We receive an "Warning an error has occurred"

When we open the log files we get this:

[15-Jun-2017 17:10:14 Europe/Berlin] Request URI: /admin/product.php?cPath=4102_4104&product_type=1&action=insert_product,
#1 trigger_error() called at [/store/includes/classes/db/mysql/query_factory.php:155]
#2 queryFactory->show_error() called at [/store/includes/classes/db/mysql/query_factory.php:132]
#3 queryFactory->set_error() called at [/store/includes/classes/db/mysql/query_factory.php:262]
#4 queryFactory->Execute() called at [/store/admin/includes/functions/database.php:53]
#5 zen_db_perform() called at [/store/admin/includes/modules/update_product.php:179]
#6 require(/store/admin/includes/modules/update_product.php) called at [/store/admin/product.php:62]

[15-Jun-2017 17:10:14 Europe/Berlin] PHP Fatal error: 1062:Duplicate entry '2510-3' for key 'PRIMARY' :: insert into shopproducts_description (products_name, products_description, products_url, products_id, language_id) values (‘Test product’, '', '', '2510', '3') ==> (as called by) /store/admin/includes/functions/database.php on line 53 <== in /store/includes/classes/db/mysql/query_factory.php on line 155

I have looked on 50 different webpages now but I am unable to solve the issue.

We also use the Zen-cart store manager, there i can add and modify products but not when using the CMS. Can you please assist or point me in the right direction. Many thanks.

Cheers.

Kevin
Carmo electronics.
The Netherlands.

16 Jun 2017, 9:49 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

Which operation was expected for the above error log related to products_id 2510? Was it a product update or an insert of a product?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

16 Jun 2017, 10:03 AM
#3
carmokevin avatar

carmokevin

New Zenner

Join Date:
Nov 2016
Location:
Helmond
Posts:
5
Plugin Contributions:
0

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

mc12345678:

Which operation was expected for the above error log related to products_id 2510? Was it a product update or an insert of a product?

Thank you for your fast reply. It gets better when i search in the database for that ID number the only thing that pops up, the new product i want to add. So it adds the product to the database (most of the time).

16 Jun 2017, 11:38 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

Carmokevin:

Thank you for your fast reply. It gets better when i search in the database for that ID number the only thing that pops up, the new product i want to add. So it adds the product to the database (most of the time).
Well, the sql error indicated that at least part of the product add occurred successfully based on the duplicate key error on insert. The thread title indicates that there is an issue with both adding and modifying entries.

Generally speaking, an update of a product should not cause a duplicate key on insert issue because in a stock ZC install, insert of a new product is expected to populate all tables associated such that an edit would update those fields/tables.

Thing is, in the OP it is mentioned that product is also "updated/managed" by the "Zen-Cart Store Manager", could you please elaborate on that "software" and/or its use as it might relate to this issue? There is the possibility of additional software attempting to duplicate the operations of the standard ZC process and that could cause a duplicate insert action.

Another thing, because the duplicate record indicates a language_id of 3 (not 1) as an issue, another aspect of this issue could be related (remotely? Or possibly not at all) to the use of an unaltered/uncorrected ZC 1.5.4 and multiple languages as identified in: http://www.zen-cart.com/showthread.php?215694-Known-Bugs-%28and-fixes%29-with-v1-5-4

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

16 Jun 2017, 1:42 PM
#5
carmowout avatar

carmowout

New Zenner

Join Date:
Jun 2017
Location:
Netherlands
Posts:
1
Plugin Contributions:
0

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

Problem solved,

We found out that in the products_description and categories_description tables the default value of product_name was set to NULL in the structure settings.
After the change we can add or modify any products.

We have no clue if this has any connection with the store manager.

Thank you for your time.

16 Jun 2017, 5:27 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

CarmoWout:

Problem solved,

We found out that in the products_description and categories_description tables the default value of product_name was set to NULL in the structure settings.
After the change we can add or modify any products.

We have no clue if this has any connection with the store manager.

Thank you for your time.
I didn't push for this in earlier response, but if you flush out the remaining aspects of the posting tips then it might help also identify why those two fiedls were assigned the way they were. It would be surprising if some other plugin modified the default database field settings as described. There basically is no reason to do so.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Jun 2017, 8:11 AM
#7
carmokevin avatar

carmokevin

New Zenner

Join Date:
Nov 2016
Location:
Helmond
Posts:
5
Plugin Contributions:
0

Re: Error 1062:Duplicate entry for key 'PRIMARY' in products_description

You are probably right. Thanks anyway for our assistance.

Greetings

Kevin