Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.

BTS Basics

Part 1 : BTS Structure

All template files are located in the /catalog/templates/[templatename] subdirectories. If you are using the aabox template, the files you want are in /catalog/templates/aabox and /catalog/templates/aabox/content.

  • To change the entire look of your site, edit main_page.tpl.php to your liking in any html or text editor (Dreamweaver is great), making sure to keep the php elements intact (but you can move them wherever you want in the page). Also edit stylesheet.css, located in the template directory you are using, to customize fonts and colors and background images.
  • To change the look of the side boxes, edit the box template, box.tpl.php. This will allow you to change the structure/layout of boxes.
  • To change the center content structure of most pages, edit the content template (located in the content directory of whatever template you are using) that matches the filename of the page you want to edit (look in your browser's url bar to find the correct filename). The only difference in filenames is that the template will have the extension 'tpl.php'
  • index.php has 2 content pages : index_default.tpl.php and index_nested.tpl.php.
  • index_default.tpl.php handles the overall center structure of index.php including where the define_mainpage module is displayed, where the default_specials, new_products, and upcoming_products modules are displayed and the overall structure of the html.
  • index_nested.tpl.php handles the layout of the category listing pages.

That really is all there is to it. If this seems difficult, a book on HTML/CSS will help you understand what is going on in the files. It is all basic html/css.

Part 2 : Adding new mods and making them BTS compliant

  • It is a little more complicated to convert non bts files to use BTS, but it is a basic cut and paste operation. Using this method, you can convert other non-bts contributions to use BTS, and also convert standard osCommerce templates to osCMax format.
  • It is quite obvious that there is code missing from the pages in the main catalog directory compared to a standard osCommerce install. The first time you try to install a mod that adds code to any of these pages, you will be asking yourself where the heck all the code went.
  • Well, it has been moved to the content directory of whatever template you are using. If you are adding a mod that says to add code to /catalog/shipping.php, you most likely will add it to /templates/[templatename]/content/shipping.tpl.php.
  • If a contribution adds a new file to the main catalog directory, for example “new_file.php”, you will need to split the code in that file so that the html content gets moved to new_file.tpl.php in the templates content directory. (templates/fallback/new_file.tpl.php or your own template folder)

Step 1: Move the HTML code into the template file

  • Most PHP files in the main catalog directory label a section of code marked by:

<!– body_text –> and <!– body_text_eof –>

  • You need to create a new file called new_file.tpl.php and put it in fallback/ or <your template>/
  • The code between these tags needs to be moved to your /content/new_file.tpl.php file and you need to delete it from the original code new_file.php.

Step 2: Clean up the rest of the redundant code

Next, you will see sections of code in the original /catalog/new_file.php file marked by:

<!– header –> and <!– header_eof–>

<!– body –> and <!– body_eof –>

<!– footer –> and <!– footer_eof –>

  • Remove these lines and all code between them. This is redundant code that is handled by main_page.tpl.php and is no longer needed.
  • Once you have removed the remaining redundant code, and you should have a file that looks something like this:

<?php
 /*
  $Id: new_file.php, v1.0 2003/12/04 12:00:00 ra Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
 */

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEW_FILE);

 require(DIR_WS_INCLUDES . 'application_bottom.php');
 ?>

Step 3: Add in the BTS code

Now you will need to add the BTS code to call the template.

  • Paste the following:

  $content = NEW_FILE;

  include (bts_select('main', $content_template)); // BTSv1.5

into your /catalog/new_file.php file just above the following:

require(DIR_WS_INCLUDES . 'application_bottom.php');
This should leave you with a file that ends up looking like this:

<?php
 /*
  $Id: new_file.php, v1.0 2003/12/04 12:00:00 ra Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
 */

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEW_FILE);

  $content = NEW_FILE;

  include (bts_select('main', $content_template)); // BTSv1.5

  require(DIR_WS_INCLUDES . 'application_bottom.php'); 

?>

  • Save this file

Part 3 : BTS Advantages

BTS templates offer several advantages to the osCommerce web site designer:

  1. Change the main looks of your shop by editing only some template files and the stylesheet (mainly “main_page.tlp.php” for the main looks and “box.tpl.php” for all “small info boxes”)
  2. Easily (automatically, in osCMax admin) create individual small box templates if you like For example take “box.tpl.php” and save it as “shopping_cart.tpl.php” (in the “templates/…/boxes/” directory) No further installation needed; edit “shopping_cart.tpl.php” to see it work. (box.tpl.php still controls all other small infoboxes)
  3. All small infoboxes have their own css id assigned, so even without separate templates you can make individual boxes look different through the stylesheet.
  4. Use any php code in the templates you like (that's one of the main differences between BTS and STS I think)
  5. Dynamic meta tags and page titles (“includes/meta_tags.php”)
  6. Switch templates through admin (admin::configuration::my store 'Default Template Directory' and 'Template Switching' Allowed)
  7. Switch by URL. This lets you secretly work on a new template and show it to everyone you like without the need of a separate install, and without bothering your customers.

Switch your template by setting Admin –> Configuration –> My Store –> Template Switching Allowed to true

Then simply append your template name to the url of your store with the following syntax: www.yourstore.com/index.php?tplDir=aabox. Note the capital D

(Replace aabox with your template name eg. fallback, css etc.)

You can also go to Admin → Configuration → Templates → Template Setup → Template Switching Menu Display and set this to true. This module will display a simple template switching message box at the top of your store.

  • Bookmark at
  • Bookmark "BTS Basics" at Digg
  • Bookmark "BTS Basics" at Furl
  • Bookmark "BTS Basics" at Reddit
  • Bookmark "BTS Basics" at Google
  • Bookmark "BTS Basics" at StumbleUpon
  • Bookmark "BTS Basics" at Technorati
  • Bookmark "BTS Basics" at Facebook
  • Bookmark "BTS Basics" at Twitter
  • Bookmark "BTS Basics" at Slashdot
v2.5/bts_docs.txt · Last modified: 2011/03/09 06:42 by pgmarshall
You are here: startv2.5bts_docs
Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0