Open nilesh111091 opened 3 years ago
Until Magmi gets updated, as an emergency bypass fix for the problem , add a row to the "inventory_source_item" table for the Sku
@hazzy I think I understand your solution by duplicating a sku and entering the credentials yourself to add 1 product but my client has thousands of products automated via CSV import. It's not really a solution. Or maybe I have misread your answer. This issue really needs to be addressed soon.
@EnigmaWebdesign As i said, it is only a work-around until the issue is fixed properly in Magmi. I wrote a script to create the missing rows in "inventory_source_item" when a new Sku is created after the Magmi import runs.
Can you share the script or at least tell me what you did? It might help us out since it's a big issue in my view
@EnigmaWebdesign I don't think my script will be of any use to you as it relies on a non-Magento backend system which you won't have in your environment.
Run this query to see if it helps you to find the Skus in your system with missing "inventory_source_item" rows.
SELECT SKU from catalog_product_entity WHERE SKU NOT IN ( SELECT SKU FROM inventory_source_item ) ORDER BY SKU
Ok, thanks for the reply and explanation. I hope the developers can fix the issue a.s.a.p
I think I have found a temporary workaround myself, although it still needs some work.
It seems that the column "quantity" and "enabled" isn't used by Magmi or at least it's not being used during import into Magento 2.
I'm currently using this SQL query:
This is for the "inventory_source_item" table.
INSERT IGNORE INTO
inventory_source_item(source_code, sku, quantity, status) select 'default', sku, qty, stock_status from (
cataloginventory_stock_statusas
lgjoin
catalog_product_entityas
prdon((
lg.
product_id=
prd.
entity_id)));
After running the import first I don't see salable quantity being filled. After running the query I do see that the salable quantity is visible. The only drawback is that we have to do this daily and takes some time to finish (290.000 products).
@EnigmaWebdesign Your INSERT statement is the same as i am using - i just populate it from the non-magento backend system.
If the query takes a long time, would it be possible for you to re-write it to identify which rows are missing from "inventory_source_item" and only insert those? Your query attempts to insert a row even if the row is already there and that is probably the majority of them. Only an idea.
Agreed, that was my idea except my SQL skills are a bit rusty. Some sort of check has to be taken to skip excisting items and only place new ones.
@EnigmaWebdesign @hazzy are you able to send a PR to fix the issue?
@tmotyl I will invetigate to see if the issue started with Magento 2.3 as it used to work ok. Until i understand the issue fully, not sure it will be able to provide a PR
I will try and see from my end what I can do.
did you have a soultion for this yet as i like to fix mine please
For me I just run php bin/magento indexer:reindex and the sellable qty updates itself.
ok thanks
Anyone having trouble a solution for now is to run a SQL (could be via cron) with this:
INSERT IGNORE INTO inventory_source_item
(source_code, sku, quantity, status)
select 'default', sku, qty, stock_status from (cataloginventory_stock_status
as lg
join catalog_product_entity
as prd
on((lg
.product_id
= prd
.entity_id
)))
This is just a patch and we need a solution.
Did anyone find a solution to update magmi and not have to go each time in the database and run the SQL command? Without this the salable quantity is empty and the user cannot add it to its cart.
Hi @Henrik41 not so far but if you are interested to find a solution then i suggest you have a look at the "updateStock($pid, $item, $isnew)" function in the magmi_productimportengine.php script. It adds a row to the "cataloginventory_stock_item" table. You could use the code as a pattern to do the same for the "inventory_source_item " table in that function
problem with Magento 2.3.4 found for new products. For me, new products are added but Salable Quantity and Quantity per Source are not populating their field and stays blank even after updating only inventory with SKU's and qty fields.
Also on edit page of product we can not see salable quatity input box. I think Magmi only support 2.1.x.
How to troublshoot this issue ?