Jump to content

collecting cookie in order-confirmation.tpl


Joey

Recommended Posts

Hi

I have success store a value to cookie using below command in IndexController.php

$cookie=&$this->context->cookie;

$cookie->__set('id', ''001', 0);

I can see the cookie value 001 in my website using echo $cookie->__get('íd');

Now I want get this cookie id value "001" in order-confirmation.tpl to send the URL to other marketing company website when each times customer confirmed the order.

I added below code in order-confirmation.tpl

 <iframe src="http://www.clickwise.net/pb?AcountID=A901&OrderID={$order.details.reference}&ID={$_cookie[id]}" width="1" height="1" /></iframe>

 

I tried using below parameter but also cannot get the cookie value, all will said something error such as Notice: Undefined index: cookie

{$_cookie['id']}

{$_cookie[id]}

{$cookie->id}

{$context->cookie->id}

Could anyone can tell me what parameter I should used to get the cookie value in order-confirmation.tpl. Thanks!

Regards

 

 

 

external script which looks at a URL if it contains a special parameter (for example www.somesite.com/product1?ref=prisjakt) in which ?ref=prisjakt is the parameter. If the URL contains this ref, this script sets a cookie. Then in the order confirmation page I need to get this cookie. 

Edited by Joey (see edit history)
Link to comment
Share on other sites

I used p($cookie); can see the cookie was successfully stored, however, I still cannot access it on other page, it seem this cookies only can access on landing page now, 

How can I store this cookie to permanent or allow access by order-confirmation.tpl?

 

Cookie Object

( [_content:protected] => Array

(

[date_add] => 2019-06-10 09:04:26

[id_lang] => 2

[id_currency] => 1

[id_guest] => 841116

[id_connections] => 796727

[id] => AAA

)

Link to comment
Share on other sites

Searched on other post said can use below command, but I added below command still cannot access this cookie on other page.

$this->context->smarty->assign(íd', $this->context->cookie->id);

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...