Jump to content

Variables needed for tracking codes on order-confirmation.tpl page


Recommended Posts

Hello,

 

Can someone please help with what the global variables are for the following so that I can insert it into a few different tracking codes I use?

 

Customer First Name

Customer Last Name

Customer Email

Order ID

Order Amount

 

And if the code is using <script> tags to I have to put the script in between {literal} tags? If I have 3 different sets of conversion code, can I put the {literal} tag before the first one and then the closed {/literal} tag after the last closing script tag?

 

Thanks!!

 

Alex

 

Link to comment
Share on other sites

  • 5 months later...

You can use $cookie->customer_firstname for the first name, $cookie->customer_lastname for the last name and $cookie->email for the email address in any TPL file. The cookie doesn't contain the order ID and amount though. If you're placing the script code in order-confirmation.tpl, you can use the variable {$id_order} to get the order ID.

 

Getting the order amount is harder, since there's no Smarty variable with that value. You'd have to override the OrderConfirmationController::initContent() function and add code like the following:

$order = new Order((int)$this->id_order);
$this->context->smarty->assign('order_total', $order->getTotalProductsWithTaxes());

Then you can use {$order_total} in order-confirmation.tpl.

  • Like 1
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...