Basics - Default files, template default and overrides

Default Files, Override Files and Templates in Zen Cart Basic

Zen Cart has a templating capability that allows you to modify the functionality and appearance of the cart. This capability sometimes called “overrides,” “template overrides,” or “overriding a file.”

Once you have built a new template (more on this later) and overrridden the files you want to change, you can switch back and forth between your new template and the default template from the admin using Tools > Template Selection. Thus, the advantage of using overrides versus modifying the original files directly is that with overrides, you can “revert” to original behavior and appearance quickly and easily for troubleshooting.

When you first install Zen Cart, the template which is in use is called responsive_classic. This is a new template, introduced in Zen Cart 1.5.5, which works on both desktop computers and mobile devices.

Template Files

The files which determine how the page will appear are called template files. In the case of responsive_classic, they can be found in the following folders:

./templates/responsive_classic
./modules/responsive_classic
./languages/english/extra_definitions/responsive_classic
./languages/english/responsive_classic
./languages/english/html_includes/responsive_classic

The files under these folders are called overrides. In other words, Zen Cart’s basic functionality and appearance has been overridden by these files.

Some files could be overridden but are currently not - for example, the site map template file (tpl_site_map_default.php) is not part of the responsive_classic template. When this happens, Zen Cart uses the default file (or base file) instead.

Default Files

How do you find the default file?

There are two possibilities:

a) For files under /includes/templates, the default file is includes/templates/template_default/FOLDER/FILENAME.

So the file

includes/templates/responsive_sheffield_blue/templates/tpl_product_info_display.php

is a template modification file based on

includes/templates/template_default/templates/tpl_product_info_display.php

This is the default template.

b) For all other files, the default file is one level above the template folder.

So the file

includes/modules/responsive_sheffield_blue/additional_images.php

is a template modification file based on

includes/modules/additional_images.php

Likewise, the file

includes/languages/responsive_classic/english.php

is a template modification of

includes/languages/english.php

If a templated file doesn’t exist in your cart, you can create it by copying the original from the default file.

And remember: if you aren’t changing a file, there is no need to copy it from the default file - the default file will be used by Zen Cart automatically. For this reason, you should expect your template to have many fewer files than the default template.

When you’re ready, you can read more about overrides.




Still have questions? No problem! Just head over to the Zen Cart support forum and ask there.
In your post, please include your Zen Cart and PHP versions, and a link to your site.


Last modified August 3, 2020 by Scott C Wilson (74774bb).