Jump to content

Recommended Posts

I'm trying to find the osCommerce equivalent of the following:

session_start();

$_SESSION["custom_session"];

$_SESSION["custom_session"][$keys]["products_id"] - as you can see, I'm working with a session array.

Would anyone have insight on how to create custom sessions while using the osCommerce API?

I've checked the application_top.php and sessions.php, which gave me some ideas but I wasn't exactly certain.

Thank you in advance for any details here and I should add, if necessary, I'm totally comfortable with editing any core files...I know, I'm a rebel...

 

Share this post


Link to post
Share on other sites

In osCommerce, the session_start() is always done for you in includes/application_top.php.  You should not trigger it yourself.  It is done as early as possible. 

To do what you want, try

if (!tep_session_is_registered('custom_session')) {
  $GLOBALS['custom_session'] = [];
  tep_session_register('custom_session');
}

Then just use $GLOBALS['custom_session'] as you would normally.  If in global context (outside a class or function), you can access it as $custom_session.  You'd have to do this after tep_session_start is called.  And you probably should wait until after the extract($_SESSION , EXTR_OVERWRITE+EXTR_REFS );


Always back up before making changes.

Share this post


Link to post
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

×