Overriding Zen Cart Database Settings


I've had occasion to troubleshoot an issue for a client where it's necessary to make a database configuration change.  Since I don't like receiving credentials that I don't need, I create an override file containing the database settings I'm interested in and apply them only if it's me that's accessing the site.

Let's say, for example, that a client is having issues when CSS Buttons are enabled, i.e. Configuration->Layout Settings->CSS Buttons is set to Yes.  They've since set their site back to use the image-based buttons.

I'll create the file /includes/extra_configures/enable_css_buttons.php that contains

if ($_SERVER['REMOTE_ADDR'] == 'my.ipa.ddr.ess') {
    define ('IMAGE_USE_CSS_BUTTONS', 'Yes');

Since the files in the /includes/extra_configures folder are loaded prior to the database initialization, that constant overrides the setting present in the database.  This will allow me -- and only me -- to see how the site looks with the CSS buttons enabled and perform my analysis without requiring access to the client's Zen Cart admin!

Copyright © 2012-2024 Vinos de Frutas Tropicales. Powered by Zen Cart