1

I received a payment transaction failed email from magento today with the reason as:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`production`.`sales_flat_invoice`, CONSTRAINT `FK_SALES_FLAT_INVOICE_ORDER_ID_SALES_FLAT_ORDER_ENTITY_ID` FOREIGN KEY (`order_id`) REFERENCES `sales_flat_order` (`entity_id`) ON DELE)

This was from a customer trying to place an order. They were able to successfully place the order about 60 seconds later, leading me to believe they clicked submit, got an error message and tried again.

They were double billed though.

Here is a full stack trace from the exception log:

2015-09-13T04:01:27+00:00 ERR (3):
exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fail
s (`sitename_production_new`.`sales_flat_invoice`, CONSTRAINT `FK_SALES_FLAT_INVOICE_ORDER_ID_SALES_FLAT_ORDER_ENTITY_ID` FOREIGN KEY (`order_id`) REFERENCES `sales_flat_orde
r` (`entity_id`) ON DELE)' in /var/www/vhosts/site/html/app/code/community/Zend/Db/Statement/Pdo.php:247
Stack trace:
#0 /var/www/vhosts/site/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/vhosts/site/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/vhosts/site/html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/vhosts/site/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
#4 /var/www/vhosts/site/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
#5 /var/www/vhosts/site/html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
#6 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_invo...', Array)
#7 /var/www/vhosts/site/html/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php(425): Mage_Core_Model_Resource_Db_Abstract->save(Object(Unirgy_DropshipPo_Model_OrderInvoice))
#8 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Resource_Order_Abstract->save(Object(Unirgy_DropshipPo_Model_OrderInvoice))
#9 /var/www/vhosts/site/html/app/code/core/Mage/Sales/Model/Order.php(2222): Mage_Core_Model_Abstract->save()
#10 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Sales_Model_Order->_afterSave()
#11 [internal function]: Mage_Core_Model_Abstract->save()
#12 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array)
#13 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks()
#14 /var/www/vhosts/site/html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
#15 /var/www/vhosts/site/html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
#16 /var/www/vhosts/site/html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(784): Mage_Sales_Model_Service_Quote->submitAll()
#17 /var/www/vhosts/site/html/app/code/community/IWD/Opc/controllers/JsonController.php(627): Mage_Checkout_Model_Type_Onepage->saveOrder()
#18 /var/www/vhosts/site/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): IWD_Opc_JsonController->saveOrderAction()
#19 /var/www/vhosts/site/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#20 /var/www/vhosts/site/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 /var/www/vhosts/site/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#22 /var/www/vhosts/site/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#23 /var/www/vhosts/site/html/index.php(87): Mage::run('default', 'store')
#24 {main}

We are using IWD's one page checkout. What can cause this? We're trying to find out if this was a one time thing, or if this is something that should be a concern.

Orders have been placed since, and so far this is the only such error/payment failed with this message to have come in so far.

5
  • I hope since then you have no problem with this issue, but I have :) today one of the customers had this problem while paying. Any idea what is the issue ?
    – Rob D. A.
    Jun 20, 2017 at 11:38
  • The iwd checkout is garbage. That's the short of it. We moved away from that module and saved ourselves a lot of headaches.
    – CD Brian
    Jun 21, 2017 at 13:05
  • Good to know, thank you :) however i never had a problem with before
    – Rob D. A.
    Jun 21, 2017 at 13:55
  • What do you suggest then, which is better than this one ?
    – Rob D. A.
    Jun 21, 2017 at 13:56
  • What's your volume? Are you doing less than 20 orders a day? You probably wouldn't notice the issues with a low volume. onestepcheckout dot com has a good product, but we actually went back to the accordion checkout because as client got bigger and added more touch points, every module supports standard checkout, whereas these add ons all required custom development and introduced custom issues.
    – CD Brian
    Jun 22, 2017 at 14:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.