Session in modules


I am writing a module where I would need some things to save in the session.
I am using normal PHP session variable ($_SESSION[“mymodule.something”]). The thing saves in the session temporary. When I refresh the page, data that I saved with this variable is gone. (null)
Is OXID preventing to save your own data to own session variable?

$_SESSION["module.sessionData"] = $data;

When I refresh the page, the output of first var_dump is always null.

I am working in constructor. And parent class doesn’t have it.

Now i also tried with OXID’s oxSession class and it stil don’t work.

$sess = oxSession::getVariable("asd");
oxSession::setVariable("asd", "qwe");
$sess = oxSession::getVariable("asd");

Thank you!

Probably there is no session started yet. You can use blForceSessionStart in to force a session.

Can I start that from module perhaps?
Because I don’t want to touch root config file.
Otherwise it works after that. :slight_smile: But I want to turn that on in module if it’s possible.

I think you could override oxsession::_forceSessionStart and replace “$this->getConfig()->getConfigParam(‘blForceSessionStart’)” with “true”.

Yes it’s working.
Thank you very much!