4

I'm new to drupal

What I want to do:

After a user places an order I want to send an email to the site owner with information of the order. These 2 tokens (that are standard) are working:

[current-user:name]
[message:message-commerce-order:order-number]

I navigate to structure > messages > (here I made a new message) commerce order: order confirmation to admin > edit

path = admin/structure/messages/manage/commerce_order_order_confirmation_to_admin

@ the end of this page I can select tokens

My problem:

When I select a token at the bottom of the edit page and I paste it in my email body, and I actually receive the email, the variable of the token isn't shown. It only gives me the token itself.

For example the token for price doesn't work

[message:message-commerce-line-item:commerce-product:commerce_price]

What am I doing wrong, am I missing some steps?

Do I need to add a rule to the fields of the checkout order steps? But when I choose for shipment it's with radio buttons, so not exactly a field.

4 Answers 4

0

I encountered similar issues in the Rules email body. Standard input filters were being applied to the field. You may need to install the Token Filter module and configure input formats accordingly.

1
  • For those input formats configuration, do I need to navigate to /commerce/config/checkout/form or /structure/messages/manage/manage/commerce_order_order_confirmation_to_admin/fields ? Or yet another path?
    – Gilko
    Commented Dec 1, 2014 at 12:39
0

You can create you own custom tokens with hook_token_info(). See more info at https://www.drupal.org/node/1308488. That might be a workaround for you.

0

This is an answer on my case:

The problem was that the selected data was wrong. It was commerce-order and it had to be entity-created:message-commerce-order.

Go to: configuration > Workflow (Rules) > {select your rule} in my case it's Commerce order message: order notification mail to admin > set a data value

In set a data value change the selected data to entity-created:message-commerce-order

0
+100

I have the following suggestions for you.

  1. Check if your price field is a multi-valued field. If yes, then the token will mostly be of the form [message:message-commerce-line-item:commerce-product:commerce_price:0] (for first item),[message:message-commerce-line-item:commerce-product:commerce_price:1] (for second value) and so on.
  2. Replace [message:message-commerce-line-item:commerce-product:commerce_price] with [message:message-commerce-line-item:commerce-product:commerce-price] (Yes,even a hyphen can make a difference!)
  3. Click on 'Switch to Data selection' button below your email body, a dropdown will appear. Go on filtering your field till you find the commerce_price field. Then, copy it, click on 'Switch to direct input mode' and paste it in your email body.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.