Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Where To setCookie


loginid

Recommended Posts

Posted

Hi All,

 

Hope everyone is well today.

 

Just need a little advice about where to use setCookie

 

Right now I'm trying to set a cookie on a condition in application_top.php

What I'm doing is;

 

If http_get_vars = blah

then setCookie

 

But because of the limitations of cookies being part of the HTTP header and needing to be set before any output is sent to the browser.

I'm finding that the cookie is not getting set because it's encased within the application_top.php code.

 

So I'm wondering - does anyone out there know where in the osCommerce code I can setCookie?

 

 

Thanks in advance!

Posted

if (SESSION_FORCE_COOKIE_USE == 'True') {

tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

 

 

in application top will give you some idea on how to set.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

Hello Satish,

 

Thanks for getting back to me.

 

The problem is around where to setCookie rather than how to set cookie.

 

If I set it in application_top.php then it will not set the cookie as soon as user lands on the page, the user has to navigate to another page first.

But the problem is that I need it to setCookie as soon as the user navigates to any page, just in case they navigate to the page and then leave, I still want to set that cookie.

 

Any ideas? :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...