2

I have upgrade magento 1.9.4.1 from Magento 1.9.1.0 now a guest customer can visit the product page, but when the logged-in customer visit the product page it is showing the error as below:

"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1561-232' for key 'UNQ_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID', query was: INSERT INTO report_viewed_product_index (visitor_id,customer_id,product_id,store_id,added_at) VALUES (?, ?, ?, ?, '2019-06-26 07:06:34') ON DUPLICATE KEY UPDATE visitor_id = VALUES(visitor_id), customer_id = VALUES(customer_id), product_id = VALUES(product_id), store_id = VALUES(store_id), added_at = VALUES(added_at)"

When I comment the below line in file "Code\Core\Mage\Catalog\Helper\Product\View.php" the line number 135 code is Mage::dispatchEvent('catalog_controller_product_view', array('product' => $product)); then it is allowed to load the product page for logged in customer and logged out both.

Please let me know if anything you found for the issue.

  • if you are not using stats regarding the most viewed products and others. Please clear report_viewed_product_index table and try to check. It seems like there are some entries in your table reports table which is clashing when a customer is checking for the same product page. – nishu Jun 26 '19 at 9:58
  • it is happening with old products, not with the newly created products. new products working fine. – Utsav Gupta Jun 26 '19 at 12:54
  • Because in this table you have entry for that product i.e you are getting that issue. If you are not using any most viewed products or recently viewed products functionality then you can truncate the data. – nishu Jun 26 '19 at 13:10
  • I truncate the table 'report_viewed_product_index' and it is working, but after a day the same issue is occurred. don't know why. – Utsav Gupta Jun 26 '19 at 13:47
  • can you please check is there any custom module which is adding data to these tables except magento codebase – nishu Jun 27 '19 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.