Technology Insights

How to Add a New Sidebox to Zen Cart

A Zen Cart sidebox is what displays various items in the side columns of your Zen Cart store. By default numerous sideboxes will show in either the left or right column of a Zen Cart online store for instance the categories sidebox, the search sidebox, and the information sidebox. Adding a new sidebox to Zen Cart can be completed in a few quick steps. You will need access to the server to add and modify files.

Add a Zen Cart Sidebox:

  1. Create Sidebox Template:Add a new file to the server in the following directory: zen-cart-root/includes/templates/template-name/sideboxes/. You should name the file something relating to the contents of the sidebox. In this example we will be adding a welcome message sidebox so we might name the file tpl_welcome.php. The contents of the file will include what you want to display in the box and will be in a $content variable. Below is an example of the contents of the file if you wanted it to just display a message like “Welcome to my store”.

    1. < ?php
    2. /**
    3. * Side Box Template
    4. *
    5. */
    6. $content = 'Welcome to my store.';
    7. ?>

Technology Insights

How to Add a New Define Pages Page to the Information SideBox in ZenCart

This article describes how to add a link to the Information sidebox that links to a new page in the defined pages section. You will be required to create files, modify files, and insert SQL code into the MySQL database.

In the instructions below yourpage or YOURPAGE is the title of the page you are adding. For instance if you wanted to add one called technology you would replace YOURPAGE and yourpage with technology and TECHNOLOGY. The actual file would be technology.php.

1. Modify File:

Modify the following file <zencart-root>/includes/filenames.php by adding the following two lines of code:


  1. define('FILENAME_DEFINE_YOURPAGE', 'define_yourpage');
  2. define('FILENAME_YOURPAGE', 'yourpage');



  1. define('FILENAME_DEFINE_PRIVACY', 'define_privacy');
  2. define('FILENAME_PRIVACY, 'privacy');


Technology Insights

ZenCart Search Button Image Not Displaying

I installed ZenCart recently for a project I am working on and was playing around with the default design including switching some of the buttons around. I noticed that the search sidebox search button was not displaying. After a little bit of digging around I noticed an error in the code. The file that needs to be modified is the <zencart-root>/includes/templates/template_default/sideboxes/tpl_search.php template as noted below.

[quickcode:Old tpl_search.php]
* Side Box Template
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license GNU Public License V2.0
* @version $Id: tpl_search.php 4142 2006-08-15 04:32:54Z drbyte $
  $content = “”;
  $content .= ‘<div id=”‘ . str_replace(‘_’, ‘-‘, $box_id . ‘Content’) . ‘” class=”sideBoxContent centeredContent”>’;
  $content .= zen_draw_form(‘quick_find’, zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, ”, ‘NONSSL’, false), ‘get’);
  $content .= zen_draw_hidden_field(‘main_page’,FILENAME_ADVANCED_SEARCH_RESULT);
  $content .= zen_draw_hidden_field(‘search_in_description’, ‘1’) . zen_hide_session_id();

  if (strtolower(IMAGE_USE_CSS_BUTTONS) == ‘yes’) {
    $content .= zen_draw_input_field(‘keyword’, ”, ‘size=”18″ maxlength=”100″ style=”width: ‘ . ($column_width-30) . ‘px”‘) . ‘<br />’ . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
    $content .= ‘<br /><a href=”‘ . zen_href_link(FILENAME_ADVANCED_SEARCH) . ‘”>’ . BOX_SEARCH_ADVANCED_SEARCH . ‘</a>’;
  } else {
    $content .= zen_draw_input_field(‘keyword’, ”, ‘size=”18″ maxlength=”100″ style=”width: ‘ . ($column_width-30) . ‘px” value=”‘ . HEADER_SEARCH_DEFAULT_TEXT . ‘” onfocus=”if (this.value == \” . HEADER_SEARCH_DEFAULT_TEXT . ‘\’) this.value = \’\’;” onblur=”if (this.value == \’\’) this.value = \” . HEADER_SEARCH_DEFAULT_TEXT . ‘\’;”‘) . ‘<br /><input type=”submit” value=”‘ . HEADER_SEARCH_BUTTON . ‘” style=”width: 50px” />’;
    $content .= ‘<br /><a href=”‘ . zen_href_link(FILENAME_ADVANCED_SEARCH) . ‘”>’ . BOX_SEARCH_ADVANCED_SEARCH . ‘</a>’;

  $content .= “</form>”;
  $content .= ‘</div>’;


It should actually look like the below.