Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How do I reference an Order Total on order_message.tpl?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-12-2005, 10:43 AM
 
Jeremy.Freeman Jeremy.Freeman is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 79
 

Default How do I reference an Order Total on order_message.tpl?

Im installing some tracking code that will be executed on order_message.tpl (once the order is confirmed.) I need to reference three types of information on this page for the tracking code.. one most importantly..

I need to reference:
- Order Total (Grand Total after shipping+taxes+etc) (most important one)
- Order Qty (Total # of items purchased)
- Order ID (ID of that specific Order)

I have no idea the names of these variables.. I will have no problems referencing them, I just need to know what the names are of the variables that hold these values. I remember awhile back someone had posted a snippet of code to display all current variables and their values on a page.. but I dont remember that, so if you could provide the variable names (that I can reference from skin1/customer/main/order_message.tpl) or the code to display all the variables, and I can figure that out myself.

Thanks!
__________________
Jeremy Freeman
EZWatch Store
X-Cart v4.1.5
Reply With Quote
  #2  
Old 12-12-2005, 10:49 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

func_print_r($GLOBALS);
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 12-12-2005, 11:10 AM
 
Jeremy.Freeman Jeremy.Freeman is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 79
 

Default

Wonderful, thank you.

I was able to find that I could print the variables I needed most with:

Order Total: {php}echo $this->_tpl_vars['orders']['0']['order']['total'];{/php}

and

Order ID: {php}echo $this->HTTP_GET_VARS['orderids'];{/php}

However, I need to set a Javascript variable to the values of those two..

How can I reference those varaibles, when the Javascript is wrapped in {literal}.. considering you cant put {php} inside of {literal}..

I know I could use PHP to include a .js file with this information, and then use a str_replace (a PHP function) to replace the parts of the file where I need to input those values.. but Im hoping theres a more proper way of doing this (referencing a PHP value inside of {literal}.. maybe set a smarty variable from the PHP variable values, and then reference the smarty variable inside of {literal}? Not sure how I would do this either.. and it only only work if {php} was parsed before completely before Smarty because I would still have to wrap the echo'd text in {literal}..)
__________________
Jeremy Freeman
EZWatch Store
X-Cart v4.1.5
Reply With Quote
  #4  
Old 12-12-2005, 12:48 PM
 
Jeremy.Freeman Jeremy.Freeman is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 79
 

Default

I was able to achieve the desires results by not using {literal} around the Javascript code, and replacing the { in the javascript code with {ldelim} and the } in the javascript code with {rdelim}, allowing me to reference {php} and the smarty variables unliterally.
__________________
Jeremy Freeman
EZWatch Store
X-Cart v4.1.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:25 AM.

   

 
X-Cart forums © 2001-2020