HI,

I have noticed that there is no email notification for store admin.

Is this been excluded for a reason?

Cheers

CommentFileSizeAuthor
#1 addnewruleforadmin-1896386.patch1.36 KBc_archer

Comments

c_archer’s picture

StatusFileSize
new1.36 KB

This is what I have done for our clients.

jbekker’s picture

I did something similar but still used Message Notify to send a copy, this is what I did:

  1. Create a list of users to send a notification(By ID)
  2. Loop trough the list and create a message entity
  3. Send a message copy of the order to every user in the list

I hope this makes sense! The downside of this approach is that you can only send a email to someone who also has a Drupal Account.

{ "rules_commerce_order_message_order_notification_e_mail_admin" : {
    "LABEL" : "Commerce order message: order notification e-mail admin",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "3",
    "REQUIRES" : [ "rules", "message_notify", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "DO" : [
      { "variable_add" : {
          "USING" : { "type" : "list\u003Cuser\u003E", "value" : { "value" : [ "1" ] } },
          "PROVIDE" : { "variable_added" : { "variable_admin_users" : "Users to receive admin email" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "variable-admin-users" ] },
          "ITEM" : { "admin_user" : "Current admin user" },
          "DO" : [
            { "entity_create" : {
                "USING" : {
                  "type" : "message",
                  "param_type" : "commerce_order_order_confirmation",
                  "param_user" : [ "admin-user" ]
                },
                "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
              }
            }
          ]
        }
      }
    ]
  }
}
summit’s picture

Hi,
I would very much like not only to have a specific email notification for Admin, but also a specific email message with more information for admin.
Would that also be possible?

Thanks for #1, working like a charm!

Greetings, Martijn

c_archer’s picture

Hi Martijn,

Glad the patch worked okay for you, what extra information would you like adding to the email?

Cheers,
Chris

summit’s picture

Hi Chris,

I would like to build an email like this: https://drupal.org/node/1532520?size=preview
This is done by this sandbox module now, but this is not integrated yet in commerce message some how:
https://drupal.org/sandbox/andyg5000/1532508
And than with Billing and Shipping Adresses included.

greetings, Martijn

kevster’s picture

This is very useful, many thanks!

How can the admin message be imported in to admin/structure/messages so it can be edited easily - I can see the customer email is in there already.

I have managed to add order billing and shipping tokens

Very useful addition.

summit’s picture

Hi,

I cloned the message and cloned the rule and set it to admin, and admin-email.
Greetings, Martijn

kevster’s picture

I thought I had the address working but seems not so. I have tried the following in the customer email message (all other tokens working):

[message:message-commerce-order:commerce-customer-billing] = 10 (id?)

[message:message-commerce-order:commerce-customer-billing:commerce_customer_address] = [message:message-commerce-order:commerce-customer-billing:commerce_customer_address]

[message:message-commerce-order:commerce-customer-billing:commerce-customer-address] =
Property commerce_customer_address

Im close but somethings not right!

Modules:
commerce 7.x-1.7
commerce message 7.x-1.0-rc1 + the admin email patch above
message 7.x-1.9
message notify 7.x-2.5

thx for any help...

mglaman’s picture

There's some kind of issue with Message. The field message_commerce_order doesn't get imported when you copy the confirmation message. You'll have to attach your own entity reference field for order's and alter the tokens

Example: add field_message_order_ref and replace tokens to field-message-order-ref (something of that sort.)

brightbold’s picture

The bug mglaman refers to in #9 is discussed in #1905904: Cloning order notification email results in error and resolved with a patch in #1983138: Cloning a message type doesn't clone the field instances that is included in Messages 7.x-1.9. When I upgraded Messages to 7.x-1.9, cleared the cache, deleted my old cloned message, re-cloned the order notification message and edited accordingly, and updated and re-saved my rule, the error disappeared. Now I have a working admin email notification!

thirdender’s picture

Issue summary: View changes
Related issues: +#2572767: Add admin order notifications

This functionality is available in the 7.x-1.x-dev version of the module. It was added in commit 19d2613 in response to Issue 2572767: Add admin order notifications. A separate Message Type for admins and Rule to send the message is now available.

I think we can close this issue.