mage-enhanced-admin-grids icon indicating copy to clipboard operation
mage-enhanced-admin-grids copied to clipboard

Clash with atoc inventory

Open dvdsndr opened this issue 9 years ago • 1 comments

On magento 1.9.2.1 with atoc mutiwebsite inventory latest release of admin-grids. If I turn on the rewrite function we get this crash on product page edit. If we leave this off all works ok.

Something is adding extra conditions in the query, not sure if it is admin-grids or atoc but atoc does work ok if rewrite turned off in admin. We had no problems with earlier version of this module and the atoc inventory module working together

------ following sent to atoc help desk ----

Site is crashing with this report below.

The error - "Item (Mage_Catalog_Model_Product) with the same id "951" already exist." - is caused by duplicate data being returned.

The query causing the crash was obtained by adding some extra debugging. You can see that it is doing two joins to aitoc_cataloginventory_stock_item. One join is correctly passing (at_qty.product_id=e.entity_id) AND (at_qty.stock_id=1 AND at_qty.website_id = 6) which will return a unique value and the other is a join without Website= condition which will cause duplicates. If we disable the module then the site does not crash. If we reinstall or enable the site will crash.

Questions to answer:

Why is the module causing two joins to aitoc_cataloginventory_stock_item? . Even if both were correct this is inefficient code.

Why is the 2nd join missing a join condition for website.

We are running a mutiwebsite instance of magneto

a:5:{i:0;s:1672:"Item (Mage_Catalog_Model_Product) with the same id "951" already exist. SQL that caused this: SELECT e.*, at_qty.qty, at_status.value AS status, at_visibility.value AS visibility, (SELECT GROUP_CONCAT(_blcgmccpc_select.category_id) AS value FROM catalog_category_product AS _blcgmccpc_select WHERE (_blcgmccpc_select.product_id = e.entity_id) GROUP BY _blcgmccpc_select.product_id) AS blcg_custom_field_1, _blcgmccpi_eb59c62c032004c7f3c98b9d6013c1a5.is_in_stock AS blcg_custom_field_2, at_blcg_attribute_field_1.value AS blcg_attribute_field_1 FROM catalog_product_entity AS e LEFT JOIN aitoc_cataloginventory_stock_item AS at_qty ON (at_qty.product_id=e.entity_id) AND (at_qty.stock_id=1 AND at_qty.website_id = 7) INNER JOIN catalog_product_entity_int AS at_status ON (at_status.entity_id = e.entity_id) AND (at_status.attribute_id = '96') AND (at_status.store_id = 0) INNER JOIN catalog_product_entity_int AS at_visibility ON (at_visibility.entity_id = e.entity_id) AND (at_visibility.attribute_id = '102') AND (at_visibility.store_id = 0) LEFT JOIN aitoc_cataloginventory_stock_item AS _blcgmccpi_eb59c62c032004c7f3c98b9d6013c1a5 ON _blcgmccpi_eb59c62c032004c7f3c98b9d6013c1a5.product_id = e.entity_id AND _blcgmccpi_eb59c62c032004c7f3c98b9d6013c1a5.stock_id = 1 LEFT JOIN catalog_product_entity_varchar AS at_blcg_attribute_field_1 ON (at_blcg_attribute_field_1.entity_id = e.entity_id) AND (at_blcg_attribute_field_1.attribute_id = '85') AND (at_blcg_attribute_field_1.store_id = 0) ORDER BY e.entity_id DESC LIMIT 20";i:1;s:5704:"#0 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(265): Varien_Data_Collection->addItem(Object(Mage_Catalog_Model_Product)) #1 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(1055): Mage_Eav_Model_Entity_Collection_Abstract->addItem(Object(Mage_Catalog_Model_Product)) #2 /var/www/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(871): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false) #3 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(533): Mage_Eav_Model_Entity_Collection_Abstract->load() #4 /var/www/magento/vendor/dvdsndr/Aitoc_Aitquantitymanager/app/code/local/Aitoc/Aitquantitymanager/Block/Rewrite/AdminCatalogProductGrid.php(74): Mage_Adminhtml_Block_Widget_Grid->_prepareCollection() #5 /var/www/magento/vendor/mage-eag/mage-enhanced-admin-grids/app/code/community/BL/CustomGrid/Model/Grid/Rewriter/Eval.php(32) : eval()'d code(96): Aitoc_Aitquantitymanager_Block_Rewrite_AdminCatalogProductGrid->_prepareCollection() #6 /var/www/magento/vendor/mage-eag/mage-enhanced-admin-grids/app/code/community/BL/CustomGrid/Model/Grid/Rewriter/Eval.php(32) : eval()'d code(382): BL_CustomGrid_Block_Rewrite_Aitoc_Aitquantitymanager_Block_Rewrite_Admincatalogproductgrid->_prepareCollection() #7 /var/www/magento/vendor/mage-eag/mage-enhanced-admin-grids/app/code/community/BL/CustomGrid/Model/Observer.php(562): BL_CustomGrid_Block_Rewrite_Aitoc_Aitquantitymanager_Block_Rewrite_Admincatalogproductgrid->blcg_finishPrepareCollection() #8 /var/www/magento/vendor/mage-eag/mage-enhanced-admin-grids/app/code/community/BL/CustomGrid/Model/Grid/Rewriter/Eval.php(32) : eval()'d code(93): BL_CustomGrid_Model_Observer->afterGridPrepareCollection(Object(BL_CustomGrid_Block_Rewrite_Aitoc_Aitquantitymanager_Block_Rewrite_Admincatalogproductgrid)) #9 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): BL_CustomGrid_Block_Rewrite_Aitoc_Aitquantitymanager_Block_Rewrite_Admincatalogproductgrid->_prepareCollection() #10 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid() #11 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml() #12 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml() #13 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('grid', true) #14 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Catalog/Product.php(79): Mage_Core_Block_Abstract->getChildHtml('grid') #15 /var/www/magento/app/design/adminhtml/default/default/template/catalog/product.phtml(46): Mage_Adminhtml_Block_Catalog_Product->getGridHtml() #16 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/magent...') #17 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #18 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #19 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #20 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template->_toHtml() #21 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Widget_Container->_toHtml() #22 /var/www/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #23 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml() #24 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml() #25 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true) #26 /var/www/magento/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content') #27 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/magent...') #28 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #29 /var/www/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #30 /var/www/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #31 /var/www/magento/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml() #32 /var/www/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml() #33 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput() #34 /var/www/magento/app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(180): Mage_Core_Controller_Varien_Action->renderLayout() #35 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->indexAction() #36 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index') #37 /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #38 /var/www/magento/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #39 /var/www/magento/app/Mage.php(692): Mage_Core_Model_App->run(Array) #40 /var/www/magento/index.php(83): Mage::run('default', 'store') #41 {main}";s:3:"url";s:82:"/index.php/admin/admin/catalog_product/index/key/9b5381aa35e2161d1ee2ff8860f6aa1e/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}www-data@stack-web01:/var/www/magento/var/report$

dvdsndr avatar Sep 02 '15 09:09 dvdsndr

Hello,

We got the same error, did you found any solution how to resolve this error?

-- Regards AM

RDXSportsCom avatar Oct 27 '17 08:10 RDXSportsCom