Hi,
i am running a kickstart 2.12 and have some trouble with !order-summary.
The original message is working for me, even after altering the message.
But if I clone the message type and change the related rule to use the new message type the !order-summary field fails. All other tokens are working. In all languages and with different rules too.
There are only manual payment methods (cash on delivery, pay in person, bank transfer).
Comments
Comment #1
balintbrews!order-summaryis not a token, it's injected as an argument of the Message entity. Commerce Message implementshook_message_presave()to do that.As you can see it checks the message type, which is different for you, since you cloned the original one. So all you have to do is to implement the same hook and do the same job, but check against your own message type.
Comment #3
khumbu commentedThis is what I did, to use !order-summary in my cloned Message
In commerc_message.module you can find following code, the bold italic is my change to use !order-summary in another message
function commerce_message_message_presave($message) {
if (!empty($message->mid) || ($message->type != 'commerce_order_order_confirmation' && $message->type != 'commerce_order_order_confirmation_cloned_' )) {
return;
}
$message->arguments['!order-summary'] = array(
'callback' => 'commerce_message_order_summary',
'pass message' => TRUE,
);
}
Comment #4
peter caritas commentedJust to clarify, you wouldn't want to edit the commerce_message.module file because upgrades to that module would write over your changes. The way to accomplish this is through implementing hook_message_presave() in a custom module:
Comment #5
millionleaves commented#4 solved this problem I was having with a cloned order email - thanks. Nice easy solution.
Comment #6
millionleaves commentedOn further reflection, this could easily be modified to create additional "variables" for insertion into your message types.
In my case, I needed to include some custom fields in the admin order notification. I made a second version of the Cart Summary view and used the module below to create !order_summary_admin. This module code limits the use of !order_admin_summary to just the Admin notification message type. But you could also create a more generic version of the code below that allowed you to use the output of any view in any message type.