Prestashop 1.6 custom module how to add custom input and table in Configuration at Back Office
-
21-12-2019 - |
Question
I am trying to create a custom footer module for my site, It is my first time to create a module in prestashop 1.6 and I read about this article
http://doc.prestashop.com/display/PS16/Adding+a+configuration+page
my problem is i cannot fully understand if I need to create a custom table for my module or not
Configuration::updateValue('FOOTERCUSTOM_NAME', $footercustom);
as you can see in this code, the Configuration table is already created and Configuration::updateValue
is a default prestashop code
if I wanted to create a input 1 , input 2 and input 3 at our configuration page in module backoffice and it automatically output the data in the database at my hookfooter
.
what is the proper way of doing this?
Note that I already succeeded in creating a basic module, my main problem in how to insert data on my database using the configuration in my module
Solution
You don't have to a create a custom table. With the Configuration::updateValue
method you can store/update values in the ps_configuration
table and you can retrieve these values with the Configuration::get
and Configuration::getMultiple
methods. Values can be removed with the Configuration::deleteByName
method.
Example:
Configuration::updateValue('FOOTERCUSTOM_INPUT_1', $input1Stored);
$input1Retrieved = Configuration::get('FOOTERCUSTOM_INPUT_1');
OTHER TIPS
You can refer to this guide as well, still valid