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

products became “out of stock” after update from 2.0.7 to 2.1.0 #5222

Closed
antonlazarchenko opened this issue Jun 24, 2016 · 22 comments
Closed
Labels
bug report Component: Setup Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@antonlazarchenko
Copy link

antonlazarchenko commented Jun 24, 2016

After updating from 2.0.7 to 2.1.0 all the products in catalog became "out of stock". That's how they displaying in my bestseller widget.
But in admin panel they always have positive quantity, so they have to be "in stock".
And, of course, they are invisible at frontend catalog.

UPD: Only when I'm adding a new product it appears at catalog, but no changes with already existed catalog products. indexer:reindex doesn't solve the problem with existed products.

Why is that so and how to fix that?

@andimov
Copy link
Contributor

andimov commented Jun 24, 2016

@antonlazarchenko
Thank you for reporting this issue!
Please, provide description according to the template.

@antonlazarchenko
Copy link
Author

antonlazarchenko commented Jun 25, 2016

@andimov , I run site at localhost under windows 7, using xampp with php 7.0.6 required for magento 2.1.0.
I did following:

  1. Change magento community edition version inside composer.json from 2.0.7 to 2.1.0
  2. composer update
  3. bin/magento setup upgrade
    I saw that frontend product catalog is empty, but I added some products before updating magento so they should be at frontend product catalog. At admin product catalog they were present and everything seems correct (enabled, quantity at stock is podivite value)
    Then I did this step
  4. bin/magento indexer:reindex
    Nothing changed inside product catalog.
    Then I tried to create new product via admin and it was successfull. New product appeared at frontend catalog.
    But old ones still didnt show.

What else can I describe?

@andimov
Copy link
Contributor

andimov commented Jun 27, 2016

@antonlazarchenko
Thank you for more detailed description.
Please specify MySQL engine and version. (You can also check System Requirements)

@antonlazarchenko
Copy link
Author

antonlazarchenko commented Jun 29, 2016

@andimov here it is:

Server: Localhost via UNIX socket
Programm: MySQL
Version: 5.5.29 - MySQL Community Server (GPL)
Protocol version: 10
Server encoding: UTF-8 Unicode (utf8)

System requirements is ok including php version 7.0.6.

@andimov
Copy link
Contributor

andimov commented Jun 29, 2016

@antonlazarchenko
MySQL 5.6 is requirement for Magento 2, probably your problem caused by this.

@antonlazarchenko
Copy link
Author

@andimov sorry, it was a mistake caused bad version of mysql client.
The real MySQL version is 5.7.11.
So we can exclude version factor.

@flecxie
Copy link

flecxie commented Jul 14, 2016

Same problem here after upgrading from Magento 2.0.7 to 2.1.0, note that my Magento 2.0.7 had products imported from a 1.7.0.2 database using data-migration-tool.

After following steps below all my products show as 'out of stock' and don't show up in categories:

../composer/composer.phar require magento/data-migration-tool:2.1.0 --no-update
../composer/composer.phar require magento/product-community-edition 2.1.0 --no-update
php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento indexer:reindex

I have MySQL 5.6.3 running on localhost.

I can still see the products when I visit product pages directly but can't order these products as they are out of stock. On Magento 2.0.7 all products were visible & purchasable. Note that I have Configuration -> Catalog -> Inventory -> Manage Stock set to "No" and Display Out of Stock Products set to "Yes".

Note that I was suffering from the issues described in #5236 and had to remove all items from catalog_product_entity_varchar attribute_id=111 to work around the following error: Notice: Undefined offset: 111 in /vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 166

mysql> delete from catalog_product_entity_varchar where attribute_id=111;
Query OK, 7890 rows affected (0.11 sec)

Wondering if this could be the root cause of this next issue...
@andimov: any chance that you had to do the same?

@flecxie
Copy link

flecxie commented Jul 14, 2016

FWIW: noticed that quantity_and_stock_status attribute was (no longer?) part of the Migration_Default attribute set, so couldn't see stock information on product pages on backend. After manualling adding the quantity_and_stock_status attribute to the Migration_Default attribute set I can see all products in backend as "In Stock" but on frontend they still show "Out of Stock". I also can't seem to change the value of quantity_and_stock_status in backend (when I change a product to "Out of Stock" the page reloads and shows "In Stock" again).

Can someone tell me what SQL query I can execute to show stock status of products?

@DmytroRevischuk
Copy link

DmytroRevischuk commented Jul 14, 2016

In my case I solved problem by changing website_id to 0 in cataloginventory_stock and then I did reindex.

@andimov
Copy link
Contributor

andimov commented Jul 14, 2016

@DmytroRevischuk thank you for solution!
@antonlazarchenko @flecxie please, check this solution for your issues.

@antonlazarchenko
Copy link
Author

antonlazarchenko commented Jul 14, 2016

@andimov unfortunatelly it doesn't work for me. I already had website_id=0, so there was nothing to change.
image

@flecxie
Copy link

flecxie commented Jul 14, 2016

@DmytroRevischuk thanks, this fixed my problem!

mysql> select * from cataloginventory_stock;
+----------+------------+------------+
| stock_id | website_id | stock_name |
+----------+------------+------------+
|        1 |          1 | Default    |
+----------+------------+------------+
1 row in set (0.00 sec)

mysql> update cataloginventory_stock set website_id=0 where stock_id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

@andimov
Copy link
Contributor

andimov commented Jul 15, 2016

@antonlazarchenko Did you use the migration tool in this installation?

@antonlazarchenko
Copy link
Author

@andimov no, I didn't. Is that necessary for upgrade from 2.0 to 2.1?

@andimov andimov removed their assignment Sep 2, 2016
@shiftedreality shiftedreality self-assigned this Sep 7, 2016
@shiftedreality
Copy link
Member

Hi @antonlazarchenko

Thank you for reporting.
We've created an internal ticket MAGETWO-58134 to resolve this issue.

@NadiyaS
Copy link
Contributor

NadiyaS commented Sep 15, 2016

Hi,
this issue was already fixed and will be delivered soon,
for now you can use quick fix :
Run MySQL query update cataloginventory_stock_item set website_id = 0 where website_id = 1;
and then run in CLI php bin/magento index:reindex cataloginventory_stock.

@Tristan-N
Copy link

@DmytroRevischuk @andimov
I had this problem after updating from Magento 2.1 to Magento 2.1.1 (didn't had the problem after migrating from 2.0 to 2.1 btw).

Your solutions worked perfect for me as well. Thank you.

mmansoor-magento pushed a commit that referenced this issue Sep 23, 2016
…rom 2.0.7 to 2.1.0 #5222

 - remove reindex from data upgrade script
mmansoor-magento pushed a commit that referenced this issue Sep 23, 2016
…rom 2.0.7 to 2.1.0 #5222

 - set cataloginventory_stock index as invalid
mmansoor-magento pushed a commit that referenced this issue Sep 23, 2016
Fixed issues:
* MAGETWO-57820: [GITHUB] php bin/magento i18n:pack creates unwanted dir #6260
Bug - P1
* MAGETWO-58337: [Github] Duplicated & missing product rows in system product export #4531
* MAGETWO-58289: [Github] Product URL Key not automatically generating during import #5128
* MAGETWO-58134: [GitHub] Products became “out of stock” after update from 2.0.7 to 2.1.0 #5222
* MAGETWO-58132: [GitHub] module:uninstall can remove code it uses itself #5797
* MAGETWO-58236: Sync requirements of composer.json of Sample-data with mainline
@LucScu
Copy link

LucScu commented Oct 13, 2016

Do you think i have to run also
delete from cataloginventory_stock_status where website_id = 1;
?

@NadiyaS
Copy link
Contributor

NadiyaS commented Oct 13, 2016

Hi @LucScu ,
it is not necessary to delete records from cataloginventory_stock_status table. Run reindex is enough.
This issue is closed as resolved.

@NadiyaS NadiyaS closed this as completed Oct 13, 2016
@LucScu
Copy link

LucScu commented Oct 13, 2016

Also after run reindex products with website = 1 remains in cataloginventory_stock_status

@vihuarar
Copy link

vihuarar commented Oct 26, 2016

I solved just doing a php bin/nagento inderxer:reindexer in terminal

okorshenko pushed a commit that referenced this issue Dec 14, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
Fixed issue:
 - MAGETWO-56804 [Backport] Product catalog Import/export - Date & Timezone issue - for 2.1
 - MAGETWO-58312 [Backport][GitHub] Products became “out of stock” after update from 2.0.7 to 2.1.0 #5222 - for 2.1
@vladyslav-kalyuzhnyy
Copy link

@vihuarar you made a mistake.
Your solutions worked perfect but not php bin/nagento inderxer:reindexer .
It will be right php bin/magento indexer:reindex .

magento-engcom-team pushed a commit that referenced this issue Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Setup Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

10 participants