Guest User

Untitled

a guest
Aug 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. { "rules_test" : {
  2. "LABEL" : "Calcular X",
  3. "PLUGIN" : "reaction rule",
  4. "WEIGHT" : "1",
  5. "REQUIRES" : [
  6. "rules",
  7. "commerce_line_item",
  8. "commerce_cart",
  9. "commerce_product_reference"
  10. ],
  11. "ON" : [ "commerce_product_calculate_sell_price" ],
  12. "IF" : [
  13. { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } },
  14. { "component_rules_pvc" : { "product" : [ "commerce-line-item:commerce-product" ] } },
  15. { "NOT data_is_empty" : { "data" : [ "commerce-line-item:commerce-total:amount" ] } },
  16. ],
  17. "DO" : [
  18. { "variable_add" : {
  19. "USING" : {
  20. "type" : "commerce_price",
  21. "value" : { "value" : { "amount" : "", "currency_code" : "EUR" } }
  22. },
  23. "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
  24. }
  25. },
  26. { "LOOP" : {
  27. "USING" : { "list" : [ "commerce-line-item:order:commerce-line-items" ] },
  28. "ITEM" : { "list_item" : "Elemento actual de lista" },
  29. "DO" : [
  30. { "data_calc" : {
  31. "USING" : {
  32. "input_1" : [ "variable-added:amount" ],
  33. "op" : "+",
  34. "input_2" : [ "commerce-line-item:commerce-total:amount" ]
  35. },
  36. "PROVIDE" : { "result" : { "result" : "Calculation result" } }
  37. }
  38. }
  39. ]
  40. }
  41. },
  42. { "commerce_cart_product_add_by_sku" : {
  43. "USING" : {
  44. "user" : [ "site:current-user" ],
  45. "sku" : "XXXX",
  46. "quantity" : "1",
  47. "combine" : 1
  48. },
  49. "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
  50. }
  51. },
  52. { "commerce_line_item_unit_price_add" : {
  53. "commerce_line_item" : [ "commerce_line_item" ],
  54. "amount" : [ "variable-added:amount" ],
  55. "component_name" : "fee",
  56. "round_mode" : "0"
  57. }
  58. }
  59. ]
  60. }
  61. }
Add Comment
Please, Sign In to add comment