Add / Remove BoxesLast Update: 10th August, 2005
Article ID: 66



Introduction

New boxes can be easily added to the left or right side column by editing the appropriate includes/column_left.php or includes/column_right.php file.

Add Boxes

New boxes should be based on already existing boxes to make sure the formatting of the page does not get broken.

It is important to make sure that new boxes are wrapped within <tr><td> and </td></tr> tags:


<tr>
  <td>
    ##BOX CONTENT HERE##
  </td>
</tr>



For this example, the new box will be based on the Information box:


<!-- information //-->
          <tr>
            <td>
<?php
  $info_box_contents
= array();
  
$info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

  new
infoBoxHeading($info_box_contents, false, false);

  
$info_box_contents = array();
  
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_SITEMAP) . '">' . BOX_INFORMATION_SITEMAP . '</a>');

  new
infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- information_eof //-->



The includes/boxes/information.php file above will be copied to includes/boxes/my_new_box.php and will contain the following with MY_NEW_BOX text changing to the name of your box file and PAGE listings renamed to the new pages that will go in this new box:


<!-- my new box //-->
          <tr>
            <td>
<?php
  $info_box_contents
= array();
  
$info_box_contents[] = array('text' => BOX_HEADING_MY_NEW_BOX);

  new
infoBoxHeading($info_box_contents, false, false);

  
$info_box_contents = array();
  
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_PAGE1) . '">' . BOX_MY_NEW_BOX_PAGE1 . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_PAGE2) . '">' . BOX_MY_NEW_BOX_PAGE2 . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_PAGE3) . '">' . BOX_MY_NEW_BOX_PAGE3 . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_PAGE4) . '">' . BOX_MY_NEW_BOX_PAGE4 . '</a><br>' .
                                         
'<a href="' . tep_href_link(FILENAME_PAGE5) . '">' . BOX_MY_NEW_BOX_PAGE5 . '</a>');

  new
infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- information_eof //-->



The new box must then be included from either the includes/column_left.php or includes/column_right.php left or right side column file.

For this example, the new box will be included before the Information box on the left side column in includes/column_left.php:


<?php
  
require(DIR_WS_BOXES . 'categories.php');
  require(
DIR_WS_BOXES . 'manufacturers.php');
  require(
DIR_WS_BOXES . 'whats_new.php');
  require(
DIR_WS_BOXES . 'search.php');
  require(
DIR_WS_BOXES . 'my_new_box.php');
  require(
DIR_WS_BOXES . 'information.php');
?>



Next the new title and pages that go in the newly made box must be changed.

In catalog/includes/languages/english.php find this code:

// information box text in includes/boxes/information.php
define('BOX_HEADING_INFORMATION', 'Information');
define('BOX_INFORMATION_PRIVACY', 'Privacy Notice');
define('BOX_INFORMATION_CONDITIONS', 'Terms & Conditions');
define('BOX_INFORMATION_SHIPPING', 'Shipping & Returns');
define('BOX_INFORMATION_CONTACT', 'Contact Us');
define('BOX_INFORMATION_SITEMAP', 'Sitemap');



Copy this information for the Information Box and paste below the Information Box listing in the catalog/includes/languages/english.php file like this changing the Heading Title for the new box plus adding additional pages to the new box:

// my new box text in includes/boxes/my_new_box.php
define('BOX_HEADING_MY_NEW_BOX', 'My New Box');
define('BOX_MY_NEW_BOX_PAGE1', 'Page1');
define('BOX_MY_NEW_BOX_PAGE2', 'New Page2');
define('BOX_MY_NEW_BOX_PAGE3', 'New Page3');
define('BOX_MY_NEW_BOX_PAGE4', 'New Page4');
define('BOX_MY_NEW_BOX_PAGE5', 'New Page5');


Please refer to Add Box Pages for adding these additional pages in the new box.

Remove Boxes

Boxes can be removed from the left or right hand column by editing the appropriate includes/column_left.php or includes/column_right.php files.

Example includes/column_left.php file:

To remove the What's New box, it's inclusion needs to be commented out or removed entirely:


<?php
  
require(DIR_WS_BOXES . 'categories.php');
  require(
DIR_WS_BOXES . 'manufacturers.php');
  require(
DIR_WS_BOXES . 'whats_new.php');
  require(
DIR_WS_BOXES . 'search.php');
  
//require(DIR_WS_BOXES . 'my_new_box.php');
  
require(DIR_WS_BOXES . 'information.php');
?>


 

Related Articles

 

 

Trademark Policy | Copyright Policy | Sitemap

Copyright © 2000-2005 osCommerce. All rights reserved.