X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How do I reference an Order Total on order_message.tpl? (https://forum.x-cart.com/showthread.php?t=18617)

Jeremy.Freeman 12-12-2005 10:43 AM

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!

balinor 12-12-2005 10:49 AM

func_print_r($GLOBALS);

Jeremy.Freeman 12-12-2005 11:10 AM

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 12-12-2005 12:48 PM

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.


All times are GMT -8. The time now is 11:59 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.