Database error: Duplicate entry '6053-9-1' for key 1 (1062)

Database error: Duplicate entry ‘6053-9-1’ for key 1 (1062)



Help, I’ve been getting this error recently every time I try to clone a product (I do this when I’m creating a new cable length, makes it quicker).



This only started happening after I uploaded a price update. I use 4 user groups (retail, government, etc.).



The full message is below:

[SIZE=“1”]Database error: Duplicate entry ‘6053-9-1’ for key 1 (1062)

Invalid query: INSERT INTO cscart_product_prices (product_id, price, lower_limit, usergroup_id) VALUES (‘6053’, ‘3.10’, ‘1’, ‘9’)



Backtrace:

File: /var/www/vhosts/phantomcables.com/httpdocs/store/core/fn.database.php

Line: 310

Function: db_error

File: /var/www/vhosts/phantomcables.com/httpdocs/store/controllers/admin/products.php

Line: 1433

Function: db_query

File: /var/www/vhosts/phantomcables.com/httpdocs/store/controllers/admin/products.php

Line: 1149

Function: fn_clone_product

File: /var/www/vhosts/phantomcables.com/httpdocs/store/core/fn.control.php

Line: 567

Function: include

File: /var/www/vhosts/phantomcables.com/httpdocs/store/core/fn.control.php

Line: 422

Function: fn_run_controller

File: /var/www/vhosts/phantomcables.com/httpdocs/store/adminphantom.php

Line: 28

Function: fn_dispatch[/SIZE]






Does anyone know of a way to fix this?

Thank you in advance for any assistance.

From what it’s telling me - You already have the value that you are attempting to enter into the database. Make a backup of your database and then delete the key. See what happens.

Thanks for the tip Jesse. I’ve backed up my database now - how would I delete the database key?

Actually I just tried something and it looks like it worked.



I deleted the other User Group prices before I cloned the product. I then cloned it and then added the other User Group prices back to the original product and the cloned product. Not really a fix for the for the problem but at least it’s a way around it. Weird bug.



So basically CS-Cart won’t let me clone a product if it has additional User Group pricing.



Thanks for the help Jesse.