Page 1 of 1

read_configuration.php without core change / defined variable change for debugging Hook / Overwrite

Posted: Tue Nov 11, 2025 6:21 am
by loop
Hi All

I need a elegant solution without touching core code. i made a new configuration key for switching themes in my shop:HOMEPAGE_THEME_VARIANTS

I can choose from ['default','singles-day','cyber-monday','black-november','black-week','black-friday','xmas']

Everthing works good, and in includes/system/segments/application/read_configuration.php
it saves as HOMEPAGE_THEME_VARIANTS

The problem is i would like to change for "debugging" reason on the fly only for ME to a other theme, but as the HOMEPAGE_THEME_VARIANTS is already definied i cannot overwrite it...
of course i could do in the while a "if(!empty($get['theme']) " only thenn saves the configuration but it would be a hack...

is there a better solution to do this without changing includes/system/segments/application/read_configuration.php with a hook or worst case overwriting includes/system/segments/application/read_configuration.php with "ugly hack"?

Code: Select all

// set the application parameters
  $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from configuration');
  while ($configuration = tep_db_fetch_array($configuration_query)) {
    define($configuration['cfgKey'], $configuration['cfgValue']);
  }

  //Test theme
$allowed_test_variants = ['default','singles-day','cyber-monday','black-november','black-week','black-friday','xmas'];
  if (!empty($_GET['theme']) && in_array($_GET['theme'], $allowed_test_variants, true)) {
    define('HOMEPAGE_THEME_VARIANTS', $_GET['theme']);
  }
Of course i could also do everywhere where i check HOMEPAGE_THEME_VARIANTS also for the $_GET variable but i don't want to do that if possible

Thanks

Re: read_configuration.php without core change / defined variable change for debugging Hook / Overwrite

Posted: Tue Nov 11, 2025 11:15 am
by burt
If it's just for you, do it with a Hack. would suggest to put some sort of Key on it as well, where only you know the Key.

Re: read_configuration.php without core change / defined variable change for debugging Hook / Overwrite

Posted: Tue Nov 11, 2025 4:09 pm
by ecartz
Copy read_configuration.php to a different name (same folder) and make your edits.
Edit the database hook that reads it https://github.com/CE-PhoenixCart/Phoen ... .sql#L1225
from 'hooks_method' 'read_configuration' to the new name (without .php which will be added automatically).

When you finish your debugging, edit the database hook hooks_method back to 'read_configuration' (the current name).

Re: read_configuration.php without core change / defined variable change for debugging Hook / Overwrite

Posted: Thu Nov 13, 2025 8:59 pm
by azpro
Maybe you could use this Addon:
app.php/addons/free_addon/template_manager/

And adept with some life/test switch. I have it on my TODO list - so if you can report back? :D