{ "rules_adjust_stock_on_order_product_add" : { "LABEL" : "Adjust stock on order product add", "PLUGIN" : "reaction rule", "TAGS" : [ "Stock" ], "REQUIRES" : [ "uc_stock", "php", "uc_order" ], "ON" : [ "uc_order_product_add" ], "DO" : [ { "uc_stock_action_adjust" : { "model" : [ "product:model" ], "operator" : "+", "qty" : [ "product:qty" ] } }, { "uc_order_action_add_comment" : { "order" : [ "order" ], "comment" : "The stock level for \u003C?php print($product-\u003Emodel); ?\u003E has been decreased to \u003C?php print(uc_stock_level($product-\u003Emodel)); ?\u003E.", "comment_type" : "admin" } } ] } } { "rules_adjust_stock_on_order_product_edit" : { "LABEL" : "Adjust stock on order product edit", "PLUGIN" : "reaction rule", "TAGS" : [ "Stock" ], "REQUIRES" : [ "rules", "uc_stock", "php", "uc_order" ], "ON" : [ "uc_order_product_update" ], "DO" : [ { "data_calc" : { "USING" : { "input_1" : [ "product:qty" ], "op" : "-", "input_2" : [ "updated-product:qty" ] }, "PROVIDE" : { "result" : { "qty" : "Quatity" } } } }, { "uc_stock_action_adjust" : { "model" : [ "product:model" ], "operator" : "+", "qty" : [ "qty" ] } }, { "uc_order_action_add_comment" : { "order" : [ "order" ], "comment" : "\u003C?php\r\n$action = $qty \u003E 0 ? t(\u0027increased\u0027) : t(\u0027decreased\u0027);\r\n?\u003E\r\nThe stock level for \u003C?php print($product-\u003Emodel); ?\u003E has been \u003C?php print($action); ?\u003E to \u003C?php print(uc_stock_level($product-\u003Emodel)); ?\u003E.", "comment_type" : "admin" } } ] } } { "rules_adjust_stock_on_order_product_delete" : { "LABEL" : "Adjust stock on order product delete", "PLUGIN" : "reaction rule", "TAGS" : [ "Stock" ], "REQUIRES" : [ "uc_stock", "php", "uc_order" ], "ON" : [ "uc_order_product_del" ], "DO" : [ { "uc_stock_action_adjust" : { "model" : [ "product:model" ], "operator" : "-", "qty" : [ "product:qty" ] } }, { "uc_order_action_add_comment" : { "order" : [ "order" ], "comment" : "The stock level for \u003C?php print($product-\u003Emodel); ?\u003E has been increased to \u003C?php print(uc_stock_level($product-\u003Emodel)); ?\u003E.", "comment_type" : "admin" } } ] } }