avi_24 Posted November 1, 2013 Share Posted November 1, 2013 Hai friends how to create a global variable in prestashop which we can use across all admin/front controllers............actually i want to store a value to a variable from a particular controller and use it from other controllers..... can anyone suggest a solution...(i dont want to use configuration variable...as i want to use this particular variable as session based) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted November 1, 2013 Share Posted November 1, 2013 You can use Context Object Link to comment Share on other sites More sharing options...
avi_24 Posted November 2, 2013 Author Share Posted November 2, 2013 actually i want to have the value of $this->context->employee->id from AdminLoginController to be available at AdminProductsController ...How can we utilize context object for that purpose Link to comment Share on other sites More sharing options...
PascalVG Posted November 2, 2013 Share Posted November 2, 2013 Avi, as you can see inAdminProductsController, they already use exactly that pice of code to get the ID, for example here: in function: public function processUpdate() they have this line of code: $preview_url .= 'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id; So, if I understand your question correctly, you can just directly use it here, as given. Please elaborate if I misunderstood. pascal Link to comment Share on other sites More sharing options...
avi_24 Posted November 2, 2013 Author Share Posted November 2, 2013 (edited) Yes PascalVG .....it is working .........thanks a lot.....you saved my day!!!!!!!!!!! Edited November 2, 2013 by avi_24 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 2, 2013 Share Posted November 2, 2013 btw. in 1.5 im always using context object as it is suggested in documentation. always works as i expect topic marked as [solved] 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