Let's use an existing sidebox as an example ...
Look at the currencies sidebox ... it is designed to not show on pages that start with:
checkout
Look at the file:
/includes/modules/sideboxes/currencies.php
And you see the code:
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$show_currencies= true;
}
If we wanted that to be controlled based on secure pages, we would change that IF to read:
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
to read:
if ($request_type == 'SSL') {
$show_currencies= false;
}
So on secure pages, the variable $show_currencies is set to false ...
Then, if you look at the rest of the code, it is surrounded by an IF that reads:
if ($show_currencies == true) {
// bunch of code goes here
}
The idea is to follow a pattern to determine when to show the sidebox code based on some type of condition ...
Now if I wanted to do this in a template and override file, I would copy the two files:
/includes/modules/sideboxes/currencies.php
/includes/templates/template_dir/sideboxes/tpl_currencies.php
to my templates and overrides directories:
/includes/modules/sideboxes/your_template_dir/currencies.php
/includes/templates/your_template_dir/sideboxes/tpl_currencies.php
The reason I copy both files is that sometimes I need to change both and sometimes I just need to change one of the file pair ... but since it is a pair of files and I don't want to confuse myself or have updates come in later that might "overwrite" a working pair of files, I copy both files as if they were both changed ...
This is a safety I like to use, so whether you follow it or not is up to you ...
But for understanding the sideboxes better, study the different sideboxes ...
Most all of them have some kind of condition on them for when they should or should not show ...
Those that do not have a condition set on them for controlling when they should or should not show, can be customized ...
Again, the variable used for the:
$show_something
was used with the same name as the sidebox for keeping the code "more understandable" and it made more sense for the variable to be, for example:
$show_currencies
in the currencies sidebox currencies.php than to call it:
$xyzabc
Remember, you are looking for "patterns" when it comes to coding as most code, and Zen Cart is a good example of it, uses patterns to make things much more logical and clearer both to you as well as to us, the developers of the code ... :smile: