magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Catalog shown entire catalog items count if show_of_stock_option enabled

Open Den4ik opened this issue 2 years ago • 12 comments

Preconditions and environment

  • 2.4-develop Vanila instance

Steps to reproduce

  1. Take Vanila instance by magento give me 2.4-develoop instance
  2. Go to Stores->Configuration->Catalog->Inventory and Enable Display Out of Stock Products
  3. Clear cache
  4. Go to catalog Women->Tops->Bras & Tanks
  5. Apply Filter Style->Bra that show 5 items

Expected result

Total catalog items should show 5 items and 5 as total value

Actual result

  1. Shown 12 items in catalog
  2. Shown 14 as total items 2022-08-09-17-15-35@2x

Additional information

No response

Release note

No response

Triage and priority

  • [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Den4ik avatar Aug 09 '22 14:08 Den4ik

Hi @Den4ik. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Aug 09 '22 14:08 m2-assistant[bot]

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 09 '22 14:08 m2-assistant[bot]

Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 12 '22 13:08 m2-assistant[bot]

@magento give me 2.4-develop instance

engcom-Lima avatar Aug 12 '22 13:08 engcom-Lima

@magento give me 2.4-develop instance

engcom-Lima avatar Aug 12 '22 13:08 engcom-Lima

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Lima, here is your Magento Instance: https://a9e471e7ff78aa58a1710cfd84b5b22f.instances.magento-community.engineering Admin access: https://a9e471e7ff78aa58a1710cfd84b5b22f.instances.magento-community.engineering/admin_f688 Login: d9987951 Password: 4221d87bd27d

:heavy_check_mark: Issue confirmed

Issue got reproduced in 2.4-develop branch.

Description: Showing wrong inventory count in the frontend. Pre-requisite: 2.4-develop Vanila instance

Steps to reproduce:

  1. Take Vanila instance by @magento give me 2.4-develoop instance.
  2. Go to Stores->Configuration->Catalog->Inventory and Enable Display Out of Stock Products
  3. Clear cache
  4. Go to catalog Women->Tops->Bras & Tanks
  5. Apply Filter Style->Bra that show 5 items

Expected result: Total catalog items should show 5 items and 5 as total value

Actual result : It was showing 14 items.

Screenshot:

image

image

Hence,confirming the issue.

Thanks

engcom-Lima avatar Aug 12 '22 13:08 engcom-Lima

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Lima, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6395 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Aug 12 '22 13:08 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Aug 12 '22 13:08 m2-assistant[bot]

This commit broke this functionality and need to be refactored: https://github.com/magento/magento2/commit/3a889f465e21cdba4a78788704f3c5b31f3d2d9f Reverting everything back does help. I'm not absolutely sure about the logic stored in that private method.

zhartaunik avatar Aug 15 '22 06:08 zhartaunik

@magento give me 2.4-develoop instance

Bashev avatar Aug 19 '22 11:08 Bashev

Hi @Bashev. Thank you for your request. I'm working on Magento instance for you.

Hi @Bashev, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@Den4ik can you make a review for this fix?

Bashev avatar Aug 19 '22 17:08 Bashev

Also check the magento inventory repo more often please there i reported the same issue: https://github.com/magento/inventory/issues/3360

It looks like no one is active on that repo to pick the issues up.

leonhelmus avatar Aug 21 '22 09:08 leonhelmus

These are probably related: https://github.com/magento/magento2/issues/36055

I did a bit of testing between 2.4.5 and 2.4.3 and 2.4.3 works correctly.

2.4.5 outputs the whole catalog - it makes a search page output ALL enabled products which results in a 22 second page loading time.

pmonosolo avatar Aug 30 '22 20:08 pmonosolo

Whoever is working on this, please release this as a hotfix - this is an important part of the store. PHP 7.4 is EOL in 2 months, we've gotta get it fixed.

pmonosolo avatar Aug 30 '22 20:08 pmonosolo

Ya'll should try the fix in this thread: https://github.com/magento/inventory/issues/3360

pmonosolo avatar Aug 30 '22 20:08 pmonosolo

@pmonosolo see also my fix https://github.com/magento/magento2/pull/35986

Bashev avatar Aug 30 '22 20:08 Bashev

@Den4ik Thanks for contributing, internal team has started working on this.

glo17680 avatar Sep 01 '22 10:09 glo17680

Any updates on this matter?

i6media avatar Oct 06 '22 17:10 i6media

@i6media It will be merge soon, PR in queue

glo71317 avatar Oct 07 '22 05:10 glo71317

@glo71317 could you link the correct PR here? The one from @Bashev is not sufficient since it still fetches all products and filters them afterwards by PHP (slow loading times), instead of in the query itself.

i6media avatar Oct 07 '22 07:10 i6media

@i6media We raised the internal PR so you will not have the access for the same, so i don't think it will help. we have taken the commits from @Bashev PR and written automation tests.

glo71317 avatar Oct 07 '22 08:10 glo71317

@glo71317 can you provide a patch file for the changes?

ssx avatar Oct 08 '22 13:10 ssx

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-6395 by the internal team Related commits: https://github.com/magento/magento2/search?q=AC-6395&type=commits

Based on the Jira ticket, the target version is 2.4.6.

Thanks

engcom-Hotel avatar Oct 10 '22 11:10 engcom-Hotel

@ssx you can copy the file (https://github.com/magento/magento2/blob/7792c18603d80f020dd0265d78ecf0ad8f64f944/app/code/Magento/Elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php) and temporarily overwrite it in your own module through di.xml, until the new versions comes out.

<preference for="Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier" type="Foo\Bar\Plugin\Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier" />

i6media avatar Oct 10 '22 15:10 i6media