Creating the template_info.php file

Why doesn’t my template show up in Tools > Template Selection?

Activating your template so that you can use your overrides requires two final steps (the first is one time only, of course).

a. Create includes/templates/YOURTEMPLATE/template_info.php

In order for the system to “see” your template, the template_info.php file must exist inside the includes/templates/YOURTEMPLATE folder.

Create it as follows:

<?php 
$template_name = 'Your Template Name'

b. Login to your Admin panel and go to Tools > Template Selection. You should see your new custom template(s) in the dropdown list. Select your template.

You are now using your new template.

Full specification for template_info file

If you are going to distribute your template, you should build out the template_info.php file more completely. Use this

<?php  
$template_name = 'YOURTEMPLATE';  
$template_version = 'Version 1.0';  
$template_author = '<enter your name>';  
$template_description = 'describe your template'; 
$template_screenshot = 'screenshot.jpg';  
$uses_single_column_layout_settings = (isset($uses_single_column_layout_settings)) ? $uses_single_column_layout_settings : true;

In 2.1.0, the following is added:

$uses_mobile_sidebox_settings = false;

Create a screenshot of your template, and save it as includes/templates/YOURTEMPLATE/images/screenshot.jpg. This way people will be able to “preview” your template.

The $uses_single_column_layout_settings entry is new to Zen Cart 1.5.8a and forward. (PR for Zen Cart 1.5.8 users here). It indicates whether or not the Admin Layout Boxes Controller displays the ‘SINGLE COLUMN’ sort-order and status fields. Your template’s default (either true or false) indicates whether the template itself includes sideboxes (like those which reside in the header) that check for the layout_box_single_sort_order and/or layout_box_single_status in determining whether or not their content is displayed. It’s a good idea (as in the example above) to check to see if the variable already exists, in case a store needs to further control these settings.

Notice there is no closing PHP tag.




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified August 23, 2024 by Scott C Wilson (dddeed6f).