Magento – Integrity constraint violation: 1062 Duplicate entry – After theme change

checkoutdatabasemagento-1.9onepage-checkoutorders

After I changed my theme I am getting error messages in Magento log and also the checkout is working correctly if I use my previous theme. The other thing is it's saying Duplicate entry '63' for key 'UNQ_SALES_FLAT_ORDER_INCREMENT_ID'. I have checked the Magento database – there the increment invoice is in thousands. Could it be conflicting with an extension?

ANY Help will be appreciated. I have already checked all other answers regarding Integrity Constraints on Magento and tried all the solutions but it didn't work

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '63' for key 'UNQ_SALES_FLAT_ORDER_INCREMENT_ID', query was: 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`, `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_amnt`, `shipping_incl_tax`, `base_shipping_incl_tax`, `gift_message_id`, `auctaneapi_discounts`, `fee_amount`, `base_fee_amount`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2018-01-23 23:17:07', '2018-01-23 23:17:07', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' in /home/template/public_html/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
/home/template/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
/home/template/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
/home/template/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
/home/template/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
/home/template/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
/home/template/public_html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
/home/template/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_orde...', Array)
/home/template/public_html/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Order))
/home/template/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Mage_Sales_Model_Order))
/home/template/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
/home/template/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
/home/template/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
/home/template/public_html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(812): Mage_Sales_Model_Service_Quote->submitAll()
/home/template/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(579): Mage_Checkout_Model_Type_Onepage->saveOrder()
/home/template/public_html/app/code/local/WP/OnePageCheckout/controllers/OnepageController.php(7): Mage_Checkout_OnepageController->saveOrderAction()
/home/template/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): WP_OnePageCheckout_OnepageController->saveOrderAction()
/home/template/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
/home/template/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/home/template/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
/home/template/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/home/template/public_html/index.php(90): Mage::run('', 'store')
{main}

enter image description here

enter image description here

Best Answer

Something is wrong for your last_increment_id for this store. There is "64" value for store id 11, should be something like 11000064.