具体报错:
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'' in E:\xampp\htdocs\poppee\lib\Zend\Db\Statement\Pdo.php:234
Stack trace:
#0 E:\xampp\htdocs\poppee\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 E:\xampp\htdocs\poppee\app\code\core\Zend\Db\Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 E:\xampp\htdocs\poppee\lib\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 E:\xampp\htdocs\poppee\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `re...', Array)
#4 E:\xampp\htdocs\poppee\lib\Varien\Db\Adapter\Pdo\Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `re...', Array)
#5 E:\xampp\htdocs\poppee\lib\Zend\Db\Adapter\Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `re...', Array)
#6 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(453): Zend_Db_Adapter_Abstract->insert('report_event', Array)
#7 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Model\Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Reports_Model_Event))
#8 E:\xampp\htdocs\poppee\app\code\core\Mage\Reports\Model\Event\Observer.php(69): Mage_Core_Model_Abstract->save()
#9 E:\xampp\htdocs\poppee\app\code\core\Mage\Reports\Model\Event\Observer.php(133): Mage_Reports_Model_Event_Observer->_event(1, '192')
#10 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Model\App.php(1338): Mage_Reports_Model_Event_Observer->catalogProductView(Object(Varien_Event_Observer))
#11 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Model\App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Reports_Model_Event_Observer), 'catalogProductV...', Object(Varien_Event_Observer))
#12 E:\xampp\htdocs\poppee\app\Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_control...', Array)
#13 E:\xampp\htdocs\poppee\app\code\core\Mage\Catalog\Helper\Product\View.php(135): Mage::dispatchEvent('catalog_control...', Array)
#14 E:\xampp\htdocs\poppee\app\code\core\Mage\Catalog\controllers\ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(192, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#15 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Catalog_ProductController->viewAction()
#16 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#17 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#18 E:\xampp\htdocs\poppee\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#19 E:\xampp\htdocs\poppee\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#20 E:\xampp\htdocs\poppee\index.php(87): Mage::run('', 'store')
#21 {main}
解决办法:
1.打开数据库查看表“report_event_types”中是否有数据,正常应如下图所示:
如果没有数据,请先添加好数据。
2.打开表“report_event”,查看其表结构,正常情况下:event_id应该被设为主键,并且是自动递增的。