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

Problem with adding quantities in Magento 2.3.4 #89

Open
nilesh111091 opened this issue Dec 14, 2020 · 18 comments
Open

Problem with adding quantities in Magento 2.3.4 #89

nilesh111091 opened this issue Dec 14, 2020 · 18 comments

Comments

@nilesh111091
Copy link

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 ?

@hazzy
Copy link

hazzy commented Jan 11, 2021

Until Magmi gets updated, as an emergency bypass fix for the problem , add a row to the "inventory_source_item" table for the Sku

@EnigmaWebdesign
Copy link

@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.

@hazzy
Copy link

hazzy commented Jan 20, 2021

@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.

@EnigmaWebdesign
Copy link

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

@hazzy
Copy link

hazzy commented Jan 20, 2021

@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

@EnigmaWebdesign
Copy link

Ok, thanks for the reply and explanation.
I hope the developers can fix the issue a.s.a.p

@EnigmaWebdesign
Copy link

EnigmaWebdesign commented Jan 22, 2021

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_statusaslgjoincatalog_product_entityasprd on((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).

@hazzy
Copy link

hazzy commented Jan 22, 2021

@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.

@EnigmaWebdesign
Copy link

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.

@tmotyl
Copy link
Member

tmotyl commented Jan 22, 2021

@EnigmaWebdesign @hazzy are you able to send a PR to fix the issue?

@hazzy
Copy link

hazzy commented Jan 22, 2021

@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

@EnigmaWebdesign
Copy link

I will try and see from my end what I can do.

@cbtrident
Copy link

did you have a soultion for this yet
as i like to fix mine please

@Henrik41
Copy link

For me I just run php bin/magento indexer:reindex and the sellable qty updates itself.

@cbtrident
Copy link

ok thanks

@Henrik41
Copy link

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.

@Henrik41
Copy link

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.

@hazzy
Copy link

hazzy commented Mar 12, 2023

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

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

6 participants