Search code examples
prestashopprestashop-1.6

Where should development variables go in Prestashop?


I'm trying to add custom variables to use in Prestashop. In other packages I would throw them in the config file as constants but with Prestashop it looks like it can recreate the settings.inc.php file when upgrading. I don't want to run the risk of losing the vars.

Is there a different spot that I can put them in that wouldn't get tracked in Git?


Solution

  • You can use Configuration::updateValue('YOUR_CUSTOM_NAME', 'your_value') to save and update your custom value and Configuration::get('YOUR_CUSTOM_NAME') to retrieve it.

    These values are stored in the ps_configuration table of the PrestaShop database and they will not be overwritten by updates.