Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to save Stock Item" error when saving a product #447

Closed
woutersamaey opened this issue Jun 9, 2017 · 16 comments
Closed

"Unable to save Stock Item" error when saving a product #447

woutersamaey opened this issue Jun 9, 2017 · 16 comments
Assignees

Comments

@woutersamaey
Copy link

Preconditions

Magento Version : CE 2.1.6

ElasticSuite Version : Latest (date = 9 june 2017)

Environment : Production

Third party modules : Nothing relevant

Steps to reproduce

  1. Open a product in Magento Admin
  2. Assign it to 1 more category
  3. Save the product

Expected result

  1. The product should be attached to the extra category, but it is not.

Actual result

  1. We get an error message about saving the Stock Item, but this is not relevant (poor error handling in Magento 2 itself). The real exception is this:

Exception: Notice: Undefined offset: 181 in /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php on line 93 in /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/CategoryData.php(93): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined offse...', '/var/www/www.te...', 93, Array) #1 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/CategoryData.php(51): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\CategoryData->loadCategoryData(2, Array) #2 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-core/Indexer/GenericIndexerHandler.php(93): Smile\ElasticsuiteCatalog\Model\Product\Indexer\Fulltext\Datasource\CategoryData->addData(2, Array) #3 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(92): Smile\ElasticsuiteCore\Indexer\GenericIndexerHandler->saveIndex(Array, Object(Generator)) #4 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(126): Magento\CatalogSearch\Model\Indexer\Fulltext->execute(Array) #5 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-indexer/Model/Indexer.php(445): Magento\CatalogSearch\Model\Indexer\Fulltext->executeList(Array) #6 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/Indexer/AbstractIndexerPlugin.php(61): Magento\Indexer\Model\Indexer->reindexList(Array) #7 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/Indexer/Stock/ReindexProductsAfterStockUpdate.php(69): Smile\ElasticsuiteCatalog\Plugin\Indexer\AbstractIndexerPlugin->processFullTextIndex(Array) #8 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Smile\ElasticsuiteCatalog\Plugin\Indexer\Stock\ReindexProductsAfterStockUpdate->aroundExecuteRow(Object(Magento\CatalogInventory\Model\Indexer\Stock\Interceptor), Object(Closure), 7992) #9 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/CatalogInventory/Model/Indexer/Stock/Interceptor.php(52): Magento\CatalogInventory\Model\Indexer\Stock\Interceptor->___callPlugins('executeRow', Array, Array) #10 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-indexer/Model/Indexer.php(433): Magento\CatalogInventory\Model\Indexer\Stock\Interceptor->executeRow(7992) #11 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Indexer/AbstractProcessor.php(52): Magento\Indexer\Model\Indexer->reindexRow(7992) #12 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Model/ResourceModel/Stock/Item.php(126): Magento\Framework\Indexer\AbstractProcessor->reindexRow(7992) #13 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(817): Magento\CatalogInventory\Model\ResourceModel\Stock\Item->_afterSave(Object(Magento\CatalogInventory\Model\Adminhtml\Stock\Item)) #14 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(408): Magento\Framework\Model\ResourceModel\Db\AbstractDb->processAfterSaves(Object(Magento\CatalogInventory\Model\Adminhtml\Stock\Item)) #15 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php(190): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\CatalogInventory\Model\Adminhtml\Stock\Item)) #16 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php(140): Magento\CatalogInventory\Model\Stock\StockItemRepository->save(Object(Magento\CatalogInventory\Model\Adminhtml\Stock\Item)) #17 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php(104): Magento\CatalogInventory\Observer\SaveInventoryDataObserver->saveStockItemData(Object(Magento\Catalog\Model\Product\Interceptor)) #18 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\CatalogInventory\Observer\SaveInventoryDataObserver->execute(Object(Magento\Framework\Event\Observer)) #19 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\CatalogInventory\Observer\SaveInventoryDataObserver), Object(Magento\Framework\Event\Observer)) #20 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer)) #21 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('catalog_product...', Array) #22 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/AbstractModel.php(802): Magento\Framework\Event\Manager\Proxy->dispatch('catalog_product...', Array) #23 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Model/Product.php(921): Magento\Framework\Model\AbstractModel->afterSave() #24 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Product->afterSave() #25 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(Object(Magento\Framework\Event\Observer)) #26 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Framework\EntityManager\Observer\AfterEntitySave), Object(Magento\Framework\Event\Observer)) #27 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer)) #28 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('magento_catalog...', Array) #29 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/EventManager.php(51): Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog...', Array) #30 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/Operation/Update.php(108): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\Catalog...', 'save_after', Array) #31 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/EntityManager.php(87): Magento\Framework\EntityManager\Operation\Update->execute(Object(Magento\Catalog\Model\Product\Interceptor), Array) #32 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Model/ResourceModel/Product.php(695): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Catalog\Model\Product\Interceptor)) #33 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Model\ResourceModel\Product->save(Object(Magento\Catalog\Model\Product\Interceptor)) #34 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent('save', Array) #35 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'apply_catalog_r...') #36 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-rule/Plugin/Indexer/Product/Save/ApplyRules.php(40): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #37 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogRule\Plugin\Indexer\Product\Save\ApplyRules->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #38 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'catalogsearchFu...') #39 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(51): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #40 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(24): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->addCommitCallback(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #41 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #42 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'clean_cache') #43 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Cache/FlushCacheByTags.php(71): Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #44 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #45 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php(39): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callPlugins('save', Array, Array) #46 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/AbstractModel.php(631): Magento\Catalog\Model\ResourceModel\Product\Interceptor->save(Object(Magento\Catalog\Model\Product\Interceptor)) #47 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(110): Magento\Framework\Model\AbstractModel->save() #48 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Product\Save->execute() #49 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http)) #50 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http)) #51 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array) #52 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminAuthentica...') #53 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Framework\App\Request\Http)) #54 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #55 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminMassaction...') #56 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #57 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #58 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(26): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, Array) #59 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #60 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http)) #61 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array) #62 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install') #63 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #64 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #65 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array) #66 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #67 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch() #68 /var/www/www.tensen.be/public_html/releases/20170609010544/index.php(56): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #69 {main} Next Magento\Framework\Exception\CouldNotSaveException: Unable to save Stock Item in /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:196 Stack trace: #0 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php(140): Magento\CatalogInventory\Model\Stock\StockItemRepository->save(Object(Magento\CatalogInventory\Model\Adminhtml\Stock\Item)) #1 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php(104): Magento\CatalogInventory\Observer\SaveInventoryDataObserver->saveStockItemData(Object(Magento\Catalog\Model\Product\Interceptor)) #2 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\CatalogInventory\Observer\SaveInventoryDataObserver->execute(Object(Magento\Framework\Event\Observer)) #3 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\CatalogInventory\Observer\SaveInventoryDataObserver), Object(Magento\Framework\Event\Observer)) #4 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer)) #5 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('catalog_product...', Array) #6 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/AbstractModel.php(802): Magento\Framework\Event\Manager\Proxy->dispatch('catalog_product...', Array) #7 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Model/Product.php(921): Magento\Framework\Model\AbstractModel->afterSave() #8 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Product->afterSave() #9 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(Object(Magento\Framework\Event\Observer)) #10 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Framework\EntityManager\Observer\AfterEntitySave), Object(Magento\Framework\Event\Observer)) #11 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer)) #12 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('magento_catalog...', Array) #13 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/EventManager.php(51): Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog...', Array) #14 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/Operation/Update.php(108): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\Catalog...', 'save_after', Array) #15 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/EntityManager/EntityManager.php(87): Magento\Framework\EntityManager\Operation\Update->execute(Object(Magento\Catalog\Model\Product\Interceptor), Array) #16 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Model/ResourceModel/Product.php(695): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Catalog\Model\Product\Interceptor)) #17 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Model\ResourceModel\Product->save(Object(Magento\Catalog\Model\Product\Interceptor)) #18 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent('save', Array) #19 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'apply_catalog_r...') #20 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-rule/Plugin/Indexer/Product/Save/ApplyRules.php(40): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #21 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogRule\Plugin\Indexer\Product\Save\ApplyRules->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #22 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'catalogsearchFu...') #23 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(51): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #24 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php(24): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->addCommitCallback(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #25 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #26 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'clean_cache') #27 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Cache/FlushCacheByTags.php(71): Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Catalog\Model\Product\Interceptor)) #28 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor)) #29 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php(39): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callPlugins('save', Array, Array) #30 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Model/AbstractModel.php(631): Magento\Catalog\Model\ResourceModel\Product\Interceptor->save(Object(Magento\Catalog\Model\Product\Interceptor)) #31 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php(110): Magento\Framework\Model\AbstractModel->save() #32 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Product\Save->execute() #33 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http)) #34 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http)) #35 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', Array) #36 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminAuthentica...') #37 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Framework\App\Request\Http)) #38 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #39 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Array, 'adminMassaction...') #40 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #41 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #42 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php(26): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', Array, Array) #43 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #44 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http)) #45 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array) #46 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install') #47 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http)) #48 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) #49 /var/www/www.tensen.be/public_html/releases/20170609010544/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array) #50 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #51 /var/www/www.tensen.be/public_html/releases/20170609010544/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch() #52 /var/www/www.tensen.be/public_html/releases/20170609010544/index.php(56): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #53 {main}

@romainruaud
Copy link
Collaborator

Hello @woutersamaey

Thank you for your very well documented issue, that's always appreciated !

How is created your category with "181" Id ? Does she exists on the default store view ? (the "0") ? This sounds like a duplicate of #441 (not the same cause, but seems to have the same consequences).

best regards,

@romainruaud romainruaud self-assigned this Jun 9, 2017
@woutersamaey
Copy link
Author

The category was originally created in Magento 1 and migrated to Magento 2 using the Magento migration tools. In M1, we did not have this module installed.

@woutersamaey
Copy link
Author

Also, we only have 1 website and 3 store views (NL,FR and EN languags) on this installation. The category itself looks fine.

@romainruaud
Copy link
Collaborator

Could you please paste the result of the following query ? :

select * from catalog_category_entity_varchar where entity_id=181;

Of course, if you are using EE version, replace entity_id by row_id.

Also, could you give me the output of bin/magento index:show

@woutersamaey
Copy link
Author

The SQL query returns an empty result, no errors.

Customer Grid: Update on Save
Design Config Grid: Update on Save
Category Products: Update on Save
Product Categories: Update on Save
Product Price: Update on Save
Product EAV: Update on Save
Stock: Update on Save
Catalog Rule Product: Update on Save
Catalog Product Rule: Update on Save
Catalog Search: Update on Save
ElasticSuite Category Indexing: Update on Save
ElasticSuite Thesaurus Indexing: Update on Save

@romainruaud
Copy link
Collaborator

Hmmm... It's kinda strange the SQL query returns empty.

Does your category have a name ?

Could you please ensure the row_id of the category by running first : select * from catalog_category_entity where entity_id=181;

Please also give me the result of this query, and re-run the previous with the row_id of this category.

Regards,

``

@woutersamaey
Copy link
Author

Hi @romainruaud , as it turns out, there is no category ID 181. There is 180 and 185, and many more with larger IDs not no 181.

Also, I noticed that I cannot change anything for this product, so it's not limited to the category.

Here is the full JSON that is POSTed when saving the product
{
"product": {
"price": "279.00",
"name": "Tommy Hilfiger 24/7 SmartWatch 1791298",
"description": "

Tommy Hilfiger 24/7 SmartWatch 1791298 horloge met quartz binnenwerk. De kast (46mm) van dit model is vervaardigd uit roestvrij staal en is 5 ATM (50m) water resistant. Dit horloge heeft een gehard mineraal glas en een zwart leder armband.

\r\n

Uw Tommy Hilfiger horloge online kopen doe je bij TenSen Online met een gerust hart.
Als Officiële Dealer bieden wij u de volgende voordelen aan:

\r\n
    \r\n
  • 2 jaar internationale fabrieksgarantie
  • \r\n
  • 14 dagen ruilrecht
  • \r\n
  • Veilige en vlotte levering
  • \r\n
",
"short_description": "
    \r\n
  • Quartz met oplaadbare batterij\r\n
  • Compatibel met Android & IOS\r\n
  • Activity Tracker\r\n
  • Notificaties (email/bellen/sms)\r\n
  • Notificaties Alarm en Agenda punten\r\n
  • Wereldtijden\r\n
  • Gehard mineraal glas\r\n
  • Kast (46mm) in roestvrij staal\r\n
  • Leder armband\r\n
  • 5 ATM (50m) spat-waterdicht\r\n
",
"sku": "1791298",
"news_from_date": "11/15/2016",
"news_to_date": "12/31/2016",
"status": "1",
"url_key": "tommy-hilfiger-24-7-smartwatch-1791298",
"visibility": "4",
"verkoper": "z",
"category_ids": [
"3",
"724",
"727",
"1943"
],
"quantity_and_stock_status": {
"is_in_stock": "1",
"qty": "1"
},
"msrp_display_actual_price_type": "4",
"enable_googlecheckout": "1",
"tax_class_id": "2",
"meta_title": "1791298 | Tommy Hilfiger 24/7 Staal op Leder SmartWatch Horloge",
"meta_description": "Uw TOMMY HILFIGER 1791298 horloge online kopen doe je bij TenSen Online met een gerust hart. Als Officiële Dealer bieden wij u de volgende voordelen aan: 2 jaar internationale fabrieksgarantie, 14 dagen ruilrecht en veilige en vlotte levering.",
"image": "/1/7/1791298_600x450.jpg",
"small_image": "/1/7/1791298_600x450.jpg",
"thumbnail": "/1/7/1791298_600x450.jpg",
"media_gallery": {
"images": {
"14674": {
"value_id": "14674",
"file": "/1/7/1791298_600x450.jpg",
"media_type": "image",
"entity_id": "7992",
"label": "Tommy Hilfiger 1791298",
"position": "1",
"disabled": "0",
"label_default": "Tommy Hilfiger 1791298",
"position_default": "1",
"disabled_default": "0"
},
"18945": {
"value_id": "18945",
"file": "/k/z/kzIw2kixe34_hqdefault.jpg",
"media_type": "external-video",
"entity_id": "7992",
"label": "",
"disabled": "0",
"disabled_default": "0",
"video_url": "https://www.youtube.com/kzIw2kixe34",
"video_title": "Tommy Hilfiger 24/7 SmartWatch",
"video_url_default": "https://www.youtube.com/kzIw2kixe34",
"video_title_default": "Tommy Hilfiger 24/7 SmartWatch"
}
}
},
"is_recurring": "0",
"options_container": "container2",
"merk": "60",
"serie": "24/7 SmartWatch",
"ref_nr": "1791298",
"artikel_nr": "265061",
"geslacht": "69",
"grootte_uurw": "46mm",
"mouvement": "73",
"weergave": "76",
"waterdichtheid": "96",
"spec_functies": [
"110",
"109",
"108",
"107",
"105",
"132",
"106",
"127",
"131",
"130",
"129",
"117",
"398"
],
"glas": "103",
"materiaal_kast": "82",
"kleur_kast": "140",
"wzp_kleur": "191",
"bandmateriaal": "203",
"bandkleur": "224",
"garantie": "98",
"manufacturer": "231",
"product_header_image": "no_selection",
"attribute_set_id": "9",
"current_product_id": "7992",
"stock_data": {
"item_id": "7988",
"product_id": "7992",
"stock_id": "1",
"qty": "1",
"min_qty": "0",
"use_config_min_qty": "1",
"is_qty_decimal": "0",
"backorders": "0",
"use_config_backorders": "1",
"min_sale_qty": "1",
"use_config_min_sale_qty": "1",
"max_sale_qty": "100",
"use_config_max_sale_qty": "1",
"is_in_stock": "1",
"notify_stock_qty": "1",
"use_config_notify_stock_qty": "1",
"manage_stock": "1",
"use_config_manage_stock": "1",
"stock_status_changed_auto": "0",
"use_config_qty_increments": "1",
"qty_increments": "1",
"use_config_enable_qty_inc": "1",
"enable_qty_increments": "0",
"is_decimal_divided": "0",
"website_id": "0",
"type_id": "simple",
"use_config_deferred_stock_update": "1"
},
"links_title": "Links",
"links_purchased_separately": "0",
"samples_title": "Samples",
"affect_product_custom_options": "1",
"current_store_id": "0",
"weight": "",
"recurring_profile": "",
"caliber": "",
"special_price": "",
"cost": "",
"product_has_weight": "1",
"custom_design_from": "",
"custom_design_to": "",
"special_from_date": "",
"special_to_date": "",
"custom_layout_update": "",
"product_header_text": "",
"meta_keyword": "",
"end_of_life": "0",
"sw_featured": "0",
"use_config_gift_message_available": "0",
"website_ids": {
"1": "1"
},
"gift_message_available": "0",
"url_key_create_redirect": "tommy-hilfiger-24-7-smartwatch-1791298",
"configurable-matrix-serialized": "[]",
"associated_product_ids_serialized": "[]"
},
"is_downloadable": "0",
"affect_configurable_product_attributes": "1",
"new-variations-attribute-set-id": "9",
"form_key": "taNoljC33R4oUKi1"
}

@woutersamaey woutersamaey changed the title "Unable to save Stock Item" error when saving a product after having selected an extra category "Unable to save Stock Item" error when saving a product Jun 9, 2017
@romainruaud
Copy link
Collaborator

Well ...

It seems that your data does have a problem, how could come the "181" id if this category is non existing ?

Does it match anything into the "catalog_category_product_index" table ?

@woutersamaey
Copy link
Author

Yes, in catalog_category_product_index there are many matches. I'm not sure what happened here. Maybe the migration from M1 to M2 is to blame, or the database might have been broken from before that.

Let me check this out, and I'll let you know if this clears things up!

@woutersamaey
Copy link
Author

Yep, the database was corrupted :(

@rich15swan
Copy link

did you find where the database was corrupted? I am having a similar problem

@Koc
Copy link
Contributor

Koc commented Oct 5, 2017

Me too has this problem on Magento 2.1.9 (converted from 1.9.3.4) + Elasticsuite 2.3.x

@salmanazeez786
Copy link

I too had the same problem....found out Elasticsearch service was not active.
After starting the elasticsearch service the error was gone

@VincentMarmiesse
Copy link
Contributor

Same as @salmanazeez786, Elasticsearch was not running.
@romainruaud it would be interesting to display an error message "Elasticsearch is currently not running" for example and not block the product save, what do you think?

@roman204
Copy link

got that error on a update from 2.2.3 to 2.2.4.
magento indexer:reindex helped me out

@lisandroc
Copy link

On versions 2.4+, the origin of the problem can be a misconfiguration of Elastic Search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants