Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6570913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:48:58+00:00 2026-05-25T14:48:58+00:00

I’ve been working on an extension recently. However, I just ran into a snag,

  • 0

I’ve been working on an extension recently. However, I just ran into a snag, and I am wondering if I should reinstall Magento. The problem that I am running into happened yesterday. I believe that I have traced it to the root, but I don’t know how to fix it. When I attempt to submit an order, after the first one has been placed, I get the following error:

There was an error processing your order. Please contact us or try 
again later.exception 'PDOException' with message 'SQLSTATE[23000]: 
Integrity constraint violation: 1062 Duplicate entry '' for key 
'UNQ_INCREMENT_ID'' in 
/Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Statement/Pdo.php:228

Stack trace:
#0 /Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
#4 /Users/jmax/Documents/websites/max_magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
#5 /Users/jmax/Documents/websites/max_magento/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
#6 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(414): Zend_Db_Adapter_Abstract->insert('sales_flat_orde...', Array)
#7 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php(417): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Order))
#8 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Mysql4_Order_Abstract->save(Object(Mage_Sales_Model_Order))
#9 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Model/Resource/Transaction.php(150): Mage_Core_Model_Abstract->save()
#10 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Sales/Model/Service/Quote.php(183): Mage_Core_Model_Resource_Transaction->save()
#11 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Sales/Model/Service/Quote.php(238): Mage_Sales_Model_Service_Quote->submitOrder()
#12 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Checkout/Model/Type/Onepage.php(745): Mage_Sales_Model_Service_Quote->submitAll()
#13 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Checkout/controllers/OnepageController.php(499): Mage_Checkout_Model_Type_Onepage->saveOrder()
#14 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Checkout_OnepageController->saveOrderAction()
#15 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#16 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /Users/jmax/Documents/websites/max_magento/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#18 /Users/jmax/Documents/websites/max_magento/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#19 /Users/jmax/Documents/websites/max_magento/index.php(80): Mage::run('', 'store')
#20 {main}

First thing I tried: I completely disabled my extension. So, it is not my extension, but maybe it caused some change in the database that caused that. I have been developing my extension using the proper coding methods (not modifying core files, and extending as opposed to overriding as much as possible).

It appears as if the order’s increment id is not being set! I went back to Mage_Eav_Model_Entity_Type -> fetchNewIncrementId (line 141), and found that it returns void on line 145 after finding there is not increment model:

144: if (!$this->getIncrementModel()) {
145:    return false;
146: }

And, here is the SQL query that causes the problem (obviously it is not increment id):

INSERT INTO `sales_flat_order` (`coupon_code`, `protect_code`, `shipping_description`, 
`is_virtual`, `store_id`, `customer_id`, `base_discount_amount`, `base_grand_total`, 
`base_shipping_amount`, `base_shipping_tax_amount`, `base_subtotal`, `base_tax_amount`,
`base_to_global_rate`, `base_to_order_rate`, `discount_amount`, `grand_total`, 
`shipping_amount`, `shipping_tax_amount`, `store_to_base_rate`, `store_to_order_rate`, 
`subtotal`, `tax_amount`, `total_qty_ordered`, `customer_is_guest`, `customer_note_notify`, 
`customer_group_id`, `gift_message_id`, `quote_id`, `base_shipping_discount_amount`, 
`base_subtotal_incl_tax`, `shipping_discount_amount`, `subtotal_incl_tax`, `weight`, 
`customer_dob`, `increment_id`, `applied_rule_ids`, `base_currency_code`, `customer_email`, 
`customer_firstname`, `customer_lastname`, `customer_middlename`, `customer_prefix`, 
`customer_suffix`, `customer_taxvat`, `discount_description`, `global_currency_code`, 
`order_currency_code`, `remote_ip`, `shipping_method`, `store_currency_code`, `store_name`, 
`x_forwarded_for`, `customer_note`, `created_at`, `updated_at`, `total_item_count`, 
`customer_gender`, `hidden_tax_amount`, `base_hidden_tax_amount`, `shipping_hidden_tax_amount`, 
`base_shipping_hidden_tax_amount`, `shipping_incl_tax`, `base_shipping_incl_tax`) VALUES (NULL, 
'aa53a6', 'Flat Rate - Fixed', '0', '1', '4', '0', '55', '5', '0', '50', '0', '1', '1', '0', 
'55', '5', '0', '1', '1', '50', '0', '1', '0', '1', '1', NULL, '38', '0', '50', '0', '50', 
'1', NULL, '', '', 'USD', 'email@gmail.com', 'J', 'Max', NULL, NULL, NULL, NULL, '', 'USD', 
'USD', '127.0.0.1', 'flatrate_flatrate', 'USD', 
'Main Website\nMain Website Store\nDefault Store View', NULL, NULL, '2011-07-19 15:23:28', 
'2011-07-19 15:23:28', '1', NULL, '0', '0', '0', '0', '5', '5')

Is there any other information that I can provide to help come to a solution? Thank you SO much!

JMax

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:48:58+00:00Added an answer on May 25, 2026 at 2:48 pm

    Did you add any attributes to the sales/order model? In that, if you do not specifiy the increment model when adding the attribute sales/order will lose it’s increment model. This will stay even if you switch off your extension again.

    $installer->installEntities(
        'order'    => array(
            'entity_model'        => 'order',
            'table'               => 'sales/order',
            'increment_model'     => 'eav/entity_increment_numeric', //<-- This is important and might have caused the trouble!!!
            'increment_per_store' => true,
            'backend_prefix'      => 'sales_entity/order_attribute_backend',
            'attributes'          => array(
                'my_new_attribute' => array(
                'label'            => 'Omx Gift Certificates',
                'type'             => 'text',
                'global'           => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
                'visible'          => true,
                'required'         => false,
                'user_defined'     => true,
            ),
        )
    );
    

    If that is the source you can do the following:
    Erase the added columns (in this case: my_new_attribute) from the sales_flat_order table and rerun the installer of your extension (with specified increment_model of course…).

    j.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.