Creating a message token

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I'm creating a payment plugin that needs to send info on the order e-mail to the client. I got the info on the order notes, but I need a message token to add order notes to the e-mail.

Is there any plugin for this?

If I create a provider how can I tell nop commerce I have a new token provider?!

thanks in advance for your help!
11 years ago
DMoura wrote:
I'm creating a payment plugin that needs to send info on the order e-mail to the client. I got the info on the order notes, but I need a message token to add order notes to the e-mail.

Is there any plugin for this?

If I create a provider how can I tell nop commerce I have a new token provider?!

thanks in advance for your help!


You can always add your own tokens. :D
11 years ago
How do I do that?!

I've tried to create a token provider, but I can't.

Is there any tutorial or exemple?!
11 years ago
DMoura wrote:
How do I do that?!

I've tried to create a token provider, but I can't.

Is there any tutorial or exemple?!


You don't need a custom token provider. Look at how WorkflowMessageService does it and you'll have a clue. :D
11 years ago
thank you!

I'll take a look at it!
11 years ago
DMoura wrote:
thank you!

I'll take a look at it!


No problem. :D
11 years ago
I've read the class top to bottom several times, and I'm still clueless about how to do it!

I still can't figure:
1- is the token added on install?
2- how do I add it?!

I'm really need this done and I'm completly confused....
11 years ago
DMoura wrote:
I've read the class top to bottom several times, and I'm still clueless about how to do it!

I still can't figure:
1- is the token added on install?
2- how do I add it?!

I'm really need this done and I'm completly confused....


[Assuming source code of 2.65]

If you look at SendNotification of WorkflowMessageService, tokens is just an IEnumerable<Token>, which makes adding token a matter of populating a list. Then you'll need the Tokenizer to replace tokens with actual values. :D
11 years ago
I'm starting to think I'm dumber than I thought... or maybe I'm just not grasping the concept on wich nop commerce works..

Where do I add the token? on plugin install or constructor??

I've got the Tokenizer code, but where do I put it?!

I just don't get the concept of how nop commerce works and handles plugins.... and I just don't have the time to learn it.
11 years ago
Tokens aren't something added to the DB.  It's a collection of functions that get called every time a message is tokenized.  The function will determine what tokens to look for and what value should replace it.

When you say add a token, you're really just modifying a function to start looking for that token along with the other ones it already does.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.