Advertisement
MrJoshMiller

Letting the user set the price

Aug 7th, 2013
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. { "rules_user_price" : {
  2.     "LABEL" : "User Price",
  3.     "PLUGIN" : "reaction rule",
  4.     "REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
  5.     "ON" : [ "commerce_product_calculate_sell_price" ],
  6.     "IF" : [
  7.       { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "field_user_price" } }
  8.     ],
  9.     "DO" : [
  10.       { "variable_add" : {
  11.           "USING" : {
  12.             "type" : "decimal",
  13.             "value" : [ "commerce-line-item:field-user-price:amount-decimal" ]
  14.           },
  15.           "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
  16.         }
  17.       },
  18.       { "data_calc" : {
  19.           "USING" : { "input_1" : [ "variable-added" ], "op" : "*", "input_2" : "100" },
  20.           "PROVIDE" : { "result" : { "result" : "Calculation result" } }
  21.         }
  22.       },
  23.       { "commerce_line_item_unit_price_amount" : {
  24.           "commerce_line_item" : [ "commerce_line_item" ],
  25.           "amount" : [ "result" ],
  26.           "component_name" : "base_price",
  27.           "round_mode" : "1"
  28.         }
  29.       }
  30.     ]
  31.   }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement