Elasticsuite: Optimizer Rule - Special Price treated as String versus Number, like Price

Created on 30 Oct 2019  路  5Comments  路  Source: Smile-SA/elasticsuite

When attempting to create a new optimizer, I was trying to move items with a special price to the bottom of a category. When I selected "Special Price", the value is treated as a string, rather than a numerical value.

Preconditions

Magento Version : 2.3.1
ElasticSuite Version : 2.8
Environment : Production

Steps to reproduce

  1. Create a new Optimizer
  2. Select Category Product View
  3. Apply to any category with any boost value
  4. Apply a rule utilizing Special Price

Expected result

  1. Special Price should function as a numerical value, like Price (is, greater than, less than, etc)

Actual result

  1. Special price options are "Contains" and "Does Not Contain"
    image

Most helpful comment

Hello @KholdenSP
[...]
If you plan to do a rule like "target all products having a special price under 50$", use a rule on Price like "Price is less than 50" (Price attribute should be treated as a numeric).

That is, use an "AND" combination ("ALL those rules ...") with both a rule on "Only discounted products" and a rule "Price is less than 50".

All 5 comments

Hello @KholdenSP

if you plan to boost (or bury) products that are actually discounted, you'd rather use the "Only discounted product" sub-rule.

That being said, I have the same issue as yours with special price being treated as a string BUT the "Special Price" should not be used (and available) in any cases here because it is simply not indexed into the Elasticsearch server : we only have a "price" field containing either the base price, or the special price if there is one. And we have a flag "is_discount" which is set either to true or false depending the fact that a special price is existing or not.

So, if you plan to do a rule like "target all products having a special price", use the "Only discounted product" condition.

If you plan to do a rule like "target all products having a special price under 50$", use a rule on Price like "Price is less than 50" (Price attribute should be treated as a numeric).

Regards

Hello @KholdenSP
[...]
If you plan to do a rule like "target all products having a special price under 50$", use a rule on Price like "Price is less than 50" (Price attribute should be treated as a numeric).

That is, use an "AND" combination ("ALL those rules ...") with both a rule on "Only discounted products" and a rule "Price is less than 50".

Makes a ton of sense. If the attribute is not indexed, what's the point of keeping it in the optimizer selection? Are any others in the list not actually indexed?

Nope, if an attribute is shown here, it's indexed and available for rules.

Only price & special_price do have this kind of "strange" things embedded.

Regards

Thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShirishRam picture ShirishRam  路  3Comments

shamoon picture shamoon  路  3Comments

lingwooc picture lingwooc  路  5Comments

JonathanBBD picture JonathanBBD  路  3Comments

sdasun picture sdasun  路  4Comments