3

I have setup eshop (Commerce Kickstart) with two type of payments: Bank Transfer and Cash on Delivery. I need to send different emails for selected payment method (Bank Transfer or Cash on Delivery).

I have decide to use rules for it. For Cash on Delivery payment I have used default message "Commerce Order: order confirmation" - commerce_order_confirmation from Commerce Kickstart.

For Bank of Transfer payment (in admin/structure/messages) I have created cloned message of "Commerce Order: order confirmation" message - commerce_order_order_confirmation_bank_transfer)

Next I start to define new rule for Bank Transfer by cloning default rule for sending "Commerce order message: order notification e-mail - rules_commerce_order_message_order_notification" to rules_commerce_order_message_order_notification_e_mail_bank_tran.

In cloned rule I have changed only element "Create enitity" from commerce_order_confirmation message type to commerce_order_order_confirmation_bank_transfer message type.

But It makes error in "Set data value" element: "Data selector entity-created:message-commerce-order for parameter data is invalid." What is wrong? Thank you.

Here is cloned rule which make an error -

rules_commerce_order_message_order_notification_bank_tran:

    { "rules_commerce_order_message_order_notification_e_mail_bank_tran" : {
    "LABEL" : "Commerce order message: order notification e-mail (Bank Transfer)",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "4",
    "REQUIRES" : [ "rules", "message_notify", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "message",
            "param_type" : "commerce_order_order_confirmation_bank_transfer",
            "param_user" : [ "commerce-order:owner" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:message-commerce-order" ],
          "value" : [ "commerce-order" ]
        }
      },
      { "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } },
      { "message_notify_process" : {
          "message" : [ "entity-created" ],
          "save_on_fail" : 0,
          "save_on_success" : 0
        }
      }
    ]
  }
}

Here is rule used for cloning - rules_commerce_order_message_order_notification:

    { "rules_commerce_order_message_order_notification_e_mail_bank_tran" : {
    "LABEL" : "Commerce order message: order notification e-mail (Bank Transfer)",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "4",
    "REQUIRES" : [ "rules", "message_notify", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "message",
            "param_type" : "commerce_order_order_confirmation_bank_transfer",
            "param_user" : [ "commerce-order:owner" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:message-commerce-order" ],
          "value" : [ "commerce-order" ]
        }
      },
      { "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } },
      { "message_notify_process" : {
          "message" : [ "entity-created" ],
          "save_on_fail" : 0,
          "save_on_success" : 0
        }
      }
    ]
  }
}

closed as too localized by Chapabu, Letharion, AjitS, Patrick Kenny, niksmac Feb 27 '13 at 7:17

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.