Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default error: 1062 : Duplicate entry

    I have added three new fields called products_vendor_upc, products_final_sale, products_ship_info to table zen_products. All data is usually uploaded to the site via EP4, and everything works fine. I just realized when I add products manually to the cart, I get the "WARNING: An Error occurred, please refresh the page and try again." error.

    I repeated this 4 times and error log produces the following errors (error: 1062 : Duplicate entry) and zen_products table dispalys the correpconding data.

    When product was first added
    [14-Apr-2014 17:53:53 America/Denver] PHP Fatal error: 1062 : Duplicate entry '5332' for key 'PRIMARY' :: insert into zen_products (products_vendor_upc, products_final_sale, products_ship_info, products_id) values ('', '', '', '5332') in /public_html/includes/classes/db/mysql/query_factory.php on line 120
    table zen_products
    5332 1 10 STER_01 NULL NULL NULL 100.0000 0.0000 0.0000 0 2014-04-14 16:53:53 NULL NULL 0 0 0 33 0 1 1 0 0 0 1 0 1 0 0 0 0 100.0000 61 1 0 0 0 0 0 NULL


    Second time
    [14-Apr-2014 17:55:54 America/Denver] PHP Fatal error: 1062uplicate entry '5333' for key 'PRIMARY' :: insert into zen_products (products_vendor_upc, products_final_sale, products_ship_info, products_id) values ('12345', 'Final Sale', '<p>Ship UPS Ground</p>', '5333') in /public_html/includes/classes/db/mysql/query_factory.php on line 120
    table zen_products
    5333 1 10 STER_02 NULL NULL NULL 100.0000 0.0000 0.0000 0 2014-04-14 16:55:54 NULL NULL 0 0 0 33 0 1 1 0 0 0 1 0 1 0 0 0 0 100.0000 61 1 0 0 0 0 0 NULL


    3rd time
    [14-Apr-2014 18:00:21 America/Denver] PHP Fatal error: 1062 : Duplicate entry '5334' for key 'PRIMARY' :: insert into zen_products (products_vendor_upc, products_final_sale, products_ship_info, products_id) values ('12345', 'Final Sale', '<p>Ship UPS Ground</p>', '5334') in /public_html/includes/classes/db/mysql/query_factory.php on line 120
    table zen_products
    5334 1 10 STER_03 12345 Final Sale <p>Ship by USPS</p> 100.0000 0.0000 0.0000 0 2014-04-14 17:00:21 2014-04-14 18:29:05 NULL 0 0 0 33 0 1 1 0 0 0 1 0 1 0 0 0 0 100.0000 61 1 0 0 0 0 0 NULL


    Fourth time
    [14-Apr-2014 19:25:09 America/Denver] PHP Fatal error: 1062 : Duplicate entry '5335' for key 'PRIMARY' :: insert into zen_products (products_vendor_upc, products_final_sale, products_ship_info, products_id) values ('12345', 'Sale is final', '<p>Ships FEDEX</p>', '5335') in /public_html/includes/classes/db/mysql/query_factory.php on line 120
    table zen_products
    5335 1 10 STER_04 NULL NULL NULL 100.0000 0.0000 0.0000 0 2014-04-14 18:25 NULL NULL 0 0 0 33 0 1 1 0 0 0 1 0 1 0 0 0 0 100.0000 61 1 0 0 0 0 0 NULL


    Going back to the admin and checking for ie: products_id 5332, all information is there, and when I update anything; no more errors gets generated and everything is fine. It's only when a new product is added, the error gets generated.

    Any ideas?
    Using Zen Cart 1.5.1

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: error: 1062 : Duplicate entry

    Maybe check the update portion of the file that creates the new product to see how the new fields are used, thing is that it seems that the assignment is a bit wrong, should be assigning the other values where the product_id is used to search for, not be assigned.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: error: 1062 : Duplicate entry

    Quote Originally Posted by mc12345678 View Post
    Maybe check the update portion of the file that creates the new product to see how the new fields are used, thing is that it seems that the assignment is a bit wrong, should be assigning the other values where the product_id is used to search for, not be assigned.
    Thank you for the reply.
    What PHP file creates a new product in admin?
    Using Zen Cart 1.5.1

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: error: 1062 : Duplicate entry

    Quote Originally Posted by Kevin205 View Post
    Thank you for the reply.
    What PHP file creates a new product in admin?
    I thought it was named something like update_product.php to be found at or near admin/includes/modules/(product type)/

    In the file there are basicaally two sections, one to create a new product, the other to update the existing. Depending on the custom work done so far, there should be a section for each of those that says to add your customizations. In there you are likely to see the assignment identified in your error log (though without the specific number for the product_id, etc...) Again it seems to me that the sql statement isn't quite written right, should be something like and forgive my own "grammar" but if properly formatted: set tablename variables values where product_id=$product_id or sort of like that. I unfortunatelyoften have tolook up the proper sequence to create a sql query. One of those understand the language, but sometimes have to use a reference to speak it. :) it's a lot like learning a new language and also one of those you don't use it you lose it things.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: error: 1062 : Duplicate entry

    Thank you.
    Using Zen Cart 1.5.1

  6. #6
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: error: 1062 : Duplicate entry

    Glad to help, hope that resolved the issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v151 1062 Duplicate Entry Error Help
    By firstcapitalfirearms in forum General Questions
    Replies: 1
    Last Post: 18 Jan 2014, 01:30 AM
  2. Error 1062 Duplicate Entry
    By Betsysue in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 31 May 2008, 04:12 PM
  3. Error: 1062 Duplicate entry '0-78' for key 1
    By G33K-Chik in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 15 Apr 2008, 08:47 PM
  4. Error 1062 Duplicate Entry
    By reddog73 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 8 Sep 2006, 06:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg