Skip to content

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

@damcou
Copy link
Contributor

damcou commented Mar 6, 2025

Thanks a lot for your contribution @kamilszewczyk ! 🙌
Your fix has been approved and added to our upcoming versions 3.14.5 and 3.15.0 !
Closing this ticket, thanks again !

@damcou damcou closed this Mar 6, 2025
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

Successfully merging this pull request may close these issues.

3 participants