I suspect it to be caused by one of the modules I recently installed, everytime I try to save a product review I get that message: An error occurred while updating the selected review(s). Any idea where it's coming from? Anyone ever had that problem?

Here's the log:

  2015-05-01T20:03:56+00:00 DEBUG (7): Exception message: SQLSTATE[23000]: 
  Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`database_name`.`salesrule_website`, CONSTRAINT `FK_SALESRULE_WEBSITE_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE )
    Trace: #0 /public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #1 /public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #2 /public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #3 /public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
    #4 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
    #5 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1910): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
    #6 /public_html/app/code/core/Mage/Rule/Model/Resource/Abstract.php(137): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('salesrule_websi...', Array, Array)
    #7 /public_html/app/code/core/Mage/SalesRule/Model/Resource/Rule.php(116): Mage_Rule_Model_Resource_Abstract->bindRuleToEntity('258', Array, 'website')
    #8 /public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_SalesRule_Model_Resource_Rule->_afterSave(Object(Mage_SalesRule_Model_Rule))
    #9 /public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_SalesRule_Model_Rule))
    #10 /public_html/app/code/community/QS/Notification/Model/Notification.php(121): Mage_Core_Model_Abstract->save()
    #11 /public_html/app/code/community/QS/Notification/Model/Review.php(67): QS_Notification_Model_Notification->createCartRule(Object(Varien_Object))
    #12 /public_html/app/code/community/QS/Notification/Model/Review/Observer.php(222): QS_Notification_Model_Review->sendNotification('ilonasoboleva@c...', Array, '2818')
    #13 /public_html/app/code/core/Mage/Core/Model/App.php(1338): QS_Notification_Model_Review_Observer->catchReviewAfterSave(Object(Varien_Event_Observer))
    #14 /public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(QS_Notification_Model_Review_Observer), 'catchReviewAfte...', Object(Varien_Event_Observer))
    #15 /public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('review_save_aft...', Array)
    #16 /public_html/app/code/core/Mage/Core/Model/Abstract.php(466): Mage::dispatchEvent('review_save_aft...', Array)
    #17 /public_html/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Core_Model_Abstract->_afterSave()
    #18 /public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php(130): Mage_Core_Model_Abstract->save()
    #19 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Catalog_Product_ReviewController->saveAction()
    #20 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('save')
    #21 /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))
    #22 /public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    #23 /public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
    #24 /public_html/index.php(95): Mage::run('', 'store')
    #25 {main}

One more edit: I suspect this module to be the cause, I have installed 3 modules this week, that's the only one that would need to look at the website_ID

  • if it's due to a module you've installed we can't reproduct the error. Please specify at least which module – Sander Mangel May 1 '15 at 20:23
  • Thanks for your fast reply. I was expecting this response ;) - I've uninstalled everything but the problem comes from the tables that were created with the modules. I have no idea which module it is though... – Hiboomedia May 1 '15 at 20:29

The error says:

You try to save a data set into salesrule_website without satisfying the FK FK_SALESRULE_WEBSITE_WEBSITE_ID_CORE_WEBSITE_WEBSITE_ID which means, that you don't have a website set.

Whatever this is caused by, I think you have to dig into the code, I recommend xdebug to check, why no website_id is set on your data set.

  • 1
    Or try blackfire.io to see what code is touching the request (yes, I'm a huge Blackfire fan now) – Sander Mangel May 1 '15 at 20:36

it seems to be a problem with one of your module

According to the stacks information you gave us, I would bet on the Module Notification within the namespace QS. (QS/Notification) QS seems to be QuartSoft, do you have any module from QuartSoft ? Does it ring you a bell? try to disable it and check if it's working..

Probably a compatibility problem.. The message you gave us seems to a database conflict on a cascade delete..

  • maybe you have one of this module installed store.quartsoft.com/products ? – Anselme May 1 '15 at 20:49
  • You're right, it is [QuarterSoft] (store.quartsoft.com/discount-for-review). But I've had that module for over 2 years now, it's not the one causing the damage :( – Hiboomedia May 1 '15 at 20:51
  • Does not matter, there could be multiple reasons . try to unable it just for the test.. in your stack trace this is the latest module called.. are you familiar with debuggin step by step with php ? – Anselme May 1 '15 at 20:54
  • Ok Boss ;) I disabled it, cleared all cache & still causing the problem. It is disabled & I still see QS/Notification in exception.log - same message appears – Hiboomedia May 1 '15 at 21:06
  • Well this is weird.. because if it would be disable you should not see it in the logs.. The best would be to put a breakpoint on line 121 of the file /public_html/app/code/community/QS/Notification/Model/Notification.php to see what's going on from there, but I guess you don't have a debugger installed on the environnement where you have this issue ? – Anselme May 1 '15 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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