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

Solved: Add to cart results in a SQLSTATE[23000]: Integrity constraint violation
 
Gui
Guru
 
Avatar
Total Posts:  588
Joined:  2008-03-09
 

Hi all,

I have moved my store from a sub-directory to the root. And ran the installation process again.

All seems to work fine accept adding products to the cart. When clicking “Add to cart” I get the following blank page with this error:

SQLSTATE[23000]Integrity constraint violation1062 Duplicate entry '10' for key 1

#0 /home/telescoo/public_html/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/telescoo/public_html/lib/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array)
#2 /home/telescoo/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#3 /home/telescoo/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(199): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#4 /home/telescoo/public_html/lib/Zend/Db/Adapter/Abstract.php(484): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#5 /home/telescoo/public_html/app/code/core/Mage/Log/Model/Mysql4/Visitor.php(184): Zend_Db_Adapter_Abstract->insert('log_quote', Array)
#6 /home/telescoo/public_html/app/code/core/Mage/Log/Model/Mysql4/Visitor.php(88): Mage_Log_Model_Mysql4_Visitor->_saveQuoteInfo(Object(Mage_Log_Model_Visitor))
#7 /home/telescoo/public_html/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(353): Mage_Log_Model_Mysql4_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#8 /home/telescoo/public_html/app/code/core/Mage/Core/Model/Abstract.php(241): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Log_Model_Visitor))
#9 /home/telescoo/public_html/app/code/core/Mage/Log/Model/Visitor.php(177): Mage_Core_Model_Abstract->save()
#10 /home/telescoo/public_html/app/code/core/Mage/Core/Model/App.php(1103): Mage_Log_Model_Visitor->saveByRequest(Object(Varien_Event_Observer))
#11 /home/telescoo/public_html/app/Mage.php(298): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#12 /home/telescoo/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(410): Mage::dispatchEvent('controller_acti...', Array)
#13 /home/telescoo/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(57): Mage_Core_Controller_Varien_Action->postDispatch()
#14 /home/telescoo/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(351): Mage_Core_Controller_Front_Action->postDispatch()
#15 /home/telescoo/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(163): Mage_Core_Controller_Varien_Action->dispatch('add')
#16 /home/telescoo/public_html/app/code/community/Mage/OfflineMaintenance/Controller/Router/Standard.php(44): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /home/telescoo/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(174): Mage_OfflineMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#18 /home/telescoo/public_html/app/Mage.php(447): Mage_Core_Controller_Varien_Front->dispatch()
#19 /home/telescoo/public_html/index.php(46): Mage::run()
#20 {main}

Database has stayed the same (although I did truncate the order table). I tried it in IE and FF2 same results.
When hitting refresh, quantity of 2 is added to the cart, when hitting back button quantity of 1 is added to the cart.

edit: This only happens with the first product that is added to the cart. Second is added without errors.

I hope someone can set me on the right track because the shop is now live.

Thank you so much for replying.
Guy

Edit:
Solved:
the log_quote seems to be the problem, since I moved the site and did not truncate is as well. Did that now and all seems to work normal again.

These two threads could be of interest regarding this issue:
http://www.magentocommerce.com/boards/viewthread/1680/P45/
http://www.magentocommerce.com/boards/viewthread/17065/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yooplaboom
Jr. Member
 
Total Posts:  30
Joined:  2008-11-25
 

Hi Gui,

edit: This only happens with the first product that is added to the cart. Second is added without errors.

I hope someone can set me on the right track because the shop is now live.

Thank you so much for replying.
Guy

Edit:
Solved:
the log_quote seems to be the problem, since I moved the site and did not truncate is as well. Did that now and all seems to work normal again.

Got the same problem, could you elaborate a bit more how you did to fix it ?

Thanks

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