I would like to create some custom session variables in OpenCart 2.3.x.
Specifically, when user creates a new product I would like to create one session variable. So far in order to do this, I have create inside session.php
file (system/library/session.php
) a public function and inside I have this:
public function
sessionCustomNames($session_custom_name, $value) {
$this->session_id->$session_custom_name = $value;
$this->data = $this->session_id->$session_custom_name;
return $this->data;
}
Now, inside any controller file, I would like to call this function and set a key-value pair. for example:
sessionCustomNames('prosuct_id', 30)
Obviously, I did something wrong and the above does not work. but the logic is this I have described. could you tell me what could I do in order to accomplished that?