I am trying to create sub order from an order place on my portal . so this I have created a rules which triggers at checkout.I have created this rules with help of a component as per below.

Main rules is as below

      { "rules_subordergenerationatcheckout" : {
        "LABEL" : "SubOrdergenerationAtCheckout",
        "PLUGIN" : "reaction rule",
        "OWNER" : "rules",
        "REQUIRES" : [ "rules", "uc_cart" ],
        "ON" : { "uc_checkout_complete" : [] },
        "DO" : [
          { "LOOP" : {
              "USING" : { "list" : [ "order:products" ] },
              "ITEM" : { "list_item" : "Current list item" },
              "DO" : [
                { "entity_create" : {
                    "USING" : { "type" : "uc_order", "param_order_status" : "pending" },
                    "PROVIDE" : { "entity_created" : { "subordercreated" : "Created entity" } }
                  }
                },
                { "component_rules_subordercomponent" : {
                    "subordercompparam" : [ "subordercreated" ],
                    "orderparam" : [ "order" ],
                    "orderproductparam" : [ "list-item" ]
                  }
                },
                { "entity_save" : { "data" : [ "subordercreated" ], "immediate" : 1 } }
              ]
            }
          }
        ]
      }
    }

Now as u can see this rule uses a component
below is the exports of this component

   { "rules_subordercomponent" : {
    "LABEL" : "suborderComponent",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "subordercompparam" : { "label" : "Order Entity which is just created", "type" : "uc_order" },
      "orderparam" : { "label" : "Order", "type" : "uc_order" },
      "orderproductparam" : { "label" : "Order Producr line item", "type" : "uc_order_product" }
    },
    "IF" : [
      { "entity_is_of_type" : { "entity" : [ "subordercompparam" ], "type" : "uc_order" } }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "subordercompparam:field-parent-order" ],
          "value" : [ "orderparam:order-id" ]
        }
      },
      { "data_set" : {
          "data" : [ "subordercompparam:customer" ],
          "value" : [ "orderparam:customer" ]
        }
      },
      { "data_set" : {
          "data" : [ "subordercompparam:delivery-address" ],
          "value" : [ "orderparam:delivery-address" ]
        }
      },
      { "data_set" : {
          "data" : [ "subordercompparam:billing-address" ],
          "value" : [ "orderparam:billing-address" ]
        }
      },
      { "list_add" : {
          "list" : [ "subordercompparam:products" ],
          "item" : [ "orderproductparam" ],
          "unique" : 1
        }
      },
      { "data_set" : {
          "data" : [ "subordercompparam:field-order-fullfillmentowner" ],
          "value" : [ "orderproductparam:node:author:uid" ]
        }
      },
      { "mail" : {
          "to" : [ "subordercompparam:field-order-fullfillmentowner" ],
          "subject" : "An Order [subordercompparam:order-id] is placed in your order queue.",
          "message" : "Dear Vendor,\r\n\r\nAnd Order with order id  [subordercompparam:order-id] is placed in your orderqueue.\r\nPlease visit the portal to fullfil your order.\r\n\r\nRegards\r\nBoutiquesOnCart Team",
          "language" : [ "orderproductparam:node:language" ]
        }
      }
    ]
 

     }
    }

now the real problem is this rule is able to generate the suborder but the fields which needs to copied in this new order are blank.
can anybody help me at this

Comments

TR’s picture

Category: Bug report » Support request
Priority: Major » Normal
TR’s picture

Component: Orders » Rules

Added "Rules" component.