我收到此错误,如果您知道,请帮助我。 保存客户时发生错误
在后端我编辑客户并单击“保存”按钮或保存并继续编辑然后显示此错误。
我在此文件CustomerController.php中有一些代码注释
catch (Exception $e) {
$this->_getSession()->addException($e, Mage::helper('adminhtml')->__('An error occurred while saving the customer.'));
$this->_getSession()->setCustomerData($data);
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id'=>$customer->getId())));
return;
}
收到此错误后。
处理您的请求时出错 SQLSTATE [23000]:完整性约束违规:1062密钥'PRIMARY'的重复条目'0'
跟踪:
0 /var/www/html/raptor_supplies/lib/Varien/Db/Statement/Pdo/Mysql.php(110):Zend_Db_Statement_Pdo-> _execute(Array)
1 /var/www/html/raptor_supplies/app/code/core/Zend/Db/Statement.php(291):Varien_Db_Statement_Pdo_Mysql-> _execute(Array)
2 /var/www/html/raptor_supplies/lib/Zend/Db/Adapter/Abstract.php(480):Zend_Db_Statement-> execute(Array)
3 /var/www/html/raptor_supplies/lib/Zend/Db/Adapter/Pdo/Abstract.php(238):Zend_Db_Adapter_Abstract-> query('INSERT INTO`eu ...',Array)
4 /var/www/html/raptor_supplies/lib/Varien/Db/Adapter/Pdo/Mysql.php(428):Zend_Db_Adapter_Pdo_Abstract-> query('INSERT INTO`eu ...',Array)
5 /var/www/html/raptor_supplies/lib/Zend/Db/Adapter/Abstract.php(576):Varien_Db_Adapter_Pdo_Mysql-> query('INSERT INTO`eu ...',Array)
6 /var/www/html/raptor_supplies/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453):Zend_Db_Adapter_Abstract-> insert('euvat_customer _...',Array )
7 /var/www/html/raptor_supplies/app/code/core/Mage/Core/Model/Abstract.php(318):Mage_Core_Model_Resource_Db_Abstract-> save(Object(Pisc_Euvat_Model_Customer_Exclude))8 /var/www/html/raptor_supplies/app/code/local/Pisc/Euvat/Helper/Adminhtml.php(33):Mage_Core_Model_Abstract-> save()
9 /var/www/html/raptor_supplies/app/code/local/Pisc/Euvat/Model/Adminhtml/Observer.php(58):Pisc_Euvat_Helper_Adminhtml-> updateCustomer(Object(Mage_Customer_Model_Customer),Object(Mage_Core_Controller_Request_Http))
10 /var/www/html/raptor_supplies/app/code/core/Mage/Core/Model/App.php(1338):Pisc_Euvat_Model_Adminhtml_Observer-> eventAdminhtmlCustomerPrepareSave(Object(Varien_Event_Observer))
11 /var/www/html/raptor_supplies/app/code/core/Mage/Core/Model/App.php(1317):Mage_Core_Model_App-> _callObserverMethod(Object(Pisc_Euvat_Model_Adminhtml_Observer),'eventAdminhtmlC ...',对象(Varien_Event_Observer)) 12 /var/www/html/raptor_supplies/app/Mage.php(448):Mage_Core_Model_App-> dispatchEvent('adminhtml_custo ...',数组) 13 /var/www/html/raptor_supplies/app/code/core/Mage/Adminhtml/controllers/CustomerController.php(319):Mage :: dispatchEvent('adminhtml_custo ...',Array) 14 p / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 15 p / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 16 p / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 17 /var/www/html/raptor_supplies/app/code/core/Mage/Core/Model/App.php(354):Mage_Core_Controller_Varien_Front-> dispatch()18 /var/www/html/raptor_supplies/app/Mage.php(684):Mage_Core_Model_App-> run(Array)
19 /var/www/html/raptor_supplies/index.php(89):Mage :: run('default','store')
20 {main}
答案 0 :(得分:0)
首先修复然后优化数据库。然后清除缓存。