Variable Columns Using osCommerce BTS Templates

Posted on April 20, 2007
Filed Under Design |

Beautiful osCommerce Templates are readily available if beauty is in fact in the eyes of the beholder. Part of beautiful template design has a great deal to do with features of the design as well. I’m a firm believer that the look of a site means more in terms of how its perceived than any other facet with the exception being that of frequently updated quality content.

When you want two columns here and three there, what next.
One thing that has kept truly interesting and beautiful template designs from being drop in turn key solutions with oscommerce is largely due to the hard coding requirements for templates. BTS and STS are two attempts to provide a pseudo template structure that makes ease of templating sCommerce and its offshoot flavors like osCMax or CRE Loaded easier to template.

Of the two template options I chose BTS in part because end users would find that its not intimidating to alter the look on their own with relatively minimal knowledge about HTML. BTS however has this nasty little deficiency that keeps commercial designers like me, hard coding all templates and will likely keep it the norm in nearly all one up designs. The deficiency with BTS/STS is the lack of variable column features wherein you can change from page to page. Before you say big deal and who gives a rip, let me explain further.

With BTS you either get two columns or more columns consistently throughout your catalog regardless of page based on your design master layout. So when viewing for example products in the detailed view or maybe your privacy statement for example you would always have the same structure and layout throughout your site making some things a bit quirky and cramped. In nearly all my oscommerce and or oscmax designs I use variable templates with some pages having only two columns while others having three or more. The method in my commercial designs has been to do like every other designer and hard code which pages I want to have three columns and which I want to have two. With BTS there really isn’t that option until I came up with a simple way to design that flexibility into future work to vary depending on need.

So how do you control which pages use two columns and which use three?

Well the method is quite simple actually. In fact the code is so simple you don’t need to modify any core files at all in the BTS system or oscommerce at all. I came up with the solution after writing a chunk of PHP code to vary when a flash header would show based on the URL. If for example it was index.php then show the flash header otherwise show the header graphic. This was my solution for a client that purchased a Template Monster Monstrosity (notorious for very bad code) to reduce the bandwidth loads on the server and to prevent that annoying sound in the flash file from announcing itself every time you visit all subsequent pages. You can see the template monster template and the effect at http://www.carzilla.com which we applied to his automotive site for him.

The idea was to simply expand that using BTS template variables already being parsed by oscommerce or oscmax for example and create a single php file that allowed you to determine which template gets what layout. The nice thing about using this method is that you can set the default layout for the entire site as I have done on many occasions. In many of my oscommerce designs I have most of the site laid out as a two column structure which provides ample space for product details and other things like larger images. But in places I need to have three columns for additional “Blocks” and or navigation, advertising, specials and so on, I can specify which pages display that third column. Nice! A real time saver and so easy to modify and un-necessary to alter core code that a one armed monkey could do it.

I’m going to wrap up my day here at work before I zip up and publish a documented BTS template example for oscommerce and oscmax. If you are in desperate need of this solution you can simply send me an email. After you download the file you are free to remove the comments that refer to “Template Design Kit v1.8″ and put your own details because a different fully featured version of this will be included in the Template Design Kit when I release it.

UPDATED April 20th 2007
Mike at osCMax pointed out the following;

I have seen this type of variable page display type done before with BTS and it did not require very much coding. It was a matter of creating several main_page.tpl.php pages such as main_page_2col.tpl.php and main_page1col.tpl.php and then simply calling the different main template from the actual php file.

Say you want 1 column on your product page, but 2 on your listing page, you would simply change the main template call in the product_info.php page to use the 1 column layout etc. I have oversimplified the total process, but it is not very complicated since all the parts are already there and working.

The method Mike mentions requires each template to be edited that the change in layout dictates. Yet another viable method I’m going to eventually try out.

Comments

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

1 Comment so far
  1. Matt August 11, 2007 9:11 am

    Hi - Mikes method looks like what I have been searching for, but I can’t figure out how to do it after staring at the code for a while. Have you got that method working? Otherwise can you send your “one armed monkey” method?
    Thanks!


TEMP CODE: GDHXCDX17249629
Close
E-mail It