2

Please note:

Disabling the report_viewed_product_index event resolves the issue, at the cost of disabling the product view report index. (Source: How to disable report viewed products in magento)


I'm experiencing the following issue:

Serious bug in Reports module (Magento 1&2) #1018

I checked my exception.log and found the stack trace identical to that of the aforementioned link.


Edit 2:

We are using a full page cache (Extendware - Full Page Cache which is why 15, 16 & 17 lie in var/cache/), as soon as another visitor successful loads the page & primes it into the cache, the first visitor can now view the product. It definitely sounds like the above-mentioned bug report as this behaviour supports that.


I'm getting the following error when trying to load a specific product page (not technically specific, as this changes randomly and some day the product which triggers it will not trigger it on another day. Specific in the sense that not every product page triggers the error.). The report reads:

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3015-14303' 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 (?, ?, ?, ?, '2015-07-30 13:55:11') 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`)' in   html/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0  html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1  html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2  html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3  html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `re...', Array)
#4  html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `re...', Array)
#5  html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1934): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `re...', Array)
#6  html/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php(48): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('report_viewed_p...', Array, Array)
#7  html/app/code/core/Mage/Reports/Model/Resource/Product/Index/Abstract.php(150): Mage_Reports_Model_Resource_Helper_Mysql4->mergeVisitorProductIndex('report_viewed_p...', Array, Array)
#8  html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Reports_Model_Resource_Product_Index_Abstract->save(Object(Mage_Reports_Model_Product_Index_Viewed))
#9  html/app/code/core/Mage/Reports/Model/Event/Observer.php(130): Mage_Core_Model_Abstract->save()
#10 html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Reports_Model_Event_Observer->catalogProductView(Object(Varien_Event_Observer))
#11 html/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 html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_control...', Array)
#13 html/app/code/core/Mage/Catalog/Helper/Product/View.php(135): Mage::dispatchEvent('catalog_control...', Array)
#14 html/app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(14303, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#15 html/var/cache/ew/files/14/b3/Mage/Core/Controller/Varien/Action.php(437): Mage_Catalog_ProductController->viewAction()
#16 html/var/cache/ew/files/c5/3b/Mage/Core/Controller/Varien/Router/Standard.php(273): Mage_Core_Controller_Varien_ActionOverriddenClass->dispatch('view')
#17 html/var/cache/ew/files/26/1a/Mage/Core/Controller/Varien/Front.php(191): Mage_Core_Controller_Varien_Router_StandardOverriddenClass->match(Object(Mage_Core_Controller_Request_Http))
#18 html/app/code/local/Extendware/EWPageCache/Controller/Override/Mage/Core/Varien/Front.php(35): Mage_Core_Controller_Varien_FrontOverriddenClass->dispatch()
#19 html/app/code/core/Mage/Core/Model/App.php(354): Extendware_EWPageCache_Controller_Override_Mage_Core_Varien_Front->dispatch()
#20 html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 html/index.php(89): Mage::run('', 'store')
#22 {main}
2
  • Is it your problem solved Commented Jul 30, 2015 at 14:39
  • Well, it stops the error but it's not really a solution, as it disables the product view index counter.
    – Moose
    Commented Jul 30, 2015 at 15:03

1 Answer 1

0

You have custom code in it:

#11 html/app/code/local/TM/AjaxSearch/Block/CatalogSearch/Result.php(135): Mage_CatalogSearch_Block_Result->_getProductCollection()

#12 html/app/code/local/TM/AjaxSearch/Block/CatalogSearch/Result.php(187): TM_AjaxSearch_Block_CatalogSearch_Result->_getProductCollection()

#13 [internal function]: TM_AjaxSearch_Block_CatalogSearch_Result->setListCollection()
html/var/cache/ew/files/14/b3/Mage/Core/Controller/Varien/Action.php(363): Mage_Core_Model_Layout->generateBlocks()

#19 html/var/cache/ew/files/14/b3/Mage/Core/Controller/Varien/Action.php(288): Mage_Core_Controller_Varien_ActionOverriddenClass->generateLayoutBlocks()

#20 html/app/code/community/Php4u/BlastLuceneSearch/controllers/IndexController.php(19) : eval()'d code(1) : eval()'d code(1) : eval()'d code(18): Mage_Core_Controller_Varien_ActionOverriddenClass->loadLayout()

#21 html/var/cache/ew/files/14/b3/Mage/Core/Controller/Varien/Action.php(437): Php4u_BlastLuceneSearch_IndexController->noRouteLuceneAction()

#22 html/var/cache/ew/files/c5/3b/Mage/Core/Controller/Varien/Router/Standard.php(273): Mage_Core_Controller_Varien_ActionOverriddenClass->dispatch('noRouteLucene')

#23 html/var/cache/ew/files/26/1a/Mage/Core/Controller/Varien/Front.php(191): Mage_Core_Controller_Varien_Router_StandardOverriddenClass->match(Object(Mage_Core_Controller_Request_Http))

#24 html/app/code/local/Extendware/EWPageCache/Controller/Override/Mage/Core/Varien/Front.php(35): Mage_Core_Controller_Varien_FrontOverriddenClass->dispatch()

11, 12 and 13 Is a block rewrite I would guess

19, 21, 22, 23 and 24 shouldn't lay in /var/cache/, I'm sure there is something going on, this isn't even the compiler

20 is a custom controller

2
  • 2
    The files in var/cache/ew are ok. It's part of ExtendWare optimizer / autoloader. I'd have to look into it, but IIRC it's resolving and inlining includes in the cached version. Internal code is dodgy, probably IonCube, but since php4u's TLS support is too weak for my taste, can't verify anything with that extension. Either way, it has set the category id on the Block to the category object, as can be observed in Mage_Core_Model_Resource_Db_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL). The second parameter should be an integer.
    – user4351
    Commented Jun 27, 2015 at 13:41
  • I've updated the question to specify why the files lie in var/cache/, as mentioned by Melvyn it's due to the Extendware optimizer / FPC. BTW, disabling the report_product_view_index event resolved the issue for me. This obviously isn't optimal, but I'd rather have people being able to view products without (mysteriously) some users having an issue, than being able to track product views. At least as an interim solution. Still on the lookout for an answer / resolution.
    – Moose
    Commented Jul 30, 2015 at 14:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.