Whenever i try to delete an order, by entering the order and then clicking cancel, i get a "The order has not been cancelled" Message.

I tried deleting the order from the list, and issuing an action from it and i got this error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`databasename`.`catalog_product_entity_int`, CONSTRAINT `FK_CAT_PRD_ENTT_INT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DEL)

#0 /home/cashapoy/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/cashapoy/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/cashapoy/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/cashapoy/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /home/cashapoy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /home/cashapoy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1910): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /home/cashapoy/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1463): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('catalog_product...', Array, Array)
#7 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Action.php(84): Mage_Eav_Model_Entity_Abstract->_processAttributeValues()
#8 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Product/Action.php(72): Mage_Catalog_Model_Resource_Product_Action->updateAttributes(Array, Array, 0)
#9 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Product/Status.php(203): Mage_Catalog_Model_Product_Action->updateAttributes(Array, Array, 0)
#10 /home/cashapoy/public_html/app/code/core/Mage/Sales/Model/Order.php(1167): Mage_Catalog_Model_Product_Status->updateProductStatus('541', 0, 1)
#11 /home/cashapoy/public_html/app/code/core/Mage/Sales/Model/Order.php(1139): Mage_Sales_Model_Order->registerCancellation()
#12 /home/cashapoy/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(359): Mage_Sales_Model_Order->cancel()
#13 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_OrderController->massCancelAction()
#14 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('massCancel')
#15 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /home/cashapoy/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#17 /home/cashapoy/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#18 /home/cashapoy/public_html/index.php(87): Mage::run('', 'store')
#19 {main}

What exactly is going on and what can i do about it?

The product that once belonged to that order has been deleted, but this had not been an issue until yesterday.

Any idea why this could be happening?

closed as off-topic by Matthias Zeis, Keyul Shah, Mufaddal, Moose, Marius Nov 20 '14 at 6:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced OR seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Matthias Zeis, Keyul Shah, Mufaddal, Moose, Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You should do a backup of your database and use this tool to check your database magentocommerce.com/wiki/1_-_installation_and_configuration/… You should do it on a database copy first to see errors which may apply. To use this tool, you need to install a clean magento with the same version of your current installation on a separate database then launch the script. You may find that you have bad foreign keys definition for example – Sylvain Rayé May 23 '13 at 19:41
  • I did run the database repair tool and to my joy, it found plenty of errors, which it promptly corrected. But, i still can't cancel those orders, for the same reasons... – Unckmania May 23 '13 at 23:21
  • Is Magento set to put the item's status back to 'In Stock' when order is cancelled. Check the System Configuration value under "System > Configuration > Catalog/Inventory > Set Items' Status to be In Stock When Order is Cancelled" If you've deleted thew product, then clearly this can't happen – Dave Farthing Apr 21 '14 at 22:47

The problem is, you have in catalog_product_entity_int a reference to a non existing product in catalog_product_entity.

I would say this is from a bad import.

You should check between these two tables ... just join and check for NULL values.

Not the answer you're looking for? Browse other questions tagged or ask your own question.