Dave! Posted February 18, 2018 Share Posted February 18, 2018 (edited) Hello I'm writing a custom module and in my module, not logged custommer can enter some data After that I want to save this data to show personalized info during navigation How and where I can store this data? (For logged users I'm storing in DB) Prestashop version 1.7.2 Edited February 18, 2018 by Dave! (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 19, 2018 Share Posted February 19, 2018 To save info in the database you have to first create a table. I assume you did (if not, you can use normal sql commands in the install function). To run a query, you can use Db::getInstance()->execute('your query...'); Same for insertion Link to comment Share on other sites More sharing options...
Dave! Posted February 20, 2018 Author Share Posted February 20, 2018 (edited) I dont want to save in DB for not logged user I was thinking more in cookie or some context variable but I couln't find any info in documentation Edited February 20, 2018 by Dave! (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 25, 2018 Share Posted February 25, 2018 Ah, for that you can use $this->context->cookie->__set('keyname', $value); And the __get counterpart to retrieve it. Please notice $value must be a string, serialize and encode it if it's an array 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