Discussions

Pricing Rule changes base price permanently

I have created a user role "reseller". Every user in this role gets an individual discount, for example user XXX got 10% discount, user YYY got 15%. The discount is saved in the user profile.

I created a pricing rule which should calculate the individual price for each reseller. The price is displayed correctly, but when I add the product to the cart, the base price is reduced by the discount permanently. When I add another item, the price is reduced again.

In my understanding the pricing rules should calculate the price before adding to the cart, but not change the base price. What do I wrong?

Here is the pricing rule:

{ "rules_preisgruppenrabatt_d_ber_cksichtigen" : {
"LABEL" : "Preisgruppenrabatt Z ber\u00fccksichtigen",
"PLUGIN" : "reaction rule",
"WEIGHT" : "-1",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } },
{ "entity_has_field" : {
"entity" : [ "site:current-user:profile-fachhandel" ],
"field" : "field_preisgruppe_d"
}
},
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "4" : "4" } }
}
},
{ "entity_has_field" : {
"entity" : [ "commerce-line-item:commerce-product" ],
"field" : "field_price_group"
}
},
{ "data_is" : {
"data" : [ "commerce-line-item:commerce-product:field-price-group" ],
"value" : "6"
}
}
],
"DO" : [
{ "data_calc" : {
"USING" : {
"input_1" : [ "site:current-user:profile-fachhandel:field-preisgruppe-d" ],
"op" : "-",
"input_2" : "100"
},
"PROVIDE" : { "result" : { "result" : "Calculation result" } }
}
},
{ "data_calc" : {
"USING" : { "input_1" : [ "result" ], "op" : "*", "input_2" : "-1" },
"PROVIDE" : { "result" : { "result1" : "Calculation result" } }
}
},
{ "data_calc" : {
"USING" : { "input_1" : [ "result1" ], "op" : "\/", "input_2" : "100" },
"PROVIDE" : { "result" : { "result2" : "Calculation result" } }
}
},
{ "commerce_line_item_unit_price_multiply" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : [ "result2" ],
"component_name" : "base_price",
"round_mode" : "1"
}
}
]
}
}

Thanks for your help,
Chris

Posted: Dec 9, 2014

Comments