Advertisement
mariomc

Untitled

Jul 11th, 2012
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. { "rules_create_product_on_node_save" : {
  2. "LABEL" : "Create product on node save",
  3. "PLUGIN" : "reaction rule",
  4. "REQUIRES" : [ "rules" ],
  5. "ON" : [ "node_insert" ],
  6. "IF" : [
  7. { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "example" : "example" } } } },
  8. { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_product_reference" } }
  9. ],
  10. "DO" : [
  11. { "entity_create" : {
  12. "USING" : {
  13. "type" : "commerce_product",
  14. "param_sku" : "[node:title]",
  15. "param_type" : "product",
  16. "param_title" : "[node:title]",
  17. "param_creator" : [ "node:author" ],
  18. "param_commerce_price" : { "value" : { "amount" : "0", "currency_code" : "USD" } },
  19. "param_commerce_stock" : "0"
  20. },
  21. "PROVIDE" : { "entity_created" : { "created_product" : "Created Product" } }
  22. }
  23. },
  24. { "entity_save" : { "data" : [ "created-product" ], "immediate" : 1 } },
  25. { "data_set" : {
  26. "data" : [ "node:field-product-reference" ],
  27. "value" : [ "created-product" ]
  28. }
  29. }
  30. ]
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement