Category Archives: osCommerce / oscMax

osCommerce and its derivatives. I am working mostly with osCMax these days.

osCmax Slideshow process in a free CSS stylesheet template

The slideshow process in osCmax 2.5 RC1 has had me baffled for a couple of days (well at least the hours that I have had available to look at it during those days).

First up was a bit of redundant code that I flagged in a bug report and then finally getting to grips with the fact that the {slideshow} element in the main_page.code.php file is not in fact the complete deal but just the javascript bit and that the page modules section {modulecontroller} also needs to be called from the html page.

Once I danced around all of this to gain an understanding of how to get the slideshow working in the main index page, I then faced the admin console for the slideshow.

Annoyance #1 is that the slideshow images page includes a short cut to the slideshow settings page but the slideshow settings page has no corresponding return button requiring a 4 step menu traverse which is painful particularly with a glidepad and no mouse. But due to the hard coded construct of the configuration process for editing admin items it is a major task to change the system to fix this annoyance. Another day.

For future reference:

  • the main settings page in the admin is controlled / presented via the configuration.php file
  • the index code for the file makes it difficult for link backs
  • the file permissions process will need to be allowed for
  • the current menu process on the left and the edit process on the right might need to change
  • some of the showcase js script options are not offered in the slideshow settings

There was no second annoyance just a desire to recreate the slideshow elements that the FreeCSS_Sky stylesheet had included. The FreeCSS_Sky stylesheet template included not just an image slide but associated text. I think this is a great option and in order to adapt osCmax to replicate this I needed to add an option to the database and the slideshow tools to cater for the text object.

The process will need to include:

  • add the extra database fields to the slideshow table and the configuration table
  • modify the javascript populating file slideshow.js.php to read the fields
  • modify slideshow.php to present the fields in the admin
  • modify the javascript that actually does the work to present the new data

But this is for another day.

Errors in using Blueprint CSS or Templates that use it in osCmax

While installing a copy of a template using the Blueprint framework to a fresh install of osCmax as a test I had this error.

[text]
Error: bts_select()! No template selected for template type: anyfile
[/text]

This indicates that the bts_select function is not recognising the ‘anyfile’ flag.

The ‘anyfile’ flag is one that was added for the themes that use the StyleSheetLoader and similar options.

The change to fix this is made in the application_top.php file and it is to redirect the core system to use the modified configure_bts.php file in the template directory.

Reference Step #6 in this post on installing the Blueprint CSS Framework to osCmax.

Converting a Free CSS Stylesheet for osCmax store Part 5

Almost done! The next piece of the puzzle is the side box control and for that I’ll delve into the column scripts, stylesheets, and side box presentation.

This is being done with the CSS template FreeCSS_Sky from http://www.templatebasics.com/freecss_sky/. From the earlier posts the last piece is to setup the presentation of side boxes for osCmax.

Starting with the default files that present columns there are two files:

[text]
/catalog/includes/column_left.php
/catalog/includes/column_right.php
[/text]

The first thing is to copy these to the templates/freecss_sky/includes directory. This allows for some changes to be made without impacting the core files.

Starting with column_left.php, although column_right.php will tend to be identical except for the query. The database is checked for boxes set by the admin for display. I’ll look at that in a minute. Then the column is matched as left and active. The script then looks for the boxes in the core files.

[php]
if ( ($column[‘cfgvalue’] == ‘yes’) && ($column[‘cfgcol’] == ‘left’)) {
if ( file_exists(DIR_WS_BOXES . $column[‘cfgtitle’] . ‘.php’) ) {
require(DIR_WS_BOXES . $column[‘cfgtitle’] . ‘.php’);
}
}
[/php]

But I want it to check the template for template based formatting etc. So I added two lines and modified the third to the following:

[php highlight=”3,4,5″]
if ( ($column[cfgvalue] == ‘yes’) && ($column[cfgcol] == ‘left’)) {
define($column[‘cfgkey’],$column[‘box_heading’]);
if ( file_exists(DIR_WS_TEMPLATES . ‘includes/boxes/’ . $column[‘cfgtitle’] . ‘.php’) ) {
require(DIR_WS_TEMPLATES . ‘includes/boxes/’ . $column[‘cfgtitle’] . ‘.php’);
} else if ( file_exists(DIR_WS_BOXES . $column[‘cfgtitle’] . ‘.php’) ) {
require(DIR_WS_BOXES . $column[‘cfgtitle’] . ‘.php’);
}
}
[/php]

This is simply going to check in the includes/boxes in the template for a box script first. Once this edit is done the box scripts that we need can be copied to the templates/freecss_sky/includes/boxes directory.

So as an example categories.php is the first box that is presented in the left column. Note that if there are no store categories then it will be empty. Create some store categories to see what is going to change.

The main issue is that the boxes are still using table controls for layout. It would be better for presentation and to broaden the control options via css to remove the tables and replace them with appropriate div controls. However, that is something that can be done later. For this design the side boxes should work as is.

To set any css styles specific to the categories box create a categoriesBox.css file in the template stylesheets directory. A request to load the categoriesBox.css stylesheet using the stylesheetloader script is done in the modified configure_bts.php script.

All things being completed a review of the pages now should reveal a working home page, contact page, and articles page with the categories box now presenting with some changes to the format or layout. Modify the categoriesBox.css to give a red border or green background just to validate that it is all working. From here we tweak the css for the categories box and copy all the other relevant boxes scripts adding the appropriate css file load as above. Just change the names to be consistent for each box.

Move along to the column_right.php file and repeat for all it’s boxes.

The FreeCSS_Sky template is almost ready for release. The last piece is to setup the home page to not use the static, supplied images, but to make the home page recognise the osCmax boxes in much the same way as the articles page was done in this post.

But that is a topic for another day…..

Converting a Free CSS Stylesheet for osCmax store Part 4

The fourth installment in this exercise to convert a Free CSS website template to a working osCmax v 2.5

The first step here is to setup an articles page layout which is different to the main page. In the articles I want to see links to more articles, search and info on the left and promotional boxes on the right with article content in the centre. This is a typical 3-column .css layout and suits e-commerce presentation. But the FreeCSS_Sky template is not like this so some ground work is required.

In part 3 of this exercise I created the Contact page relying on the main_page.html and main_page.code.php to create the framework and the contact_us.tpl.php for the body. The Contact Us page is a two column presentation and works as it is all about the potential client contacting the business. The side by side presentation means that page is mostly above-the-fold and easy to use as a result.

In this case the articles will include, perhaps, lengthy pieces that talk about products and services. Making this more like a newspaper columnar layout with related information to either side works.

Using the Blueprint CSS Framework makes the column layouts relatively simple.

After copying the main_page.html and main_page.code.php as article_info_page.html and article_info_page.code.php respectively, open the article_info_page.html and edit the content section.

[xml]
<!– content begins –>
<div id="content">{content}</div>
<!– content ends –>
[/xml]

In the main_page.html layout we are presenting a single column section layout. So there is only one div section for content.

To make this a multi column layout we need to add new div’s:

[xml]
<!– content begins –>
<div class="span-4">
<div id="leftcolumn">
{columnleft}
</div>
</div>
<div class="span-12">
<div id="maincontent">
{content}
</div>
</div>
<div class="span-6 last">
<div id="rightcolumn">
{columnright}
</div>
</div>
<!– content ends –>
[/xml]

The column names are obvious from the div id’s. The div that wraps around each column is the Blueprint CSS framework that helps us by controlling the left to right presentation and ensuring consistency between the differing browser interpretations of the box model.

Setting the columns is pretty easy. A class=”span-x” refers to the number of Blueprint column widths to use for each column. The right most column also gets a class of ‘last’ to correctly set the right hand offsets. Adding the total of the ‘x’ value for the columns to a maximum of 24 provides a 950 pixel wide presentation layer. In my combination 3 columns varying at 4, 14 and 6 Blueprint column widths in 40 pixel increments. (24 x 40 pixel – 10 pixels = 950) Noting that in Blueprint column 1 is only 30 pixels to give a total of 950.

To vary the column widths simply modify the x value of the div class span-x for each of the 3 columns to achieve the same total x = 24 value. Having said that the FreeCSS_Sky template is only working with a max of Blueprint column value = 22. Not sure why but I’ll deal with that when I do some wireframe examples, but I expect there is a css style limiting width to less than 950 pixels somewhere within the FreeCSS_Sky template.

Now all of the above is fine except that if you are using a new database for osCmax you need to create some articles to work with. Do this in the admin console under Articles. Add an author first and then at least one topic and an article for each. Fill the text with anything you like just to sort the presentation out. The editing of appropriate content can come later. Add 3 articles.

Next test the pages. If you are following my setup then the original page layout and menu structure points the 3 top menu items of Blog, Gallery, and About to articles 1, 2, & 3.

The layout should be working with a left and right outer narrow column and the article text in the middle. The outer columns assume the default box settings from the admin console and will be a dog’s breakfast of styles. But the layout works and that was the goal.

At this stage the template FreeCSS_Sky is working and presents a unique home page layout, provides for pages like the Contact Us page to be presented using the main_page controls, and the Articles section presents a neat 3 column layout. All in a consistent framework that presents in Internet Explorer v9 and Firefox and Chrome browsers. In theory it should also work with earlier IE versions but I dont have them to test with.

The last piece of the puzzle is the side box control and for that I’ll delve into the stylesheets, box presentation and the admin console that is needed to manage the presentation.