Hello,
i copied the main live website content in new subdomain(new database).
the new subdomain now working fine with all data.
but if i want to create new product, or editing any stock quantity if existing product.
i got error : "The stock item was unable to be saved. Please try again."
pic -> https://ibb.co/QfNxJzL
*the live website(main website) not having this problem,just the new subdomain.
FYI:
-i check this article:
https://github.com/magento/magento2/issues/22094
and im already using SQL.
-i even follow below article
https://www.offset101.com/magento-2-3-x-fix-stock-item-unable-saved-save-products-admin/
but not fixed !
anyone could help.
Thanks and Regards,
Gabriel
Solved! Go to Solution.
Hello @gabriel_helle
If you are using CPanel you may navigate to MySQL Databases
inside the DATABASES
section or search for it. Then look for the Current Databases
section and on the same row as your Magento database under the column Privileged Users
click on the user turkey123_magentech.
On the next page titled Manage User Privileges
, simply check the top left checkbox for ALL PRIVILEGES
and finally click on the Make Changes
button at bottom left of the page.
Hello @gabriel_helle
have you do reindex after setup
If not then do reindex and check it
Found few suggested solution in shared link, please have look once:
Updating lots of products simultaneously via API. Disabling Index or switching from "Update on save" to "Update on schedule" solved the issue completely.
OR
Hello @Sunil Patel yes i tried to index,
still the error same.
Hey @gabriel_helle
can you check log and add log info
Hello @Sunil Patel
please find below the exception and System log
Exception log :
[2020-06-17 12:03:04] main.CRITICAL: The stock item was unable to be saved. Please try again. {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): The stock item was unable to be saved. Please try again. at /home/turkey123/stage.123turkey.com/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:187, Zend_Db_Statement_Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1142 TRIGGER command denied to user 'turkey123_magentech'@'localhost' for table 'cataloginventory_stock_item', query was: UPDATE `cataloginventory_stock_item` SET `product_id` = ?, `stock_id` = ?, `qty` = ?, `min_qty` = ?, `use_config_min_qty` = ?, `is_qty_decimal` = ?, `backorders` = ?, `use_config_backorders` = ?, `min_sale_qty` = ?, `use_config_min_sale_qty` = ?, `max_sale_qty` = ?, `use_config_max_sale_qty` = ?, `is_in_stock` = ?, `low_stock_date` = ?, `notify_stock_qty` = ?, `use_config_notify_stock_qty` = ?, `manage_stock` = ?, `use_config_manage_stock` = ?, `stock_status_changed_auto` = ?, `use_config_qty_increments` = ?, `qty_increments` = ?, `use_config_enable_qty_inc` = ?, `enable_qty_increments` = ?, `is_decimal_divided` = ?, `website_id` = ?, `ukey` = ? WHERE (item_id=29183) at /home/turkey123/stage.123turkey.com/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1142 TRIGGER command denied to user 'turkey123_magentech'@'localhost' for table 'cataloginventory_stock_item' at /home/turkey123/stage.123turkey.com/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []
System Log:
[2020-06-17 12:13:01] main.INFO: Broken reference: the 'product.reviews' element cannot be added as child to 'product_tabs', because the latter doesn't exist [] []
[2020-06-17 12:13:22] main.CRITICAL: Exception message: The stock item was unable to be saved. Please try again.
Trace: <pre>#1 Magento\CatalogInventory\Model\Stock\StockItemRepository\Interceptor->___callParent('save', array(&Magetop\MpAssignProduct\Model\Rewrite\CatalogInventory\Stock\Item\Interceptor#00000000615b12c10000000077280eb6#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#2 Magento\CatalogInventory\Model\Stock\StockItemRepository\Interceptor->Magento\Framework\Interception\{closure}(&Magetop\MpAssignProduct\Model\Rewrite\CatalogInventory\Stock\Item\Interceptor#00000000615b12c10000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#3 Magento\CatalogInventory\Model\Stock\StockItemRepository\Interceptor->___callPlugins('save', array(&Magetop\MpAssignProduct\Model\Rewrite\CatalogInventory\Stock\Item\Interceptor#00000000615b12c10000000077280eb6#), array(array('update_stockitem...'), array('update_stockitem...'))) called at [generated/code/Magento/CatalogInventory/Model/Stock/StockItemRepository/Interceptor.php:26]
#4 Magento\CatalogInventory\Model\Stock\StockItemRepository\Interceptor->save(&Magetop\MpAssignProduct\Model\Rewrite\CatalogInventory\Stock\Item\Interceptor#00000000615b12c10000000077280eb6#) called at [vendor/magento/module-catalog-inventory/Model/StockRegistry.php:181]
#5 Magento\CatalogInventory\Model\StockRegistry->updateStockItemBySku('49AT5290', &Magetop\MpAssignProduct\Model\Rewrite\CatalogInventory\Stock\Item\Interceptor#00000000615b12c10000000077280eb6#) called at [vendor/magento/module-catalog-inventory/Observer/SaveInventoryDataObserver.php:125]
#6 Magento\CatalogInventory\Observer\SaveInventoryDataObserver->execute(&Magento\Framework\Event\Observer#00000000615b11c00000000077280eb6#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:88]
#7 Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(&Magento\CatalogInventory\Observer\SaveInventoryDataObserver#00000000615b11910000000077280eb6#, &Magento\Framework\Event\Observer#00000000615b11c00000000077280eb6#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:74]
#8 Magento\Framework\Event\Invoker\InvokerDefault->dispatch(array('instance' => 'Magento\CatalogI...', 'name' => 'inventory'), &Magento\Framework\Event\Observer#00000000615b11c00000000077280eb6#) called at [vendor/magento/framework/Event/Manager.php:66]
#9 Magento\Framework\Event\Manager->dispatch('catalog_product_...', array('data_object' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#, 'product' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [generated/code/Magento/Framework/Event/Manager/Proxy.php:95]
#10 Magento\Framework\Event\Manager\Proxy->dispatch('catalog_product_...', array('data_object' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#, 'product' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [vendor/magento/framework/Model/AbstractModel.php:829]
#11 Magento\Framework\Model\AbstractModel->afterSave() called at [vendor/magento/module-catalog/Model/Product.php:969]
#12 Magento\Catalog\Model\Product->afterSave() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#13 Magento\Catalog\Model\Product\Interceptor->___callParent('afterSave', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#14 Magento\Catalog\Model\Product\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#15 Magento\Catalog\Model\Product\Interceptor->___callPlugins('afterSave', array(), array(array('pluginAddProduct...'))) called at [generated/code/Magento/Catalog/Model/Product/Interceptor.php:26]
#16 Magento\Catalog\Model\Product\Interceptor->afterSave() called at [vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php:34]
#17 Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(&Magento\Framework\Event\Observer#00000000615b11b30000000077280eb6#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:88]
#18 Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(&Magento\Framework\EntityManager\Observer\AfterEntitySave#00000000615b11ac0000000077280eb6#, &Magento\Framework\Event\Observer#00000000615b11b30000000077280eb6#) called at [vendor/magento/framework/Event/Invoker/InvokerDefault.php:74]
#19 Magento\Framework\Event\Invoker\InvokerDefault->dispatch(array('instance' => 'Magento\Framewor...', 'name' => 'legacy_model_sav...'), &Magento\Framework\Event\Observer#00000000615b11b30000000077280eb6#) called at [vendor/magento/framework/Event/Manager.php:66]
#20 Magento\Framework\Event\Manager->dispatch('magento_catalog_...', array('entity' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [generated/code/Magento/Framework/Event/Manager/Proxy.php:95]
#21 Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog_...', array('entity' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [vendor/magento/framework/EntityManager/EventManager.php:51]
#22 Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\Catalog\...', 'save_after', array('entity' => &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [vendor/magento/framework/EntityManager/Operation/Update.php:110]
#23 Magento\Framework\EntityManager\Operation\Update->execute(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#, array()) called at [vendor/magento/framework/EntityManager/EntityManager.php:96]
#24 Magento\Framework\EntityManager\EntityManager->save(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/module-catalog/Model/ResourceModel/Product.php:758]
#25 Magento\Catalog\Model\ResourceModel\Product->save(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#26 Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent('save', array(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#27 Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php:58]
#28 Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->addCommitCallback(&Magento\Catalog\Model\ResourceModel\Product\Interceptor#00000000615b1f9c0000000077280eb6#, &Closure#00000000615b1c890000000077280eb6#, &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Product.php:28]
#29 Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Product->aroundSave(&Magento\Catalog\Model\ResourceModel\Product\Interceptor#00000000615b1f9c0000000077280eb6#, &Closure#00000000615b1c890000000077280eb6#, &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#30 Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/App/Cache/FlushCacheByTags.php:69]
#31 Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(&Magento\Catalog\Model\ResourceModel\Product\Interceptor#00000000615b1f9c0000000077280eb6#, &Closure#00000000615b1c890000000077280eb6#, &Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#32 Magento\Catalog\Model\ResourceModel\Product\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#33 Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callPlugins('save', array(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#), array(array('apply_catalog_ru...'), array('reload_attribute...'))) called at [generated/code/Magento/Catalog/Model/ResourceModel/Product/Interceptor.php:39]
#34 Magento\Catalog\Model\ResourceModel\Product\Interceptor->save(&Magento\Catalog\Model\Product\Interceptor#00000000615b1c450000000077280eb6#) called at [vendor/magento/framework/Model/AbstractModel.php:655]
#35 Magento\Framework\Model\AbstractModel->save() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Save.php:142]
#36 Magento\Catalog\Controller\Adminhtml\Product\Save->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
#37 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/module-backend/App/AbstractAction.php:231]
#38 Magento\Backend\App\AbstractAction->dispatch(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#39 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#40 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#41 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(&Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor#00000000615b1f390000000077280eb6#, &Closure#00000000615b1f3f0000000077280eb6#, &Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#42 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [app/code/Magetop/Marketplace/Plugin/App/Action/Context.php:54]
#43 Magetop\Marketplace\Plugin\App\Action\Context->aroundDispatch(&Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor#00000000615b1f390000000077280eb6#, &Closure#00000000615b1f3f0000000077280eb6#, &Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#44 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#45 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#), NULL) called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Save/Interceptor.php:26]
#46 Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor->dispatch(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/App/FrontController.php:159]
#47 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#, &Magento\Catalog\Controller\Adminhtml\Product\Save\Interceptor#00000000615b1f390000000077280eb6#) called at [vendor/magento/framework/App/FrontController.php:98]
#48 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#49 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#50 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#51 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#), array(array('default_store_se...', 'page_cache_from_...', 'storeCookieValid...', 'install', 'configHash'))) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#52 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#00000000615b1bb20000000077280eb6#) called at [vendor/magento/framework/App/Http.php:116]
#53 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#54 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#00000000615b1b490000000077280eb6#) called at [index.php:39]
</pre> [] []
[2020-06-17 12:13:23] main.INFO: Broken reference: the 'product.reviews' element cannot be added as child to 'product_tabs', because the latter doesn't exist [] []
Regards
Gabriel
Hello @gabriel_helle
If you are using CPanel you may navigate to MySQL Databases
inside the DATABASES
section or search for it. Then look for the Current Databases
section and on the same row as your Magento database under the column Privileged Users
click on the user turkey123_magentech.
On the next page titled Manage User Privileges
, simply check the top left checkbox for ALL PRIVILEGES
and finally click on the Make Changes
button at bottom left of the page.
Hello @gabriel_helle
you need to import db below way, so no issue with user
So drop DB and import db again
zcat var/db.sql.tgz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h <db-host> -P <db-port> -p -u <db-user> <db-name> |