-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create product on 3.0.3.1 #7133
Comments
I have the same error when adding a product. How do I fix this error? |
@hung210 if you lokk at this: Arthom@0f4f4b0 |
It's the same version, Version 3.0.3.1. Do I go phpMyAdmin to change the product_advertise table? How do I go about doing what Arthom did? |
simply open phpMyAdmin, go to this table, click in the line oc_product_advertise_google on edit and check the checkbox next to A_I and save |
A_I = Autoincrement |
i have applied A_I to oc_product_advertise_google and now i am not getting any error. thanks. |
just run the below SQL query and everything will be fine.
This query will Modify the oc_product_advertise_google Table and add AUTO_INCREMENT property to this table which solves the issue of duplicate row. |
Simple
|
I got it to work already. Thank you.
On Wednesday, February 13, 2019, 7:08:11 PM PST, maskdevil <notifications@github.com> wrote:
Simple
Just go to PhphMyAdmin and look for table oc_product_advertise_google and change the Primary Key to Auto Increment, this is a bug of OC version 3.0.3.1 and fix your problem or you can run this script in your console Database
ALTER TABLE oc_product_advertise_google CHANGEproduct_advertise_google_idproduct_advertise_google_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
`
Okay?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@osworx hi, kindly explain to me how to resolve this issue pls .highly appreciated . |
Install and follow the documentation. |
No need to install anything! Simply do what is described already here several times above. And if you do not know how to do such, hire someone. |
Thanks, it happened to me too. Since the products were added successfully I already added around 60 products without fixing the db. I have just changed it correct syntax for me is
Anyhow, the I have 60 products added before I applied this change, this table is empty at this moment. So do I need to manually add something back to this table? Anything else should I fix since I already have 60 products added? thanks |
hi |
Hi guys! I have similar problem but with
Products are showing up in shop back- and frontend. I have no ideas left. Please help :/ |
ahh i see it in the 3.3.xxx bbranch. the fix has been added already product_advertise_google_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, |
fixed already. |
A Database Error Occurred Error Number: 1062 Duplicate entry '10' for key 'PRIMARY' INSERT INTO Filename: models/M_upload.php Line Number: 13 |
please can help me what wrong in my database..??thanks |
Answer: Run below solution to fix it Fixed the problem. Logged in to phpMyAdmin. Go to -> SQL DROP TABLE IF EXISTS |
I use this to solve the problem. ALTER TABLE oc_product_advertise_google MODIFY product_advertise_google_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; |
What version of OpenCart are you reporting this for?
Opencart 3.0.3.1
Describe the bug
Cannot create new product. Error following:
Fatal error: Uncaught exception 'Exception' with message 'Error: Duplicate entry '0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO
oc_product_advertise_google(
product_id,
store_id,
google_product_category) SELECT p.product_id, p2s.store_id, (SELECT c2gpc.google_product_category FROM
oc_product_to_categoryp2c LEFT JOIN
oc_category_pathcp ON (p2c.category_id = cp.category_id) LEFT JOIN
oc_category_to_google_product_categoryc2gpc ON (c2gpc.category_id = cp.path_id AND c2gpc.store_id = 0) WHERE p2c.product_id = p.product_id AND c2gpc.google_product_category IS NOT NULL ORDER BY cp.level DESC LIMIT 0,1) as
google_product_categoryFROM
oc_productp LEFT JOIN
oc_product_to_storep2s ON (p2s.product_id = p.product_id AND p2s.store_id = 0) LEFT JOIN
oc_product_advertise_googlepag ON (pag.product_id = p.product_id AND pag.store_id=p2s.store_id) WHERE pag.product_id IS NULL AND p2s.store_id IS NOT NULL AND p.product_id IN (51)' in /opencart/3031/system/library/db/mysqli.php:40 St in /opencart/3031/system/library/db/mysqli.php on line 40
To Reproduce
Steps to reproduce the behavior:
Server / Test environment (please complete the following information):
The text was updated successfully, but these errors were encountered: