zen cart — How to Add a Sidebox to Zen Cart

One of the best way to customize Zen Cart is to create a new Sidebox.A Zen Cart sidebox is what displays various contents in the left or right 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. The followings are some of the most popular zen cart sidebox — The categories sidebox, the search sidebox, and the information sidebox. Zen cart comes with some builtin sidebox which could be a good tutor to start to learn how to add a new sidebox to Zen Cart.

A sidebox consists of three files which are located in the includes directory:

  1. modules/sideboxes/YOUR_TEMPLATE/new_sidebox.php
  2. languages/english/extra_definitions/YOUR_TEMPLATE/new_sidebox_defines.php
  3. templates/YOUR_TEMPLATE/sideboxes/tpl_new_sidebox.php

The ‘new’ up there should be replaced with your own sidebox name.

includes/modules/sideboxes/YOUR_TEMPLATE/new_sidebox.php

[codesyntax lang=”php”]

<?php
 $show_new_sidebox = true;
 if ($show_new_sidebox == true){
   require($template->get_template_dir('tpl_new_sidebox.php',DIR_WS_TEMPLATE,
   $current_page_base,'sideboxes'). '/tpl_new_sidebox.php');
   $title =  BOX_HEADING_NEW_SIDEBOX;
   //do some db query and other processing here

   $left_corner = false;
   $right_corner = false;
   $right_arrow = false;
   require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE,
   $current_page_base,'common') . '/' . $column_box_default);
 }
?>

[/codesyntax]

includes/languages/english/extra_definitions/YOUR_TEMPLATE/new_sidebox_defines.php

[codesyntax lang=”php”]

<?php
  define('BOX_HEADING_NEW_SIDEBOX', 'Gallery');
?>

[/codesyntax]

includes/templates/YOUR_TEMPLATE/sideboxes/tpl_new_sidebox.php

[codesyntax lang=”php”]

<?php
 $content = <<< End_Of_Quote
  Enter your sidebox content here
 End_Of_Quote;
?>

[/codesyntax]