cancel
Showing results for 
Search instead for 
Did you mean: 

Promotion engine, custom condition to exclude products by category

0 Kudos
551

Hi all

I'm working on hybris commerce 1808.

I'm trying to create custom promotion condition that exclude/include products (uploaded by excel) creating a new category and matching that category during promotion evaluation.

To achieve this I create a condition that let me

- upload a media (the excel containing products)

- category operator (to choice if CONTAIN or NOT CONTAIN)

- catalog version

- category code

In translator I create the category and produce the drool

(
         $rao_v4 := CategoryRAO(code == "CATEGORY_C")
         and
         $rao_v5 := ProductRAO(categories contains $rao_v4)
         and
         $rao_v6 := OrderEntryRAO(product == $rao_v5, quantity >= new Integer(1))
         and
         exists (CartRAO(entries contains $rao_v6))
         and
         exists (ProductConsumedRAO(orderEntry == $rao_v6, availableQuantity >= new Integer(1)))
      )

to match the category on the products added to cart.

Now, if I use this condition ADDING products it works like standard condition and perform as needed.

If I try to EXCLUDE products (by category, using NOT CONTAINS) with other condition like standard qualifying_category condition, a new drool is produced:

(
         $rao_v4 := CategoryRAO(code == "CATEGORY_A" || code == "CATEGORY_B")
         and
         $rao_v5 := ProductRAO(categories contains $rao_v4)
         and
         $rao_v6 := OrderEntryRAO(product == $rao_v5, quantity >= new Integer(1))
         and
         exists (CartRAO(entries contains $rao_v6))
         and
         exists (ProductConsumedRAO(orderEntry == $rao_v6, availableQuantity >= new Integer(1)))
      )
      and
      not (
         $rao_v4 := CategoryRAO(code == "CATEGORY_C")
         and
         $rao_v5 := ProductRAO(categories contains $rao_v4)
         and
         $rao_v6 := OrderEntryRAO(product == $rao_v5, quantity >= new Integer(1))
         and
         exists (CartRAO(entries contains $rao_v6))
         and
         exists (ProductConsumedRAO(orderEntry == $rao_v6, availableQuantity >= new Integer(1)))
      )

which in my opinion it should include products in CATEGORY_A and CATEGORY_B and at the same time EXCLUDE products in CATEGORY_C.

Right now the rule is not excluding products in CATEGORY_C so it's applying promotion on excluded products too.

I saw that in standard condition (qualifying_categories) produces a drool like:

(
    $v4 := CategoryRAO(code == "CATEGORY_A" || code == "CATEGORY_B")
    and
    $v5 := ProductRAO(categories contains $v4)
    and
    $v6 := OrderEntryRAO(product == $v5, quantity >= new Integer(1))
    and
    $v1 := CartRAO(entries contains $v6)
    and
    $v7 := ProductConsumedRAO(orderEntry == $v6, availableQuantity >= new Integer(1))
    and
    not (
      $v4 := CategoryRAO(code == "CATEGORY_C")
      and
      $v5 := ProductRAO(categories contains $v4)
    )
)

which include the entire "exclusion” in a sub-condition, but I'm asking why excluding products in two different condition is not working at all.

Please help

thanks

Accepted Solutions (0)

Answers (0)