Jump to content

What are the variables available in templates?


Recommended Posts

I'm trying to use some variables on the order confirmation page to pre-fill customer info into some forms with a javascript snippet for a third party provider (Shopper Approved).

 


<div id="outer_shopper_approved"></div> 
<script type="text/javascript"> 
var sa_values = { "site":xxxxx, "token":"xxxxxxxxxx", 'orderid':$order->id, 'name':$customerName, 'email':$email, 'country':'United States', 'state':'CA' }; 
{literal}
function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } 
var d = new Date(); if (d.getTime() - 172800000 > 1477399567000) saLoadScript("//www.shopperapproved.com/thankyou/inline/xxxxx.js"); 
else saLoadScript("//direct.shopperapproved.com/thankyou/inline/xxxxx.js?d=" + d.getTime()); 
{/literal}
</script>
 

Do I have these variables right so far?

$order->id

$customerName

$email

 

What about country and state? I'm just doing random searches to try to find references to these variables online. Is there a list of variables I can use?

 

Also, is there a way for me to preview order-confirmation.tpl and do development on it without going through the process of placing an order to view it each time?

 

Lastly, am I using hte literal tags right? I'm confused as to when they are necessary. I'm told they can be put after assigning variables like this? Are there javascript statements that won't evaluate unless i use it?

 

Edit: The only thing that's showing on the order confirmation page when I view the source is this. The entire script is missing.

<div id="outer_shopper_approved"></div> 
Edited by TurkeyFish (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...