Developers API Overrides

From Zen Cart(tm) Wiki
Revision as of 11:30, 28 February 2006 by Grayson (talk | contribs) (Initial description of override system)
Jump to: navigation, search


Zen Cart features a template override system that allows you to customize the look and functionality of your store without having to modify core files. (Note: the override system is not yet available for Admin files, and is not yet available for some Catalog files.)

The template override system also allows you to change your store's look and functionality on a seasonal basis, for example, by creating multiple templates.

There are currently 4 components of the override system:

  • Language overrides
  • Template overrides
  • Module overrides
  • Sidebox overrides

How the template override system works

To make use of the override system, first name your custom template. In the examples below, we will call this your_custom_template. You create a folder with this name in every directory that contains files you wish to modify. Place a copy of each file you wish to modify in the custom template directory at the same level; then modify this custom template copy, leaving the original file untouched.

Info.png Note:
The override system does not extend to every file in your store. You can tell that a particular directory uses the override system by checking for the folder "classic" in that directory. Any directory that contains a classic subdirectory can be overridden.

For example, suppose you wish to make changes to the language file includes/languages/english.php. You first create an override directory for your template at the same level, that is, in includes/languages/. Now you have a directory called includes/languages/your_custom_template/. Copy the file includes/languages/english.php to your override directory; now you have a file called includes/languages/your_custom_template/english.php. Make your desired changes to this file, and they will be picked up and used by the override system.

Language overrides

You can override any file in the path includes/languages/. Create a folder named your_custom_template in each of the following directories:

  • includes/languages
  • includes/languages/english
  • includes/languages/english/extra_definitions
  • includes/languages/english/html_includes
  • includes/languages/english/modules/order_total
  • includes/languages/english/modules/payment
  • includes/languages/english/modules/shipping

Create a copy of any file you wish to modify, and place it in the appropriate custom template directory. For example, if you wish to modify a file in the directory includes/languages/english/extra_definitions/, you would place a copy in includes/languages/english/extra_definitions/your_custom_template/.

Repeat for every language your store uses.

Template overrides

You can override any file in the path includes/templates/template_default. These are the files that determine the layout and HTML formatting of your web pages. Zen Cart has three standard templates: template_default, blue_strip, and classic. You can see these folders in the includes/templates/ folder.

Of these three standard templates, only template_default contains a full set of files. Every other template contains only the files that differ from template_default; that is, only the files that have been modified. If your template does not contain a particular file, Zen Cart will pull that file from template_default.

First, create the folder includes/templates/your_custom_template. As you customize your store, you will copy files from includes/templates/template_default/ over to includes/templates/your_custom_template/, always preserving the directory structure.

For example, if you want to modify the CSS for your store, you will copy the file includes/templates/template_default/css/stylesheet.css to includes/templates/your_custom_template/css/stylesheet.css, and modify this copy.

Module overrides

Sidebox overrides