JoelWebsites Posted June 24, 2014 Share Posted June 24, 2014 I need to save the id of the employee (id_employee) of the person who is logged in from the cookie...I am a new prestashop developer please help. Link to comment Share on other sites More sharing options...
JoelWebsites Posted June 24, 2014 Author Share Posted June 24, 2014 I have used the below code in cookie.php and it returns a blank page please help!!!!!!!!!!!!!! <?php error_reporting(-1); include_once(dirname(__FILE__).'/config/config.inc.php'); include_once(dirname(__FILE__).'/config/settings.inc.php'); include_once(dirname(__FILE__).'/classes/Cookie.php'); $cookie = new Cookie('psAdmin'); // Use "psAdmin" to read an employee's cookie. $id123="hello world"; $this->context->cookie; $id=$this->context->cookie->email; echo $id; ?> Link to comment Share on other sites More sharing options...
JoelWebsites Posted June 24, 2014 Author Share Posted June 24, 2014 <?php error_reporting(-1); global $cookie; include_once(dirname(__FILE__).'/config/config.inc.php'); include_once(dirname(__FILE__).'/config/settings.inc.php'); include_once(dirname(__FILE__).'/classes/Cookie.php'); $cookie = new Cookie('psAdmin'); // Use "psAdmin" to read an employee's cookie. class Cookie { function Displayemployeeid(){ $id123="hello world"; global $id; $id = $this->context->cookie->id_employee; echo $id; echo $id123; } } ?> <html> <body> <table width="200" border="1"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><?php echo $id;hello ?></td> </tr> </table> </body> </html> Link to comment Share on other sites More sharing options...
Xavier du Tertre Posted June 24, 2014 Share Posted June 24, 2014 This is not the right forum for this topic, I'm moving it. Remember: the PrestaShop forum is one of the biggest there is and a wise choice for a new thread means more replies, better replies, neater forums and a more efficient Community! Link to comment Share on other sites More sharing options...
JoelWebsites Posted June 24, 2014 Author Share Posted June 24, 2014 I am getting an error that shows variable not defined for the line echo $id; Link to comment Share on other sites More sharing options...
vekia Posted June 25, 2014 Share Posted June 25, 2014 hello don't use cookie file, just use auth contoller related to back office. then you will be able to use employee id variable. what you want to do with this variable? store somewhere? Link to comment Share on other sites More sharing options...
JoelWebsites Posted June 25, 2014 Author Share Posted June 25, 2014 (edited) I am a very new prestashop developer and have basic php knowledge...so I dont know how to use auth controller...I wanted data about the employee. As of now I am getting the below error PHP Fatal error: Using $this when not in object context in /home/freeon/public_html/cookie.php on line 53 and below is line no 53 vvvvvvvvvvvvv $id_employee = $this->context->employee->id; Edited June 25, 2014 by joeljfernandes (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now