Post by davidbfranks » Wed Nov 05, 2014 10:29 pm

Hi,

I imported my data (using free Import/Export tool) to a clean install 1.5.6 to 1.5.6.4 and every time I try to edit a product I get this error:

Code: Select all

Fatal error: Uncaught exception 'ErrorException' with message 'Error: Duplicate entry '164-0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO kg_product_to_category SET product_id = '164', category_id = '0'' in /home/kickeu/public_html/kickgame.uk/system/database/mysqli.php:41 Stack trace: #0 /home/kickeu/public_html/kickgame.uk/vqmod/vqcache/vq2-system_library_db.php(20): DBMySQLi->query('INSERT INTO kg_...') #1 /home/kickeu/public_html/kickgame.uk/vqmod/vqcache/vq2-admin_model_catalog_product.php(783): DB->query('INSERT INTO kg_...') #2 /home/kickeu/public_html/kickgame.uk/vqmod/vqcache/vq2-admin_controller_catalog_product.php(84): ModelCatalogProduct->editProduct('164', Array) #3 [internal function]: ControllerCatalogProduct->update() #4 /home/kickeu/public_html/kickgame.uk/vqmod/vqcache/vq2-system_engine_front.php(74): call_user_func_array(Array, Array) #5 /home/kickeu/public_html/kickgame.uk/vqmod/vqcache/vq2-system_engine_front.php(60): Front->execute(Object(Action)) #6 /home/kickeu/public_html/kickgame.uk/ad in/home/kickeu/public_html/kickgame.uk/system/database/mysqli.php on line 41
I've searched the forums an some people suggested it was because Auto Increment was turned off in database, but I have checked and it all looks ok

I also cannot see a category ID 0 in my database?

Any help would be appreciated.

Thanks

David

Active Member

Posts

Joined
Mon Mar 04, 2013 10:31 pm
Location - London

Post by Tcalp » Wed Nov 05, 2014 11:37 pm

Hi David,

Run the following on your database to clear the error (in PHPMyAdmin or similar):

Code: Select all

DELETE FROM kg_product_to_category WHERE category_id = 0;

Increase Page Speed (#1 rated commercial extension on OpenCart Marketplace)
15in1 Essential Extensions Value Pack Premium Customer Testimonials Reward Points Extended Admin Security Lockdown Suite

Image
irc.freenode.net #opencart


User avatar
Active Member

Posts

Joined
Wed Jul 06, 2011 1:49 pm

Post by davidbfranks » Wed Nov 05, 2014 11:54 pm

Thanks,

That seems to have solved the error but now I cannot link more than 2 categories to a product, I've done an example video here - https://docs.google.com/file/d/0B2qekVM ... p=drivesdk

If you watch until the end, every time I add the 3rd category to a product when I go back to the product to edit it has disappeared?

Thanks!

Active Member

Posts

Joined
Mon Mar 04, 2013 10:31 pm
Location - London
Who is online

Users browsing this forum: No registered users and 109 guests