Post by ArtGallery » Sat Mar 23, 2019 12:40 am

I usually add new products using the Import/Export Tool. The only modification of files has been what I did as described in this thread: viewtopic.php?f=202&t=210515

Today I tried adding a single product and got this error message. If I go to the products page in Admin, there is a new item added and it seems to function properly on the front end. I am clueless as to how to fix it or why it started happening other than if it was caused by the modification above. Any advice would be appreciated.


Fatal error: Uncaught exception 'Exception' with message 'Error: Duplicate entry '0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO `ua7t_product_advertise_google` (`product_id`, `store_id`, `google_product_category`) SELECT p.product_id, p2s.store_id, (SELECT c2gpc.google_product_category FROM `ua7t_product_to_category` p2c LEFT JOIN `ua7t_category_path` cp ON (p2c.category_id = cp.category_id) LEFT JOIN `ua7t_category_to_google_product_category` c2gpc 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_category` FROM `ua7t_product` p LEFT JOIN `ua7t_product_to_store` p2s ON (p2s.product_id = p.product_id AND p2s.store_id = 0) LEFT JOIN `ua7t_product_advertise_google` pag 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 (2041)' in /home/mystore/public_html/store/system/library/db in /home/mystore/public_html/store/system/library/db/mysqli.php on line 40
Last edited by ArtGallery on Thu Mar 28, 2019 5:00 am, edited 1 time in total.

New member

Posts

Joined
Sat Apr 21, 2018 7:54 am

Post by OSWorX » Sat Mar 23, 2019 1:27 am

A simple usage of the search here, will bring you the anser:
viewtopic.php?f=202&t=210640&p=749785&h ... le#p749785

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ArtGallery » Sat Mar 23, 2019 5:25 am

Thanks. I did search several times for quite a while. I find the search very difficult to use with a 5 word limit. Sometimes I get lucky, other times I get bupkis. You have to get the combination of words just right to get any meaningful results sometimes.

I have also been searching as to how to find the name of the database that OpenCart is using, again, no luck in here or out on the web. I can't apply the change if I can't tell which database to apply it to. This installation I am working on has several databases on the server and none of them other than one for Magento have names that would help figure out what installation they are associated with.

New member

Posts

Joined
Sat Apr 21, 2018 7:54 am

Post by OSWorX » Sat Mar 23, 2019 3:49 pm

ArtGallery wrote:
Sat Mar 23, 2019 5:25 am
I have also been searching as to how to find the name of the database that OpenCart is using, again, no luck in here or out on the web. I can't apply the change if I can't tell which database to apply it to. This installation I am working on has several databases on the server and none of them other than one for Magento have names that would help figure out what installation they are associated with.
Easy, simply open one of the 2 config.php (root or admin folder) ans see the entries about the DB inside there.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by ArtGallery » Mon Mar 25, 2019 6:49 am

Thank you.

New member

Posts

Joined
Sat Apr 21, 2018 7:54 am

Post by ArtGallery » Thu Mar 28, 2019 4:15 am

I found the database and ran this in the SQL box got syntax errors. What is wrong with the way I have this typed or do I have the wrong command altogether? I got this from the solution links posted here.

ALTER TABLE
mydatabaseprefix_product_advertise_google CHANGE product_advertise_google_idproduct_advertise_google_id
INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;

I also tried it as typed by someone else like this with the ` characters in the spaces between text groups:

ALTER TABLE
`mydatabaseprefix_product_advertise_google`CHANGE`product_advertise_google_idproduct_advertise_google_id`
INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;

Error message :
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INT(11) UNSIGNED NOT NULL AUTO_INCREMENT' at line 3

New member

Posts

Joined
Sat Apr 21, 2018 7:54 am

Post by straightlight » Thu Mar 28, 2019 4:30 am

ALTER TABLE
mydatabaseprefix_product_advertise_google CHANGE product_advertise_google_idproduct_advertise_google_id
INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
That is not what the link above suggests to apply. The line you mention has been modified as compared to the original provided instruction.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ArtGallery » Thu Mar 28, 2019 4:32 am

After much searching I finally found where to change the AI to enabled. I clicked on the "Change" button, then scrolled over until I found the AI column and ticked the check box, then saved it.

This was the suggestion in the link above that worked:
In short you need to go in to phpMyAdmin and change the column `product_advertise_google_id` from the table `oc_product_advertise_google ` to AUTO INCREMENT (sometimes shown as "AI").
Thanks all for the help.

New member

Posts

Joined
Sat Apr 21, 2018 7:54 am

Post by straightlight » Thu Mar 28, 2019 6:05 am

Here we go. Glad you found the way to process this query! :)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: NicNie and 382 guests