Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rules_price_based_on_product_display_node" : {
- "LABEL" : "Price based on Product Display Node Field",
- "PLUGIN" : "reaction rule",
- "REQUIRES" : [ "php", "rules", "commerce_line_item", "commerce_product_reference" ],
- "ON" : [ "commerce_product_calculate_sell_price" ],
- "DO" : [
- { "variable_add" : {
- "USING" : {
- "type" : "integer",
- "value" : {
- "select" : "commerce-line-item:line-item-id",
- "php" : { "code" : "$line_item_wrapper = entity_metadata_wrapper(\u0027commerce_line_item\u0027, $value);\r\n$url = $line_item_wrapper-\u003Ecommerce_display_path-\u003Evalue();\r\n$url_parts = explode(\u0027\/\u0027, $url);\r\nreturn $url_parts[1];" }
- }
- },
- "PROVIDE" : { "variable_added" : { "nid" : "nid" } }
- }
- },
- { "entity_fetch" : {
- "USING" : { "type" : "node", "id" : [ "nid" ] },
- "PROVIDE" : { "entity_fetched" : { "product_display" : "Product Display" } }
- }
- },
- { "commerce_line_item_unit_price_multiply" : {
- "commerce_line_item" : [ "commerce_line_item" ],
- "amount" : [ "product-display:status" ],
- "component_name" : "discount",
- "round_mode" : "1"
- }
- }
- ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement