所以周六,我的magento ishop发生故障,我无法将任何产品添加到购物车中。
当我点击“添加到购物车”时,它会将我重定向到购物车并说:
“无法将商品添加到购物车。”
这是我的日志:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'' in /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /var/www/clients/client23/web66/web/tests/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #2 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) #4 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array) #5 /var/www/clients/client23/web66/web/tests/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array) #6 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array) #7 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_quot...', Array) #8 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Quote)) #9 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Sales/Model/Quote.php(1898): Mage_Core_Model_Abstract->save() #10 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Checkout/Model/Cart.php(465): Mage_Sales_Model_Quote->save() #11 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Checkout/controllers/CartController.php(198): Mage_Checkout_Model_Cart->save() #12 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_CartController->addAction() #13 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add') #14 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #15 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #16 /var/www/clients/client23/web66/web/tests/app/Mage.php(683): Mage_Core_Model_App->run(Array) #17 /var/www/clients/client23/web66/web/tests/index.php(89): Mage::run('', 'store') #18 {main} Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'' in /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Statement/Pdo.php:234 Stack trace: #0 /var/www/clients/client23/web66/web/tests/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #1 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #2 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) #3 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array) #4 /var/www/clients/client23/web66/web/tests/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array) #5 /var/www/clients/client23/web66/web/tests/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array) #6 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('sales_flat_quot...', Array) #7 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Sales_Model_Quote)) #8 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Sales/Model/Quote.php(1898): Mage_Core_Model_Abstract->save() #9 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Checkout/Model/Cart.php(465): Mage_Sales_Model_Quote->save() #10 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Checkout/controllers/CartController.php(198): Mage_Checkout_Model_Cart->save() #11 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_CartController->addAction() #12 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('add') #13 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #14 /var/www/clients/client23/web66/web/tests/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #15 /var/www/clients/client23/web66/web/tests/app/Mage.php(683): Mage_Core_Model_App->run(Array) #16 /var/www/clients/client23/web66/web/tests/index.php(89): Mage::run('', 'store') #17 {main}
我真的希望,有人会想出一些东西。
(我dogle谷歌几个小时,我一无所获。)
关于, iddimargšing
答案 0 :(得分:0)
我以前见过这个问题。当数据库被写入Magento API之外并出现问题时,就会发生这种情况。一个简单的解决方案是打开MySQL常规日志以记录所有SQL查询。在命令行上使用tail程序和-f标志实时查看mysql常规日志,如tail -f general.log
现在尝试执行给出完整性约束违规的操作,您应该在日志中看到尝试的sql查询。使用此信息,您应该能够更好地跟踪问题,并在需要时删除数据库中的错误条目。
有时它是由于与产品相关的扩展而发生的。在这种情况下,请禁用所有第三方扩展程序,然后尝试添加产品。