Advertisement
MrJoshMiller

Step 1: Confirm line item has product display

Nov 15th, 2013
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. { "rules_step_1_confirm_line_item_has_product_display" : {
  2.     "LABEL" : "Step 1: Confirm line item has product display",
  3.     "PLUGIN" : "rule",
  4.     "REQUIRES" : [ "rules" ],
  5.     "USES VARIABLES" : {
  6.       "line_item" : { "label" : "line_item", "type" : "commerce_line_item" },
  7.       "user_purchased" : { "label" : "user_purchased", "type" : "user" },
  8.       "product_display" : { "label" : "product_display", "type" : "node", "parameter" : false }
  9.     },
  10.     "IF" : [
  11.       { "entity_has_field" : { "entity" : [ "line-item" ], "field" : "commerce_product" } }
  12.     ],
  13.     "DO" : [
  14.       { "entity_query" : {
  15.           "USING" : {
  16.             "type" : "node",
  17.             "property" : "field_product",
  18.             "value" : [ "line-item:commerce-product:product-id" ],
  19.             "limit" : "1"
  20.           },
  21.           "PROVIDE" : { "entity_fetched" : { "product_display_list" : "product_display_list" } }
  22.         }
  23.       },
  24.       { "data_set" : { "data" : [ "product-display" ], "value" : [ "product-display-list:0" ] } }
  25.     ],
  26.     "PROVIDES VARIABLES" : [ "product_display" ]
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement