Jump to content

Configuration.php


Recommended Posts

so, you're asking about Configuration class (classes/Configuration.php)

this file contains function to deal with ps configuration.

 

you asked about configuration::updateValue function.

so, this function changes database entries in table: ps_configuration

 

for example configuration::updateValue('somesetting','value'); will change 'somesetting' field to 'value' (in ps_configuration table)

 

 

check this (it's a part of official docs)

 

 

he Configuration object

As you can see, our three blocks of code make use of a new object, Configuration. This is a PrestaShop-specific object, built to help developers put their module settings into PrestaShop database without having to resort on managing their own data tables. Specifically, it handles data from the ps_configurationdatabase table.

So far, we're using three methods, to which we'll add another one:

  • Configuration::get('myVariable'): retrieves a specific value from the database.
  • Configuration::getMultiple(array('myFirstVariable', 'mySecondVariable', 'myThirdVariable')): retrieves several values from the database, and returns a PHP array.
  • Configuration::updateValue('myVariable', $value): updates an existing database variable with a new value. If the variable does not yet exist, it creates it with that value.
  • Configuration::deleteByName('myVariable'): deletes the database variable.

There are many more, such as getInt() or hasContext(), but these four are the ones you will most use. 
As you can see, this in a very useful and easy to use object, and you will certainly use in many situations. Most modules use it too for their own settings.

 

more info here: http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module#CreatingaPrestaShopmodule-TheConfigurationobject

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...