Jump to content

ADD Custom Session ID in cookie


Joey

Recommended Posts

Hi,

I want to get two unique session id which is using to identify the customer from Clickwise - Affiliate Marketing

When the visitor reach our landing page, the identifier is included.

e.g.

https://www.domain.com/?refid=4f99af95c9aaa&clickid=tPogaaa

‘refid’ is the click identifier. The value represents which affiliate it is from.

$_SESSION[‘affid'] = '4f99af95c9aaa’;

$_SESSION[‘clickid’] = 'tPogaaa';

So I need store two session id when they visit our page. 

How can I add this two session ID and store it in prestashop 1.7

I will pass this two session id in order confirmation page, it mean this two ID must still value when customer confirm the order.

eg: http://track.clickwise.net/pb?AccountId=00e01aaa&CampaignID=58460177&ActionCode=sale&OrderID= 0000001&TotalCost=100&Currency=HKD&RefId=4f99af95c9aaa&ExtraData=tPogaaa

Link to comment
Share on other sites

Hi! I can store the cookie using following command successfully

$cookie=&$this->context->cookie;
$cookie->__set(íd', 'AAA');
echo $cookie->__get('íd');

 

However, I want set this cookie value expiry time to browser close, not want to change the cookie global time in admin -> preference -> default is 240 hours

I tried $cookie->setExpire(0); but it will show below error, seem setExpire cannot overload the global cookie. So what command can only set this value to expired when browser closed?

  1. in Cookie.php line 142
  2. at ErrorHandler->handleError('8', 'Indirect modification of overloaded property Cookie::$_context has no effect', '/home/cyeshop/classes/Cookie.php', '142', array('expire' => '0')) in Cookie.php line 142
  3. at CookieCore->setExpire('0') in IndexController.php line 44
  4. at IndexControllerCore->initContent() in Controller.php line 205
  5. at ControllerCore->run() in Dispatcher.php line 428
  6. at DispatcherCore->dispatch() in index.php line 28

$cookie->__set(íd', 'AAA');

However, I want set this cookie value expiry time to browser close, not want to change the cookie global time in admin -> preference -> default is 240 hours

I tried $cookie->setExpire(0); but it will show below error, seem setExpire cannot overload the global cookie. So what command can only set this value to expired when browser closed?

  1. in Cookie.php line 142
  2. at ErrorHandler->handleError('8', 'Indirect modification of overloaded property Cookie::$_context has no effect', '/home/cyeshop/classes/Cookie.php', '142', array('expire' => '0')) in Cookie.php line 142
  3. at CookieCore->setExpire('0') in IndexController.php line 44
  4. at IndexControllerCore->initContent() in Controller.php line 205
  5. at ControllerCore->run() in Dispatcher.php line 428
  6. at DispatcherCore->dispatch() in index.php line 28

 

Edited by Joey (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...