Code for creating the message template

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Hello,

I am looking to find the message tokens in the message template what kind of expressions do they support and I cannot find the code that evaluates them and generates the email.

Can anyone assist?
4 years ago
can you provide nopCommerce version ?

and anyway for message tokens you can find it in "MessageTokenProvider"
And to use it in Email you can look for Service "WorkflowMessageService" - In this for ex look for "SendCustomerRegisteredNotificationMessage" method. In this they first select appropriate  message template, than add tokens to it, and sends a mail.

plz let me know if it helps you!
regards, Bhautik
4 years ago
pantonis wrote:

I am looking to find the message tokens in the message template what kind of expressions do they support and I cannot find the code that evaluates them and generates the email.

Agree with bhautik.

Also, there are rise events of all token groups replaced. So you can use the event in plugin and add your new token.
4 years ago
I managed to add a new token into the MessageTokenProvider but what I am looking now is how to use these tokens.
Apart from equal is there any way to use StartsWith or Contains for a string value token?
4 years ago
You add the Tokens in the message templates as you will have seen
RE Conditions: I just found this but I cant see anything in documentation
%if (%Order.PaymentMethod%=="PaypalString")
Insert text here
endif%

Have a play and see if it works. Other than that you can modify the src\Libraries\Nop.Services\Messages\MessageTokenProvider.cs to do what ever you want
4 years ago
Apart from equals I was wondering if Contains or StartsWith is supported.
4 years ago
This is the code see src\Libraries\Nop.Services\Messages\Tokenizer.cs
I dont really know how it works without running it up in the debugger
but I think it only has the equals as shown above
Maybe you can add the other conditions
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.