Jump to content

How to store variables (several forms in same page)


Recommended Posts

Hi all, i'm new and i'm developing a plugin for prestashop,

and i have some problems on understanding the prestashop workflow.

I have added several forms in the plugin and all are intercepted by postProcess method, and this is ok.

What i'm trying to do is to save the values "somewhere" so even after different calls of different forms, the values of olds submitted forms are still retrievable.

I'm currently trying to use  $this->context->employee to save values but without any luck.


I'll give you an example just to make sure what i would like to achieve:

I have 2 forms

Select Day form with input field day            

Select month form with input field month     

Select day       |_______| |_SUBMIT_|

Select month   |_______| |_SUBMIT_|


I insert day and submit it, 

catch the value in the postProcess and save it somewhere,

(now i do

$this->context->employee->selected_day = Tools::getValue('dayinputfield');



Now i insert the month and i press submit but the value 

$this->context->employee->selected_day is now longer avaible...is null

What i'm missing?

What is the best practice in cases like this?

Thanks for the answers!


Link to comment
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
  • Create New...