STS 4.5.8

STS 4

Contribution from Chris Buchi "Rigadin2"; and Bill Kellum "bkellum" (of Sounds Good Productions)- great OSC community members
Latest version: STS version 4.5.8
Download URL: www.oscommerce.com/community/contributions,1524
Price: Free
Suitable for: OSC 2.2 MS2, OSC RC1, OSC RC2 (and RC2a)
Documentation (by Bill Kellum): available together with download (.doc format). I have also made a copy of the STS v4.5.8 User Manual (in .pdf format; approximately 273 kb. This is Bill Kellum's documentation but I just made it into .pdf format as it is safer for internet downloads).
To download and save the file:
Right-click > Save Target (or save link) to ... (specify where you want to save it to on your computer).

STS 4 - what does it do?

Preamble

This is a short tutorial is specifically about the OSC contribution STS v4.5.8 (although I will interchangeably refer to it here as STS 4 or just STS). Most of this information is gleaned from the documentation done by Bill Kellum (comes with the download). I have put this into a more graphical form and am only covering the very basics. I have had an earlier but similar version of the STS module for quite a while and only used it in "best hope" kind of state - hoping without really knowing that what I did was right. It looked right (i.e. did not break my site), and it worked. But I had no clear idea what I actually did to make it work and was hoping I would never have to revisit and re-tweak or redo any work on it.

However recently I had to upgrade my version of OSC and with it, it needed the latest version of this module. So I thought I best get my mind around this great module and actually have a clearer idea of what to do, what it does, and how to change things.

This module does a whole lot of things and for the deeply technical kind of people, I refer you to Bill Kellum's documentation and to the forum support thread found at STS 4.5.8 OSC Forum. For those of you wanting to get a clearer basic grasp on how to work this, then this should be perfect for you!

I am not covering the installation steps either as they are all included in the module's download.

Overview

STS stands for Simple Template System. And that is what it does brilliantly. It uses templates and placeholders (aka variables) so that you can easily redesign the look and feel of your osCommerce e-commerce site. I don't remember what I had to do before to change the layout of my site, but I know I don't want to go back to that. With STS 4, it is just so much easier!! It requires only modifications to a few OSC files (all instructions given when you download the contribution) and from then on, you will be using a few HTML files to design your layout. Thank God for the good old HTML files!

Folders and Files you will most use

STS 4 comes with folder and files that you have to upload to the appropriate locations in your store file directory. Just follow the installation instructions provided. Once you have done that, all the files should be in place. I will refer to the files and folders you will most use as if your installation is done and they are all in the right place.

STS - folders Even though you can go into the possibilities of STS much deeper than what I will explain here, this tutorial will give you a clear basic starting understanding of which files you will most use,what they do, and where they are. All the files we are talking about are in 2 main folders. The:
(catalog)/includes/modules/ folder and the
(catalog)/includes/sts_templates/ folder.
Where (catalog) is the folder where you have installed your oscommerce.

So if your oscommerce has been installed in the root, then the path would be:
/includes/modules/ and
/includes/sts_templates/ respectively.

Or if you installed osc in a (sub)folder in the root called "myosc", then the path would be:
/myosc/includes/modules/ and
/myosc/includes/sts_templates/

For simplicity, I will refer to these directory paths as
/includes/modules/ and
/includes/sts_templates/

And within each of these folders, there are sub-folders of interest which I will now explain briefly.

Script & Placeholders

STS- script and placeholder files

Within the /includes/modules/ folder, there are 2 sub-folders of interest: /sts/ and /sts_inc/ folder.
All you have to know right now is that:

  • /sts/ will contain the script-files (.php files) that will call the appropriate template-files (.html files) to be used. See more about template-files below.
  • /sts_inc/ will hold the files that contain the placeholders or variables we will be using on our pages. If you create any new placeholders, they will also be declared and added to the appropriate file in this folder.
Example of a placeholder:
$productdesc is a placeholder.
It is the description of a product (that you have entered via the Admin/catalog/ section of oscommerce).

When you put $productdesc in one of the STS template files, on viewing the relevant (product) page, you will see the description-text that you have for that particular product-item.

You will see all the placeholders listed in the STS User Manual, but I have listed some of the more frequently used ones as well (see the navigation on the right).

Template folders & files

STS- HTML template foldersWithin the /includes/sts_templates/ folder, there are 2 sub-folders of interest: /full/ and /test/ folder.
I will refer to these folders as your choice of "Template Folders" - which is also what they are called in the STS module as you will see in the osc Admin > Modules section.

Each of these Template Folders contain files that are in HTML format and are your design-layout files to create the look and feel you want. These files are your template files.

When you installed STS, these two Template Folders already contain files you can use straight off or you can copy, duplicate, save as another name and thereby create more customized template files for yourself. The /full/ folder has many more files than the /test/ folder. However it is the /test/ folder we will be using. You can rename this later if you want but for now, I will concentrate on the how-to-use factor.

The /full/ folder, though usable, is mainly used for copying template files over to our working /test/ folder if and when we want more specific or different kinds of (HTML) templates.

The default HTML template file

Let me stress again, it is the HTML template files that, because they are in .html format, you can so easily use to move things around and make changes to how your pages look. These template files are all found in the /includes/sts_templates/ folder.
The /sts_templates/ is also called "base folder" in other places; though to be clearer, it really should then be called "base Template folder" or "parent Template folder".
The default HTML template file (the .html template file that will be used if you customize nothing else) is actually found in the Template Folder /test/, specifically:
/includes/sts_templates/test/sts_template.html
Now if you were to open this up in a WYSIWYG editor, you will pretty much see this - showing you the layout and various placeholders. So you can see how easy it is to (re)arrange this one html file to change the look of your pages. So if you change nothing else after enabling STS, this is pretty much how your pages will be laid-out when viewed in the browser - with the correct information displaying in place of the placeholders. (All the placeholders have a $ preceding the word).
STS - default template file

4 Modules

STS 4 sub-modulesSTS 4.5.8 (from hereon in, referred to as STS) comes with 4 modules (or sub-modules if you like). All independent of each other so that you can choose to use just 1 or all of them. By default, it is disabled. All you need to do is simply enable them in your osc Admin section. The Default module however must be enabled to use STS at all.

Default Module

STS 4: Default Module

4 Modules

STS 4 sub-modulesRecall that STS 4.5.8 (from hereon in, referred to as STS) comes with 4 modules (or sub-modules if you like). The Default module must be enabled to use STS at all.

Default Module

STS - default moduleThis is the main module. Must be enabled to use any of the others. Even if you just have only this one enabled, it will already make your designing job much easier.

In OSC Admin, you enable/disable it. There are few parameters you can set. For now, I am only dealing with the basic ones we need.

  • Use Templates? - i.e. Do you want to use STS?

    Set to true to enable
  • Files for normal template - i.e. What placeholder file(s) does your Default HTML Template file need?

    This is asking you which files the HTML Default Template File (sts_template.html) will need to use. Specifically it wants to know what placeholder file(s) contains the placeholders that will be used in sts_template.html). By default, this placeholder file is sts_user_code.php (which is in /includes/modules/sts_inc/)
  • Base folder - Where is the top-most STS folder that holds all your HTML-template files?

    as I alluded to above, this should really be called "Base Template Folder" for the sake of clarity. So here it is asking you what is the STS top-most parent folder that holds all of your templates or template-folders? As we know, that would be sts_templates.
    STS- HTML template folders
    Now here you have to specify 2 more pieces of information: it needs to know the path to sts_templates relative to the osc installation (or "catalog" as it is called in most documentation) and
    you need to end the path with a trailing forward-slash (/). Hence:
    Base folder = includes/sts_templates/
  • Template folder - Which folder is your default or Working Template folder? (i.e. which folder containssts_template.html)?

    STS - working Template folderAs I said earlier, we would be choosing the /test/ Template folder as our working folder. If you had another Template folder you wanted to use and you wanted the default Template-file to still be sts_template.html, then you would move (or copy) that file over to your Template folder of choice. The Working Template folder you choose is just the folder that contains all your HTML template files and all you have to do to choose/change the Template folder you want to use, is by letting STS know - via the osc's Admin > Modules; just as we are doing now.
  • Default template file - What is the name of your default template file?

    By now you already know the answer right? ==> sts_template.html

STS Default module: Summary

STS Default module summaryI know the smarter ones amongst you will find this silly but it took me a quite awhile before I could see these connection clearly. So I am including a summary-logic here for those of you who might unenviably find themselves in a similar situation as myself.

What we have done here is:

  • We said "yes" we want to use STS contrib and we did this by activating/enabling the Default module.
  • We will be using the template-file sts_template.html as our design/layout file for our pages.
  • This file is located in the template-folder test..
  • ..which is found in (catalog)/includes/sts_templates/
  • And the placeholders that sts_template.html will need are to found in the placeholder file sts_user_code.php

OK! Great! But what do you do now, right? Well you can now simply go to your chosen default HTML template file:
/includes/sts_templates/test/sts_template.html
Open it in any HTML editor, and make changes to layout as you like.
And if you need to know either the definition or more placeholders you can use, please refer to Bill Kellum's STS v4.5.8 User Manual (which comes with the STS module when you download it). Or if you prefer, you can download this STS v4.5.8 User Manual (in .pdf format; approximately 273 kb. This is Bill Kellum's documentation but I just made it into .pdf format as it is safer for internet downloads).

To download and save the file:
Right-click > Save Target (or save link) to ... (specify where you want to save it to on your computer).

STS Default module: Footnote

Now that you hopefully have a clearer picture in your head about the Default module, let me just add a few more tiny facts (which you will also find somewhere in the STS User Manual or in the installation instructions).

When you open up the folder /sts_inc/ containing the placeholder files, you will see that there are a number of placeholder files in there already. If you wanted to use some placeholder that is in one of this other placeholder files (in addition to the default sts_user_code.php), then in your Default module setup, you just add the name of the additional placeholder file(s) after sts_user_code.php separated by semi-color (;).

For example, if you wanted to use a placeholder file you created and named extras.php, then your setup would look like:
Files for normal template = sts_user_code.php;extras.php

You can also create your own placeholders and put it in a new file or in one of the existing placeholder files. Then remember to "tell" STS as per above. If you create a new placeholder file, you must put it in the same folder as with all the other placeholder files - i.e. in folder /sts_inc/

A sample of the format needed to create a new placeholder can be found in:
includes/modules/sts_inc/sts_user_code.php

Next we will be going to examine the Product Info module. That's because I find it very useful as it gives me subtle but powerful control over how my product pages displays. If you have ever tried to change the look of a os Commerce file, you will know what I mean!

Product Info Module

What does the STS 4's Product Info module do?

This is a very useful sub-module within the STS 4 contribution. It allows you to change/customise the look of all your product pages, all the product pages within a certain category, or even a specific product within a specific category!

This is actually done via 2 templates:

  • a Main template (for the headers, columns, footer) and
  • a Content template (for the center part of the body)

Below is a sample of what a template file looks right. With the Product Info module enabled, you have the ability to change the looks of the "yellow" sections and/or the "pink" sections. With the "pink" section, what you will be modifying (via a content template file) will be the $content placeholder.

STS - Product Info module templates

Settings: STS Product Info Module

STS 4 - enable Product Info module To enable this module go to:
osc Admin > Modules > Product Info

Settings

  • Use template for product info page - "true" means Product Info module is enabled
  • Files for normal template - What placeholder files does the Main template file need?
    As with the Default module, usually the sts_user_code.php placeholder file will be sufficient. If you need to use any placeholders from the other placeholder files, just tag the name of that placeholder file on after the sts_user_code.php file, separated by a semi-colon.
    As discussed in the previous section (on Default module), all placeholder files are in the /includes/modules/sts_inc/ folder.
  • Files for content template - What placeholder files does the Content template file need?

    Usually the default two placeholder files will suffice. But you can add more if you need, or remove if you don't need any of the placeholders in any of the specified placeholder files. (The placeholders from these two placeholder-files are reproduced at this site for your convenience. See the navigation for the listings.)

How Product Info module works

As mentioned above, there are 2 templates that control how you can vary the way your product pages are laid out: the Main template (for the "yellow" parts - header, columns, footer) and the Content templates (for the "pink" part - the central content part of a product page).

The Product Info module first looks for the Main template and then for the Content template. Usually your Main template would be the same for most if not all your product pages, as the type of information and layout you want for the header, columns, footer would not change much. But if you wanted them to change for a specific category, for a specific page within a specific category, or even for just one specific page, you can do this with the Product Module.

The same holds true for your Content template.

The Main template

Very often, how the layout of "yellow" part of a page is the same, whether you are looking at a product page or not. If so, then you don't need to do anything about the Main template as described below.
STS- HTML template foldersAs we mentioned in STS 4, the STS 4.5.8 contribution comes with 2 template folders, which are found in /includes/sts_templates/.

We also said that we have chosen (as recommended in the User Manual) to use the "test" as our working Template folder. And we noted that the "full" template folder has more files than the "test" folder but that we can easily copy, rename, and paste the files we needed from the "full" to our "test" folder.

Now only if you want the "yellow" part of all/any your product pages to be different from other pages in your site, only then will you need to do anything about the Main template. Otherwise, you can ignore this section and go on to the discussion on the Content template below. If you are going to be changing the "yellow" part for any of your product pages, you will need to use a file from the "full" folder.
In a fresh install/download, this is what the "full" template folder contains:
STS 4 - contents of full folder We are interested in the product_info.php_3.html file.

Copy this file over to our chosen Template folder "test".
Rename it to product_info.php.html

We will be using this as our default Main (HTML) template file for our product pages - that is to say, if you

  • enabled the Product Module
  • and decided that all your product pages are going to have a different layout/look for the "yellow" part than for the rest of the pages on your site, then the layout as in the (newly renamed main template file) /includes/sts_templates/test/product_info.php.html will determine how the "yellow" part looks (the headers, columns, footer, etc.)

This is pretty much what the layout looks like when you have a look at it (in a WYSIWYG HTML editor):
STS - Product Info module templates Again, remember we are talking about the "yellow" portion. So changing/adding/removing/moving any of the placeholders will change the "yellow" part of your product pages. You redesign as you would with any HTML layout file.

Okay, what do you do if you want specific look and feel for specific pages or categories?

Different look for one specific Product

Let's say that you are happy with your look and feel ("yellow") part of all your product pages but you just a different look for one particular product item. This can be a completely different looking "yellow" part of just a subtle but important difference.

Let's say that the specific product has a products_id=4. (Easiest way to get this is by looking at the address bar in your browser when viewing that one particular product).

In your /includes/sts_templates/test/ folder,

make a copy of your template file: product_info.php.html
If you don't have a product_info.php.html file in your "test" folder because perviously you didn't need the "yellow" part in your product pages made different from the rest of your site, then copy the file product_info.php_3.html from the "full" folder as outlined above, to your "test" folder.
rename the copy to: product_info.php_4.html
open this new file up, edit and make the changes to layout you want, upload to your site.
That's it!

When you view that specific product in your browser, you should see the layout changes you wanted for this product.

Different look for one specific Product in one specific Category

Now let's say that you are happy with your look and feel ("yellow") part of all your product pages but you just a different look for one specific product which is located in one particular category item. As before, this can be a completely different looking "yellow" part of just a subtle but important difference. And this new look/layout you want will only apply when the user gets to this page by drilling down that category to that product (not by simply doing a search and getting to that product or even by entering the URL for the product directly into the address bar).

Let's say that the specific product has a products_id=4 and the category it is in has a cPath=46.

In your /includes/sts_templates/test/ folder,

make a copy of your template file: product_info.php.html
If you don't have a product_info.php.html file in your "test" folder because perviously you didn't need the "yellow" part in your product pages made different from the rest of your site, then copy the file product_info.php_3.html from the "full" folder as outlined above, to your "test" folder.
rename the copy to: product_info.php_c46_4.html
open this new file up, edit and make the changes to layout you want, upload to your site.
That's it!

When you drill down from this category to get to this product, you will see that changes in layout that you wanted.

Different look for one specific Category

Now let's say that you are happy with your look and feel ("yellow") part of all your product pages but you just a different look for one particular category item. This can be a completely different looking "yellow" part of just a subtle but important difference.

Let's say that the specific category has a cPath=46. (Easiest way to get this is by looking at the address bar in your browser when viewing that one particular category).

In your /includes/sts_templates/test/ folder,

make a copy of your template file: product_info.php.html
Again, if you don't have a product_info.php.html file in your "test" folder because perviously you didn't need the "yellow" part in your product pages made different from the rest of your site, then copy the file product_info.php_3.html from the "full" folder as outlined above, to your "test" folder.
rename the copy to: product_info.php_c46.html
open this new file up, edit and make the changes to layout you want, upload to your site.
That's it!

When you view that specific category in your browser, you should see the layout changes you wanted for this category.

How does the Product Module know how to do that?

As mentioned at the start of this discussion, the Product module first looks for any relevant Main template (for the "yellow" part) and then after that, it will look for any Content template (for the "pink" part) that it should apply.

In each of these searches, it will go from the very specific to the general. As soon as it has found the relevant specific template, it will apply that and stop the search for anymore relevant templates. So from our examples above, this is what it would do in sequence:

  1. check if the specific product being viewed has a specific (main) template applicable to it?
    If the product was product_id=4, then as soon as the Product Module finds the HTML template file in your working template folder ("test" folder), it would apply the layout as specified in product_info.php_4.html
  2. if there is no such specific product template, and the call to view the product had been done via a drilling down within (one of the) category(ies) it belongs to, it would look to see if there is a template for this product in that category -
    i.e. it would search for the template file: product_info.php_c46_4.html. If found, it would apply this layout specific.
  3. if not found, it would then look for a category specific template (when the call to view the product was been done via a drilling down in a specific category to which the product belongs) -
    i.e. it would search for the template file: product_info.php_c46.html
    If found, this layout would apply.
  4. if not found, it will look to see if there is a general product info template to be applied -
    i.e. it will search for the template file: product_info.php.html
    If found, it will apply the layout there.
  5. if there are no specific kinds of product templates to be found, the Product Module will use the base or Default layout template, which is sts_template.html (which was set in the STS 4 Default Module as discussed earlier).

The Content template

STS - Product Info module templatesI find the content template extremely useful. I can show the product details exactly how I want them, using the placeholders that I want. Even if you don't use the STS 4 Product Module, the osc default product information is still pretty good. But when you really want to change something or add some piece of information or make the product details look different somehow, then you will be oh so grateful to have the Product module.

Without me even saying it, you must already know that the $content part is determined by a content template when we enable the Product Module. And that this template is a good old HTML file. But where is it and what is it called?

The Content template HTML files

All of the content template HTML files follow exactly the same naming convention as delineated above when we were talking about the Main template. The only difference is that you must have the content template files in a "content" folder within your working Template folder (i.e. our "test" folder). That means that all the content template files must be stored in /includes/sts_templates/test/content/

STS 4 - content folderWhen you look at the files and folders you downloaded and installed for the STS 4 contribution, you will notice that there is no such "content" folder within the "test" folder. However in the fuller "full" folder, you will see it. And it contains only one file: product_info.php_26.html.

Copy the "content" folder into our "test" template folder, i.e.
copy from /includes/sts_templates/full/content/ into /includes/sts_templates/test/
You should now have: /includes/sts_templates/test/content/product_info.php_26.html
Rename the file. What you rename it to will depend on whether you want the content section (represented by the placeholder $content - i.e. the "pink" portion) to be a different layout for one specific product, for a specific product within a specific category, for all products in only one specific category, or for all products. Revisit the Main template section above for the name-format to apply to this template file. Just in case that is not clear, if you want the layout of the $content section to be customised for one specific product (say, product_id=12), then your content template file would be renamed to product_info.php_12.html

For this exercise, I have renamed my content template file to be product_info.php.html (i.e. I want the customised layout changes to be applied to all my product pages.

Open the content template file in a HTML (wysiwyg) editor, make the layout changes you want, upload. That's it.

Just to show you the big changes you can do to how your product details can look. Below is how the content template looked before any changes were made to the layout:

STS4 - original content template
This is the same content file after I made my changes:
STS 4 - modified content template
As you can see, thanks to the STS 4 Product module, I was able to make some big changes to how my product information is laid out and displayed.

Comment on Placeholder files

STS 4 - enable Product Info module At the start of this paper, I talked about the settings you would enter when you enabled your Product module. In particular, I want to now comment on the field:
Files for content template = sts_user_code.php; product_info.php

The 2 files specified are placeholder files and as with all placeholder files, they are located in /includes/modules/sts_inc/

You can remove these files from this settings fielf (for faster processing time) if you don't use any of the placeholders in those files. However if you are using this Product Info module, you will almost invariably be needing the placeholders found in /includes/modules/sts_inc/product_info.php.

You can also have a look at the placeholders in these placeholder files. Either open up your own files or look at: STS 4 List of User (created) placeholders and STS 4 List of Product Info placeholders.

How does the Product Module find the correct content template file?

It uses the same logic as spelled out in our discussion on the Main template above: i.e. it will look from the very specific to the general. It will apply the most specific content template it can find. Just a reminder, it will first look and confirm the Main template (the "yellow" portion) and then it will look for the Content template (the "pink" portion). If no content template is found, it will just use the $content that comes with osc.
If you find you are happy with how os Commerce presents your product information and you won't be customizing the look of any of your product related pages, then disable the Product Module. That is, set Use template for Product Info page = false

This will save parsing and processing time.
OK. I apologize if you find I am over-repeating the same information and terms. This is because personally I find that to be over-explained is better than to be under-explained. Plus the repetition of the same terminology and information helps to "stick" that information in the mind and to help form a better picture so one can more or less visualize how the things are connected, how they work, and hence, what you need to change to make modifications.

Index Module

What does STS 4's Index module do?

The naming of this module can be a bit confusing. When you think of index page, you normally think of the home/front page of your site. Which is partially what this module applies to but it does much more than that.

With the Index module, you can create a different layout/look for your home page (e.g. when you want it to look pretty different from the rest of your site), your category and/or sub-category pages, and/or your manufacturer pages. These customized layout might range from different colours, positional arrangement of pieces of information, and/or additional informational text that you want displayed only for certain category, sub-category, or manufacturer pages.

If you use this, the layout you apply to a category will also automatically be applied to all its sub-category(ies) and product items within that unless you have specific layouts specified for the sub-category or product detail pages.

For instance, if you use this module and create a customized template for the design & look of a specific category, and this category has one sub-category, and 10 products within that sub-category, then the template look that you applied for that category will also be automatically applied to its sub-category and all 10 product detail pages. And this is true whether you drill-down to find one of those 10 product items, or you use a search to find it, or by entering the URL to the category/sub-category/product in the address bar.

The above is true unless you have a another templated design that is more specific - e.g. you have also customized the sub-category or you have a customized template for the product (which is done via the Product Info module). The more specific templates will always take precedence over the more general templates. That is, the most specific templates would be those specially designed for a specific product; next would be a specific product within a specific category; then a (sub-)sub-category template; then a category template; and the most general would be the sts_template.html which is the Default template (from Default module). This Default template would apply for the entire site if you have STS enabled and use no other modules except the Default module.

This same kind of logic holds true whether we are talking about "categories" or "manufacturers" in your osCommerce.

So we now know that the Index module, when it looks for what templates to apply to which pages, also takes into consideration the product pages templating (i.e. has a product page been design-customized via the Product Info module?). The following flowchart shows how this logic works:

STS 4 - Index module flowchart
If you are not going to customize your category or manufacturer or your home page, don't enable the Index module as the Default module will be sufficient and will save you processing time.

Settings: STS Index Module

STS 4 - Index module settings
  • Use template files for index page - Will you be customising the look of your Home page, (sub)Category, and/or Manufacturer pages?
    Set to "true" to enable
  • Files for index.php template - What placeholder files will you be using for any of your design-templates here?
    By default, the sts_user_code.php placeholder file is included. If you don't need it, you can remove from this field. If you are using more/other placeholder files, add it here. Separate each placeholder file with a semi-colon.
    Reminder: all placeholder files must be in /includes/modules/sts_inc/
  • Check parent templates - Do you want Index module to keep looking upwards for a category's parent if there is no specific "index"-template for that specific category?
    If "true", and a specific sub-category has no "index"-template, then the Index module will check to see if it's parent (sub-)category has a specified template, and if not, if the category-parent (another level) above has a specified template, etc. If you don't want/need this, set to "false" - which will save you parsing and processing time.

Naming Formats for "Index" templates

Just to be my old repetitious self, let me repeat again that the word "index" as used here to refer to HTML design templates do NOT refer to the Home/Front page. (It can however, as you will see in a moment.)

Rather, it is as if the term "index" as used here in this Index module means the "front" page for each sub-category, category, and/or manufacturer. Which is still a bit misleading because, for example, a category's "index" template will still apply to all its child-categories and product pages (unless specifically over-ridden). Oh well, just remember that the work "index" here does not just mean your home/front page!

If you are going to customize any of these pages, then the naming format are as follows, and each of these (HTML) template-files must be stored in /includes/sts_templates/test/ (where "test" folder is your Working Template folder. Please refer again to STS 4: Default Module if unclear as to what a "Working Template" is.)

for .. File Naming Format
(site's) Home page index.php_0.html
a specific manufacturer (e.g. manufacturers_id=6) index.php_mfr_6.html
all manufacturers index.php_mfr.html
a sub-category..
(e.g. cPath=40) which is a child of parent category (e.g. cPath=2)
index.php_2_40.html
(Note: top-parent category-id first, then it's child-cat-id, then next child-cat below that, &c.)
category (no parent) e.g. cPath=3 index.php_3.html

for Home Page

STS Index Module for Home Page

Many people like to customise their home pages quite extensively. Can the STS Index Module be of any great help here?
Well, yes and no. It depends on what you want .. and more specifically, what you don't want.

There may be other cleverer ways of doing this. And there are undoubtedly osCommerce contributions that will do this - i.e. fully customized your home page. However I am one of those who like to install as little as I can get away with. Each installation not only takes a lot of time and reading to get it going. But the worse of it is when it does not work or crashes or breaks your site. Then it is truly a few days of just losing hair. And sleep. And good humour.

What osc already does

Let's say we are not using STS but just the way osc came to us. We know that it is pulling in dynamic data from somewhere so that it can populate our different pages like our product details pages and our home page. But they do look different from each other don't they? So specifically, where does the content for the home/front page come from?

original sts-template file I am going to use this image for illustration. Imagine for a moment that this is how your home page is set up. (This shows the HTML design layout using placeholders and stuff but not to worry, what we are concerned about here is only what the $content placeholder represents.)
Our question was, without STS contrib, where does the actual info that placeholder $content gets it's information from and how much can we change that?

Well I (still) don't know the whole answer but I know you can determine quite a bit of that information.

(Remember, I am not talking about STS yet, just osc.)

If you open to your index.php file in (catalog>/includes/languages/english/index.php,
quite near the top you will find (if you have changed nothing yet):

define ('TEXT_MAIN','This is a default set up of osCommerce Online Merchant ....');
By changing the highlighted portion (HTML coding is permissible) between those two single quotes, you can change what appears on your home page. That makes up part of the $content.

But there are other bits as well the osc does for you automatically on the home page .. like the opening header on that page, the "Welcome Guest! Would you like to log yourself in?.." etc., a table of your latest products for the month. Changing the yellow highlighted portion above will not affect those things.

OK. So now we know that even without STS, we can change some of the contents to be displayed on your home page (via changing the yellow highlighted portion in the index.php file as mentioned above. The changes will be between the 'want to log in?..' and the latest products table). Useful to know but really quite a bit troublesome to do. Quite limiting too. For instance, if you wanted to add something to the bottom of the home page, how would you do that? This is when we ask if STS can help us out.

STS Default Module

As we talked about in the STS Default Module article, if you do nothing else but enable it (which is necessary if you are to use STS at all), the HTML template file you would be using to redesign your osc site would be
/(catalog)/includes/sts_templates/test/sts_template.html

And if you were to open the sts_template.html file without any changes, this is pretty much how it first appears (in a WYSIWYG editor)
original sts-template file

But you don't want to use the Default Module's sts_template.html file if you want to custom design your home page. Why? Because the changes you make here will probably affect every page on your site.

So as we touched on in the STS Index Module article, you will want to be using some form of (HTML) index template file. To be more exact, you will need a file that is named index.php_0.html.

Please reread the Index Module article if you have to. Remember that you have to enable the Index Module to use this.

I have also assumed in this article and will carry on with the same assumption that your Working Template folder is
/(catalog)/includes/sts_templates/test/.

Index Module for Home Page

If you do not have such a file as index.php_0.html in the test folder, then go to the full folder in:
/includes/sts_templates/full/

Copy the index.php.html file into the test folder, then rename it to index.php_0.html.

Open this up. It will look almost identical to the sts_template.html templating file used by the Default Module we talked about above. However, with the Index Module enabled, when you upload this file to the corresponding folder at your server end, this file will only affect your Home page.

As with all the other templating files we talked about, you can easily rearrange and customize the look and feel of this file. So go ahead and do that, knowing that this will only affect your home page.

1) If you remove the placeholder variable $content, then the automatic information that osc does for you (like the 'Welcome guest!..', the latest products table, etc.) will also be gone.

2) And if you put any text or HTML above the $content placeholder, then your content will be above the opening header, the"Welcome guest!.." as well. Which might not be what you want. So, replacing the yellow highlighted part in the index.php as we talked about above might still be the way to go for that part (i.e. to change the contents after the opening header and before the New Products table).

However with the template file for the Home page, i.e. the index.php_0.html you can now easily add any content and/or images below the 'automatic' stuff that osc puts in the front page for you. This, I find, can also be very useful.

It really is hard to explain exactly what is going on. The best way to find out exactly what your changes will look like is to try it out. Just remember to make a duplicate copy of each file so that if something goes very pear shaped, you can revert back to the duplicated copy. And remember, you can always turn off (disable) the STS Index module if you don't want to use that anymore. Then the default template will take over (sts_template.html) as before.

General Placeholders

STS 4: General Placeholders list

This list of General placeholders is directly from the STS User Manual, reproduced here for you convenience.
File: /includes/modules/sts_inc/general.php
You do not have to explicitly list or declare this in any of the STS modules' settings. They are available for all scripts.
Placeholder Description
$date The current date
$sid The string for the Session ID in the format "SessionIdVarName=WhateverTheSessionIdIs"
$cataloglogo Shop logo with link to index.php.
Before v4.3: oscommerce.gif in catalog/images folder.
Since v4.3: header_logo.gif, in template folder/images/english (or other language).
$urlcataloglogo The URL used by the $catalog logo
$myaccountlogo The MyAccount graphic and link to account.php .
Before v4.3: header_account.gif in catalog/images folder.
Since v4.3: header_account.gif, in template folder/images/english (or other language)
$urlmyaccountlogo Deprecated in v4.3, use $urlmyaccount instead
$cartlogo The shopping cart graphic and link to shopping_cart.php.
Before v4.3: header_cart.gif in catalog/images folder linking to shopping_cart.php (without SSL).
Since v4.3: header_cart.gif, in template folder/images/english (or other language), linking to the same page (with SSL if present).
$urlcartlogo Deprecated in v4.3, use $urlcartcontents instead
$checkoutlogo The Checkout graphic and link to checkout_shipping.php.
Before v4.3: header_checkout.gif in catalog/images folder.
Since v4.3: header_checkout.gif, in template folder/images/english (or other language).
$urlcheckoutlogo Deprecated in v4.3, use $urlcheckout instead.
$contactlogo Added in v4.3: image header_contact_us.gif, located in template folder/images/english (or other language), and linking to contact_us.php .
$loginofflogo Added in v4.3.
If customer is not logged: displays header_login.gif in template folder/images/english (or other language), linking to login.php.
If customer is logged: displays header_logoff.gif in template folder/images/english (or other language), linking to logoff.php
$breadcrumbs The "Top > Catalog > whatever..." breadcrumbs text and links
$myaccount The text version of "My Account" and link to account.php.
$urlmyaccount The URL used by the MyAccount function
$logoff The Logoff text and link
$urllogoff The URL for the LogOff function
$myaccountlogoff shows "My Account | Logoff" if logged in or "My Account" if not logged in
$cartcontents The text version of the "Cart Contents" function
$urlcartcontents The URL of the shopping_cart.php page, using SSL (if available). Buggy before v4.3 (was same as $cartcontents).
$checkout The text version of the "Check Out" function
$urlcheckout The URL used by the "Check Out" function
$templatepath Deprecated in v4.3, use $templatedir instead.
$templatedir Contains the path to the template folder, without trailing slash.
$headertags New in v4.0.4: The meta tags for the <head> section of the html page. By default contains only the <TITLE> meta tag. This variable is automatically inserted into the $headcontent variable, so you don't need to use it in your template.
Note: This variable can be modified by some modules to allow for other meta tags, for example a module for header tags controller modifies this variable to add description and keywords to the pages
$numrequests The text "1489 requests since Friday 11 August, 2006"
$footer_text The osCommerce copyright information and "Powered By osCommerce" texts.
$banner_only The banner, generally displayed at the bottom of the pages.
$langid New in v4.5.8: This tag allows you to add the language ID to your image link to call an image according to the language selected by the user.

Product Info Placeholders

STS 4: Product Info Placeholders list

This list placeholders is created in includes/modules/sts_inc/product_info.php. This file contains the placeholders (variously called "variables" or "tags") you can use when creating content templates for Product pages. The STS 4 Product Info module must be enable to use this. (see: Product Info module)
This list is directly from the STS User Manual, reproduced here for you convenience. The file product_info.php here is a placeholder file and as with all placeholder files, must be stored in the location noted above.
Placeholder Description
$productid The ID of the product being displayed. Added in v4.0.6 for compatibility with STS v3. Buggy until v4.3. Removed in v4.3SP1, use $productsid instead.
$productsid The ID of the product being displayed. Added in v4.0.6 for compatibility with STS v3. Buggy until v4.3SP1
$startform Required as the first item in the content area. This starts the HTML form needed for adding things to your cart
$endform This should be the last item in the content area. This closes the HTML form needed for adding things to your cart
$regularprice The price of the product, does not care of special prices
$specialprice The special price, empty if not defined
$regularpricestrike Contains "<s>$regularprice</s>" if a specialprice is set, otherwise contains $regularprice (not striked).
$productname The product name
$productmodel The product's model number
$productdesc The product description
$imagesmall The product image scaled down to the thumbnail size specified in your /admin/ tools. Since v4.0.7 it is empty if there is no product image. Use $product_popup if you want to have the popup option.
$imagelarge The product image with no resizing (actual size of image). Since v4.0.7 it is empty if there is no product image.
$product_popup New in v4.0.7: The Javascript with small image and link to popup window. Empty if no product image.
$optionheader The "Available Options:" text above the options, will change with the language. Blank if no options (product attributes)
$optionnames A list of Option (Product Attribute) names, separated by line breaks ("<br>"). Blank if no options
$optionchoices A list of Option (Product Attributes) choices as drop-down boxes, separated by line breaks ("<br>"). Blank if no options
NOTE: As shown in the “/catalog/includes/sts_templates/test/product_info.php_26.html” file, it is recommended that you use an HTML table to layout the options (Product Attributes). In the first column have $optionnames and in the second column have $optionchoices. This will automatically keep the correct names next to the correct choices. Use a table without a border.
$moreinfolabel The language-sensitive value of TEXT_MORE_INFORMATION (for linking to a more detailed page)
$moreinfourl The URL of the page where more information can be found
$productdatelabel Will contain either the Date Added or the Date Available messages, language specific
$productdate The date it will be available or the date it was added
$reviews The text with the number of reviews for the item. Empty if no reviews are available
$reviewsbutton The image for the reviews button
$reviewsurl The URL for the product's reviews
$addtocartbutton The button to send the product into the cart
$alsopurchased The box with products also purchased

User created Placeholders

STS 4: User (created) Placeholders list

This list placeholders is created in includes/modules/sts_inc/user_code.php. It is suggested in the User Manual that you can create your own new placeholders (variously called "variables" or "tags") here in this file.
This list is directly from the STS User Manual, reproduced here for you convenience. The file, as with all placeholder files, must be stored in the location noted above.
Placeholder Description
$catmenu A drop-down list of available categories
$footer Includes $footer_text as well as date and requests counter, inside an html table. To use this variable, uncomment its code. Existing only for compatibility with templates made with STS v2 and v3
$banner The banner inside an html table. To use this variable, uncomment its. Existing only for compatibility with templates made with STS v2 and v3
$cat_CategoryName, $urlcat_CategoryName Links to categories using the category name. Available for each language. Example: $cat_Hardware. To use these variables, uncomment their code.
$cat_CategoryID, $urlcat_CategoryID Links to categories using the category ID. Better use the ID than the name, so changing the category name won't break the link. Example: $cat_2. To use these variables, uncomment their code.
Note about $cat and $urlcat variables: to use them, uncomment their code. Then, if the system does not find any of these variables inside the template, the variables will not be created, thus saving execution time. It is not recommended to use these variables as it is a very slow process!