Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

“there was an error processing your order”—foreign key constaint issue? 
 
bmcauliffe
Jr. Member
 
Total Posts:  10
Joined:  2008-04-27
 

We upgraded from 1.4.0 to 1.4.2. Everything seems fine but at the very end of the checkout process, we get an error when you click “place order.” I’ve scoured the forum and googled for this but cannot find an answer fitting our situation. It looks like it’s an issue with a foreign key constraint. I tried deleting some foreign keys in sales related tables but still getting the same error. We’re just about to go live with this and I can’t fix it. Please help!!

Error Log:

2011-01-27T02:08:02+00:00 ERR (3):
exception ‘Mage_Eav_Model_Entity_Attribute_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`gn_store/sales_flat_order_item`, CONSTRAINT `FK_SALES_FLAT_ORDER_ITEM_PARENT` FOREIGN KEY (`order_id`) REFERENCES `sales_flat_order` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE)’ in /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Eav/Model/Entity/Abstract.php:608
Stack trace:
#0 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1429): Mage_Eav_Model_Entity_Abstract->walkAttributes(’backend/afterSa...’, Array)
#1 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Eav/Model/Entity/Abstract.php(940): Mage_Eav_Model_Entity_Abstract->_afterSave(Object(Mage_Sales_Model_Order))
#2 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Model/Abstract.php(284): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Sales_Model_Order))
#3 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Model/Resource/Transaction.php(150): Mage_Core_Model_Abstract->save()
#4 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Sales/Model/Service/Quote.php(149): Mage_Core_Model_Resource_Transaction->save()
#5 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Checkout/Model/Type/Onepage.php(607): Mage_Sales_Model_Service_Quote->submit()
#6 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Checkout/controllers/OnepageController.php(450): Mage_Checkout_Model_Type_Onepage->saveOrder()
#7 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#8 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch(’saveOrder’)
#9 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Controller/Varien/Front.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#11 /var/www/vhosts/growingnaturals.com/httpdocs/store/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#12 /var/www/vhosts/growingnaturals.com/httpdocs/store/index.php(78): Mage::run(’’, ‘store’)
#13 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
furnitureforyoultd
Enthusiast
 
Total Posts:  833
Joined:  2009-03-09
 

if you’ve deleted foriegn key constraints then you’ll need to repair your database. do a separate fresh install of 1.4.2 to use as your reference database and then use the database repair tool: http://www.magentocommerce.com/download

the script should repair missing links, add missing tables etc. when it’s completed try another transaction and see if the error is resolved

 
Magento Community Magento Community
Magento Community
Magento Community
 
uspri
Jr. Member
 
Total Posts:  1
Joined:  2013-04-27
 

I have the same Error, after the Update fails. The Repairtool find no Errors. Please Help.

Here is the Backtrace:

2013-05-12T06:03:27+00:00 ERR (3):
exception ‘Mage_Eav_Model_Entity_Attribute_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`d00db19a`.`sales_flat_order_item`, CONSTRAINT `FK_SALES_FLAT_ORDER_ITEM_PARENT` FOREIGN KEY (`order_id`) REFERENCES `sales_flat_order` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE)’ in /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Eav/Model/Entity/Abstract.php:608
Stack trace:
#0 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1429): Mage_Eav_Model_Entity_Abstract->walkAttributes(’backend/afterSa...’, Array)
#1 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Eav/Model/Entity/Abstract.php(940): Mage_Eav_Model_Entity_Abstract->_afterSave(Object(Vianetz_AttachTermsAndConditions_Model_Order))
#2 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Model/Abstract.php(284): Mage_Eav_Model_Entity_Abstract->save(Object(Vianetz_AttachTermsAndConditions_Model_Order))
#3 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Model/Resource/Transaction.php(150): Mage_Core_Model_Abstract->save()
#4 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Sales/Model/Service/Quote.php(149): Mage_Core_Model_Resource_Transaction->save()
#5 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Checkout/Model/Type/Onepage.php(607): Mage_Sales_Model_Service_Quote->submit()
#6 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Checkout/controllers/OnepageController.php(450): Mage_Checkout_Model_Type_Onepage->saveOrder()
#7 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#8 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch(’saveOrder’)
#9 /www/htdocs/w00aaba6/linsenshop/app/code/community/ArtsOnIT/OfflineMaintenance/Controller/Router/Standard.php(46): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Controller/Varien/Front.php(177): ArtsOnIT_OfflineMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /www/htdocs/w00aaba6/linsenshop/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#12 /www/htdocs/w00aaba6/linsenshop/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#13 /www/htdocs/w00aaba6/linsenshop/index.php(80): Mage::run(’’, ‘store’)
#14 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top