By doubleC on
I am trying to to send an email to certain users when the checkout process is in ubercart complete. To do this I am using the "conditional actions" module. Depending on a field on the checkout page, the email will be sent or not.
The field has a token value, but I cannot seem to find it in the "$order" variable. I will obviously use the "conditions" settings in the "conditional actions" module. Here I will use PHP code to verify if the variable on the checkout page matches certain crieteria.
My question is the following:
How do I access the field (token value) in PHP code?
Thanks in advance.
Comments
Check the api.txt file
The token module documents it's api in a file called api.txt. That file is bundled with the rest of the token module source.
Case sensitive search?
Strictly, it's API.txt.
Thanks for the assistance,
Thanks for the assistance, but that file doesn't really help with what I am looking for.
In the token variables under the "Order" section, there is my token variable that I am looking for. The only problem is that I can only access this variable by saying [variable-name]. I want to be able to perform testing on that variable in PHP.
if(isset([variable-name])){
//perform some action
}
I want to know how to get the [variable-name] in a PHP $variable so I can test it.
I hope this explains thing better.
I have solved the task I was
I have solved the task I was going for, I think it is what you were after as well...in this example I am looking for token [field_bibliography_author-formatted].
See token_get_values
Although I have just taken another look at the output for my scenario and it is outputting a value of '1' for an empty field so you would have to evaluate the value of the token using this method rather than isset(). isset() would be more desirable but this is what I have come up with, no idea if it is the best way...maybe someone else will have something more elegant.
Thanks for the help. This
Thanks for the help.
This solution is actually quite awesome.
The only problem that I encounter is that it does not work with a processed order. To get around this, I am thinking of loading the particular order that has been processed instead of the noad, then it might be able to recognise the tokens associated with that order.
Will see how this pans out and will reply with the results.
Getting specific token values
There's a much easier way if you're just trying to pull a very specific token value, rather than get them all...
Of course, replace token name and node variable with your own.
Also, just found
Also, just found this..
http://developmentseed.org/blog/2009/mar/25/tokenlogic-helps-messaging-a...
I am also interested in this,
I am also interested in this, I want to perform a conditional check on a token value...