Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rules_test" : {
- "LABEL" : "Calcular X",
- "PLUGIN" : "reaction rule",
- "WEIGHT" : "1",
- "REQUIRES" : [
- "rules",
- "commerce_line_item",
- "commerce_cart",
- "commerce_product_reference"
- ],
- "ON" : [ "commerce_product_calculate_sell_price" ],
- "IF" : [
- { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } },
- { "component_rules_pvc" : { "product" : [ "commerce-line-item:commerce-product" ] } },
- { "NOT data_is_empty" : { "data" : [ "commerce-line-item:commerce-total:amount" ] } },
- ],
- "DO" : [
- { "variable_add" : {
- "USING" : {
- "type" : "commerce_price",
- "value" : { "value" : { "amount" : "", "currency_code" : "EUR" } }
- },
- "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
- }
- },
- { "LOOP" : {
- "USING" : { "list" : [ "commerce-line-item:order:commerce-line-items" ] },
- "ITEM" : { "list_item" : "Elemento actual de lista" },
- "DO" : [
- { "data_calc" : {
- "USING" : {
- "input_1" : [ "variable-added:amount" ],
- "op" : "+",
- "input_2" : [ "commerce-line-item:commerce-total:amount" ]
- },
- "PROVIDE" : { "result" : { "result" : "Calculation result" } }
- }
- }
- ]
- }
- },
- { "commerce_cart_product_add_by_sku" : {
- "USING" : {
- "user" : [ "site:current-user" ],
- "sku" : "XXXX",
- "quantity" : "1",
- "combine" : 1
- },
- "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
- }
- },
- { "commerce_line_item_unit_price_add" : {
- "commerce_line_item" : [ "commerce_line_item" ],
- "amount" : [ "variable-added:amount" ],
- "component_name" : "fee",
- "round_mode" : "0"
- }
- }
- ]
- }
- }
Add Comment
Please, Sign In to add comment