cancel
Showing results for 
Search instead for 
Did you mean: 

Integrity Constraint Violation

Integrity Constraint Violation

Getting below error when adding a product:

 

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '23900-0' for key 'UNQ_CATALOG_PRODUCT_OPTION_TYPE_PRICE_OPTION_TYPE_ID_STORE_ID', query was: INSERT INTO `catalog_product_option_type_price` (`option_type_id`, `store_id`, `price`, `price_type`) VALUES (?, ?, ?, ?)' in /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /home/mysite/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/mysite/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/mysite/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /home/mysite/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /home/mysite/public_html/app/code/community/MageWorx/CustomOptions/Model/Catalog/Product/Option.php(1524): Zend_Db_Adapter_Abstract->insert('catalog_product...', Array)
#7 /home/mysite/public_html/app/code/core/Mage/Core/Model/Abstract.php(319): MageWorx_CustomOptions_Model_Catalog_Product_Option->_afterSave()
#8 /home/mysite/public_html/app/code/community/MageWorx/CustomOptions/Model/Catalog/Product/Option.php(1287): Mage_Core_Model_Abstract->save()
#9 /home/mysite/public_html/app/code/core/Mage/Catalog/Model/Product.php(547): MageWorx_CustomOptions_Model_Catalog_Product_Option->saveOptions()
#10 /home/mysite/public_html/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Catalog_Model_Product->_afterSave()
#11 /home/mysite/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(728): Mage_Core_Model_Abstract->save()
#12 /home/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->saveAction()
#13 /home/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
#14 /home/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#15 /home/mysite/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#16 /home/mysite/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#17 /home/mysite/public_html/index.php(83): Mage::run('', 'store')
#18 {main}

3 REPLIES 3

Re: Integrity Constraint Violation

Hello @stugatza ,

 

There is a duplicate entry error. In this case, inserting data already exist so you have to delete it. 

Please remove 23900 entry from catalog_product_option_type_price table

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Integrity Constraint Violation

thanks, this worked for 1 product. as soon as i went to add another i got
same error, but incremented:


- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
'23902-0' for key
'UNQ_CATALOG_PRODUCT_OPTION_TYPE_PRICE_OPTION_TYPE_ID_STORE_ID', query was:
INSERT INTO `catalog_product_option_type_price` (`price`, `price_type`,
`option_type_id`, `store_id`) VALUES (?, ?, ?, ?)

Re: Integrity Constraint Violation

Hello @stugatza ,

 

You have to do same thing for it.

 

--
If my answer is useful, please Accept as Solution & give Kudos