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

Customer group not taken into account when using "is_discount" special attribute #2380

Closed
romainruaud opened this issue Dec 8, 2021 · 1 comment · Fixed by #2399, #2400 or #2401
Closed
Assignees
Labels

Comments

@romainruaud
Copy link
Collaborator

Preconditions

Magento Version : all

ElasticSuite Version : all

Environment : all

Third party modules : none

Steps to reproduce

  1. Have products discounted for particular customer groups
  2. Build a rule (virtual category or optimizer) using the "only discounted products" condition
  3. Browse the front-office on a page where this rule should be triggered

Expected result

  1. Only products discounted for the current customer group should be considered

Actual result

  1. Products discounted for any customer group are considered

The built query is generated by this class and looks like this :

"bool": {
                    "must": [
                      {
                        "nested": {
                          "path": "price",
                          "score_mode": "none",
                          "query": {
                            "terms": {
                              "price.is_discount": [
                                true
                              ],
                              "boost": 1
                            }
                          },
                          "boost": 1
                        }
                      }
                    ],

It should include a nested field to target explicitely the current customer group.

@romainruaud romainruaud added the bug label Dec 8, 2021
@romainruaud
Copy link
Collaborator Author

The query should be written as nested query, like it's done here : https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-catalog/Model/Layer/Filter/Price.php#L165

But customer group id should be added to the clause only for frontend.

rbayet added a commit to rbayet/elasticsuite that referenced this issue Dec 17, 2021
by adding support for current customer group.
@rbayet rbayet linked a pull request Dec 17, 2021 that will close this issue
rbayet added a commit to rbayet/elasticsuite that referenced this issue Dec 17, 2021
by adding support for current customer group.
@rbayet rbayet linked a pull request Dec 17, 2021 that will close this issue
rbayet added a commit that referenced this issue Dec 17, 2021
…group

Fixes #2380 is_discount tiers price support (2.8.x)
rbayet added a commit to rbayet/elasticsuite that referenced this issue Dec 17, 2021
by adding support for current customer group.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Dec 17, 2021
by adding support for current customer group.
rbayet added a commit that referenced this issue Dec 17, 2021
…group_2.9.x

Fixes #2380 is_discount tiers price support
rbayet added a commit to rbayet/elasticsuite that referenced this issue Dec 17, 2021
by adding support for current customer group.
@rbayet rbayet linked a pull request Dec 17, 2021 that will close this issue
rbayet added a commit that referenced this issue Dec 17, 2021
…group_2.10.x

Fixes #2380 is_discount tiers price support
rbayet added a commit to rbayet/elasticsuite that referenced this issue Jan 4, 2022
rbayet added a commit that referenced this issue Jan 4, 2022
…group_retailer

Fixes #2380 easier smile/module-retailer-offer compatibility
rbayet added a commit to rbayet/elasticsuite that referenced this issue Jan 4, 2022
rbayet added a commit that referenced this issue Jan 4, 2022
…group_retailer_2.9.x

Fixes #2380 easier smile/module-retailer-offer compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment