Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page
PrestaShop 1.7 keeps the 1.6 configuration class for backward compatibility.
If you don’t need compatibility with 1.6 shops, we suggest using the Configuration service instead.
Configuration::updateValue(string $key, mixed $value): bool
This method returns true
if the operation is successful, false
otherwise.
Parameters:
$key
ALL_CAPS_WITH_UNDERSCORES
.$value
Note: All values are stored as strings in database, so you might encounter type conversion issues if you save anything other than a string.
Use of arrays to store multi language values.
To store a value in multiple languages, You can provide an array indexed by language id:
[
123 => 'Value in some language',
456 => 'Value in some other language',
]
Note that this is the only supported use of arrays.
Configuration::hasKey(string $key): bool
This method returns true
if the data exists, false
otherwise.
Parameters:
$key
// static call
Configuration::get(string $key): mixed
This method returns the data for $key
if it data exists, or NULL
otherwise.
Parameters:
$key
Configuration::deleteByName(string $key)
This method returns true
if the key is removed, false
otherwise.
Parameters:
$key
By default, all these methods work within the confines of the current store context, whether PrestaShop is using the multistore feature or not.
However, it is possible to work outside of the current context and impact configurations for all shops, a shop group or a single, specific shop. This is done using three optional parameters, which are not presented in the list above:
id_lang
: enables you to force the language with which you want to work.id_shop_group
: enables you to indicate the shop group of the target store.id_shop
: enables you to indicate the id of the target store.