Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reset customer group collection after filtering #1699

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kamilszewczyk
Copy link

Without clearing customer group collection, any loops on existing collection will not be filtered

Summary

Add field filtering without clearing the collection (or creating new instance of it) will not actually do anything. Excluding websites should speed up the process of indexing by not requiring retrieval of grouped prices in websites that are excluded.
Without this modification this code doesn't do anything.

Result

With Customer Group # option enabled, any runs of foreach ($this->groups as $group) for example in vendor/algolia/algoliasearch-magento-2/Helper/Entity/Product/PriceManager/ProductWithChildren.php::setFinalGroupPrices should only loop through customer groups that are NOT excluded in the current website scope.

Without the change:
image

After the change:
image

Without clearing customer group collection, any loops on existing collection will not be filtered
@cammonro
Copy link
Contributor

@kamilszewczyk Thank you for identifying this bug! This is a sensible fix and we'll be sure to include it in a future patch release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants