Shopping Cart Reviews SHOPPING CART REVIEW
   
  HOME REVIEWS NEWS FORUM ABOUT US RESOURCES SUBMIT ARTICLES SUBMIT A CART
 
Understanding osCommerce - Adding a Field Part 1
A question I see asked from time to time in the osCommerce support forums is "how do I add a field to the products table?" That's a question that requires an answer a bit more involved than what can normally be provided in a forum post, so I thought I give a little tutorial on the process. There is quite a bit to cover so I am going to dispense with my normal mode and extend this one this one over several articles. As with most things its a little easier to grasp in smaller bites.

If you really want to know the truth, doing things like modifying the database or other such more "involved" changes is where the real satisfaction working with osCommerce comes in. In my mind it goes over and above making cosmetic changes and installing contributions. It's something where you can stand back when finished and have a sense of satisfaction that you have created something that is truly yours. Speaking of contributions, if you come up with something valuable you have the opportunity to support the community by sharing your work if you wish.

All of the things we will talk about here can be applied across the board for other things you might find yourself wanting to do with the system. I'll also share with you some of my lessons learned, so hopefully you might avoid some of the mistakes I've made as I too learned the system. One I'll share with you right off the bat. When I first started working with osCommerce I was mostly concerned with making it work and function the way I wanted. I didn't pay a lot of attention to the standards and structure of the application. That was ok from the sense that I accomplished my goals, however later on down the line, that get it done, make it work attitude came back to bite me. So we'll concentrate on doing things the osCommerce way.

Necessity is the mother of invention, so there of course needs to be a reason we want to add a field to the products table. Lets take a step back in time and talk about the need before we get into the solution. Suppose on our e-commerce web site, we are marketing original music. Since the music is original, our site's visitors are not going to be familiar with the product we have to offer. If we happened to be marketing hard goods, we can give our potential customers a taste of the product by displaying a picture. However with music a picture is not going to quite cut it. We need to give them a sample, a short edit of each song should do the trick and hopefully entice them to buy.

Browsing the new product input form we see fields for name, price, description, image, price, etc, however there isn't a field for "sample file", so we'll have to create one for our music store. Doing so is going to give us the opportunity to dig into the osCommerce source code. The job will require some effort an and hour or two of time, but its certainly an achievable goal.

The task of adding a field for our store's products will be accomplished in three distinct step. First we'll need to modify the database table by adding the new field. Second we'll work on the input form, adding the display of the new field and handling the code which will save the new field to the database. We'll also need to ensure the functionality works so that we can go back later and edit the new field when we need to. The last step will be to display the new field on the product listings page.

Now we have a plan in place, in part 2 we'll jump in with our DBA hat on and start making some database changes.

Happy Coding.
Understanding osCommerce - Contributions
While osCommerce straight out of the box comes as a working shopping cart application, seldom will you ever see a production site using a completely stock version of the e-commerce application. In previous articles, we've talked a little bit about making some cosmetic changes. Today we are going to talk about functionality.

If I had to name the best feature of osCommerce, I would say without a doubt my answer would be that it is open source software. The fact that it is open source enables and environment where anyone is free to modify or enhance the software anyway they like. osCommerce benefits from a very large and active community, who not only participate by offering their help and advice, but also in the sharing of their work. In the osCommerce community this sharing of work are know as Contributions.

As I write this article there are over 3100 contributions available for free download on the osCommerce Contributions page. The available contributions cover nearly every feature one could imagine for an e-commerce web site. Quite frequently in the support forums, the answer to the question "can osCommerce do.......?" is check the contributions. There are contributions that cover everything from payment and shipping modules to template systems. I have to admit that one of my guilty pleasures is to browse the contributions looking at all the interesting and fun tidbits that can be added to a shopping cart. Everyone needs extra toys to play with, right? And while some might fall into that fun nice to have category, even more so contributions are there to fulfill valuable business needs.

Some of the more popular contributions are:

Credit Class & Gift Voucher - Enables a store owner to offer discount coupons and to make available gift cards for purchase.

Header Tags Controller - Enhances the SEO of your e-commerce web site by dynamically modifying the page title, description, and keywords so that they relate to the products being displayed on the particular page.

Simple Template System - Provides the ability to design the layout and visual design of your site through the use of HTML templates.

Pay with an Account - In the base install of osCommerce, the stores customer must create an account before she is allowed to check out. Pay without an Account allows your customers to complete a transaction without having to go through the registration process.

Installing a contribution can be a little confusing at first, however its not overly difficult with a little advanced knowledge of what to look for. Following the link to a contribution's page, its very common to find a list of downloads for the contribution. This happens for two reasons, one being either the original developer or others may discover and correct bugs in the contribution. Secondly further enhancements are frequently made to a contribution to the degree they often are listed with version numbers.

Generally speaking you would want to download the top listed file. However be aware that occasionally someone will fix a bug or make a small enhancement and only upload the files which were modified. In that case you would need to scan the list and find the latest full package, download it as well as everything that appears above it on the list. There is no doubt this can be a hassle at times, unfortunately its just the way it goes.

Once you have the file or files downloaded and unzipped, its very important to start by reading the "Read Me" file. This will generally give you the information you need to successfully install the contribution. In the case of having to download one or more small update files, the read me file will normally explain how to apply that fix to the full package.

The files for the contribution will normally be delivered in a directory format that follows that of the complete osCommerce package. If the update requires any database mods, there will usually be a *.sql file for that purpose. This sql file can normally be run in the query interface within the phpMyAdmin interface on your web host. Then its usually just a matter of modifying existing or uploading the packaged files to your web site, its normally the former and I'll explain.

The "Read Me" file will normally contain instructions for installing on a "clean install" and for a non clean install. A clean install, is an instance of osCommerce that has not had any changes applied to it, in other words straight out of the box, except for changes that might have been performed in the Admin Configuration tool. Once you have made any changes to your shopping cart, or applied any contributions you no longer have a clean install. That is important to know, because the instructions for installing a contribution on a clean install normally involve uploading the files in the package as they are. Doing so however over writes the existing files on the site. If you've made any previous changes to those files, the changes will be lost.

The installation for a non clean install is a little more involved and can at times be tedious. However don't be scared off, due to generally great documentation most people are able to perform the changes correctly. In most cases you can employ copy and paste from the new files to the existing ones. Most contributors will provide examples of existing code and line numbers to make it easier to find the correct locations to make the changes. The new code will also frequently comment the blocks of code being added to make it easier to identify the changes down the road.

The most important things to remember about applying a contribution are first to ALWAYS make a backup of any files before you change them. As a matter of good practice its a good idea to keep a complete backup of your osCommerce files away from your work environment. Its also important to take things easily and under control, don't rush through. If after you have completed the install of a contribution and it doesn't work right or you receive errors, take a deep breath and carefully retrace your steps to find the source of the error. Its not uncommon to have a misplaced comma or apostrophe. It can be difficult to debug when you are stressed out, but can be like a treasure hunt when you're relaxed.

One thing more while I'm thinking about it. It's important to not put yourself into a stressful situation when it might not be necessary. Don't try to install a major contribution the night before you "have to" go live. Give yourself plenty of time to design your site, especially if you haven't worked with osCommerce before. All too frequently I see posts in the support forum from people who are desperate for help because they need to make a deadline. Most of the time they are simply struggling just to get their feet under them. Take the time to learn and understand the system, and feel comfortable with it before you make promises. Its a great system and I believe most people can learn how to modify and manage it, just takes a little time and a little experience under your belt.

Happy Coding!

New Web Design for AgoraCart.com Underway
A new look for AgoraCart's website, AgoraCart.com, is under way. After reviewing useability of the site for new visitors, many changes were put into development to improve the navigation of AgoraCart.com.

Changes include CSS attributes that fill a visitors screen no matter what size of monitor or resolution they use, a new header at the top, and a new menu system on the left side navigation bars.

Changes will take several week as the complete site is converted to the new design, as well as the performing of updates to much of the content to ensure it is all up to date. The online manual areas will be updated after the release of a production distribution of AgoraCart version 5.0.0

As a result, users should be able to navigate and find where they wish to go more easily and not be overwhelmed by the massive number of links, especially on the left side of the site.
Understanding osCommerce - Cascade Style Sheets
As with most complex web applications, osCommerce uses a style sheet to define much of the visual presentation of the pages within the system. Cascade style sheets (CSS) are the prefered manner for applying styles because all the style definitions are stored in a central location and therefore can be applied to multiple HTML files. Its also common to find what are know as inline styles, where the style is defined within the HTML tag:

<TD style="background:#FFFFFF">


They can also be found in the <HEAD> section of an HTML file between <style></style> tags. Although both of those methods require applying styles on a more individual basis. Hence, style sheets do save a lot of typing as well as helping to standardize the over all look and theme of a web site.

The style sheet for osCommerce is named stylesheet.css and found in the root folder of the osCommerce installation. For the purposes of osCommerce, style definitions come in three different flavors, Tag Styles, Class Styles, and Class Styles that are tied to a tag. These are three examples from the style sheet in respective order:

A {
color: #000000;
text-decoration: none;
}

.boxText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }

TR.header {
background: #ffffff;
}


I purposely left the formatting of these examples the same as they are found in the style sheet to make it easier to follow along and identify, however it also serves to explain point. That is that line returns or any other sort of "white space" in style sheet code is ignored. So you can have all the styles on a single line or multiple lines, and even blank lines in between. The only important thing to remember is that the individual styles need to end with a semicolon.

Ok now back to the lesson at hand. The first example "A" is a Tag Style, meaning this style will apply to every "A" tag on the page.

The second example ".boxText" is a class style. We know its a class style because it begins with a "." (dot). Class styles can generally be applied to any tag within the page and the syntax looks like this"

<TD class="boxText">


This code tells the browser to display this particular TD with the styles found in ".boxText". Notice in the tag's "class=" part that there is no "." (dot) before the word "boxText".

The third example "TR.header" is a class style that is tied to a tag, in this case "TR" This means the style can only be used with "TR" tags, but it is still coded the same way as any class style:

<TR class="header">


Now when working with style sheets, that someone else has created, some times things can get a little confusing and frustrating, that can be especially true with osCommerce. When you find yourself wanting or needing to make a visual change, I've found a technique that works fairly well. That is to load the page in question into your browser and then do a view source. By doing so you are looking at the HTML code which has been rendered to your browser without the PHP code in the way. The view source will not always be formatted for easy reading, in fact it can still be somewhat difficult to read, so it takes a little patients to find what you are looking for. Lets use an example to more fully explain how the process works.

This is taken from the main default osCommerce page:



Lets assume that we want to change the text that says "What's New Here?", so that the text is black instead of that gray color. At this point we really don't know what it is that we need to change in the code. So with the page open in a browser, click on the "view" menu, and the "source". The HTML source code for the page opens up in Notepad. We could now scan the code looking for "What's new" but an easier way is to just do a search. Doing so we find this code:

<td class="pageHeading">What's New Here?</td>


We are concerned with the tags that surround the text, "What's New Here?", and there we see a TD tag which is using the class "pageHeading". So now we know that the formatting for the text is defined in a style class called "pageHeading". Now lets go back to the style sheet and see what we can find.

Doing a search on the file for the word "pageHeading" leads us to the following code:

TD.pageHeading, DIV.pageHeading {
font-family: Verdana, Arial, sans-serif;
font-size: 20px;
font-weight: bold;
color: #9a9a9a;
}


Something interesting about this particular style definition. We know from our previous discussion this is a class definition that is tied to a tag, but its a little different, it has two tags its tied to, TD and DIV. Any changes that we make here are going to effect all TD and DIV tags that have the pageHeading class. We could approach this two ways. One would be to separate this into two different definitions or we can leave them together. However its reasonable to assume that these tags were left together for a reason, so we'll go ahead and leave them that way.

The syntax for a style definition is: property:value; The properties themselves are fairly easy to understand. Here we are defining the font "Verdana", font size "20px", font weight "bold", and color "#9a9a9a". Color is the property we are interested in changing, so lets take a closer look there. In a style sheet colors can be defined two ways. The first is to use the English word, such are red, blue, black, etc. The second and more preferred way is to use the Hex value for the color. The Hex value is preferred because there are more options available. There is nothing that says you cannot mix the two, however the code is more uniform and follows a standard if you use one or the other.

In Hex color codes, #FFFFFF translates to white and #000000 translates to black. Every other color is something in between. I'm not going to get into how the Hex values work here, but there is plenty of information available on the web concerning the subject as well as color charts.

We want to change the color of the text to black, so we change that particular line of code to look like this:

color: #000000;


All that's left to do is safe the style sheet and upload it to your web server. Now if we go back and refresh the page we find that "What's New Here?" now appears in black, just that easy.

Obviously this was a fairly simple example, there are many others that would be more complex. However the principles all remain the same. The important thing is to take your time, and make small changes at a time. And as always be sure you make a backup of any files you are changing so you always have something to fall back on.

Happy coding.
Dynamic & Customizeable Templates
It's been a long while since I last reported any progress on AgoraCart version 5.0.0 development; mainly due tothe fact I was sick for about 2 weeks.

So, I'm happy to report that I have now completed the new templates and button sets. Now store admin can select a preconfigured template or one that they have uploaded to a custom template directory. Then they can select a button set. This is all designed as drop-in and play so that the template manager will find the new templates and button sets in real time the next time it's reloaded and/or accessed after the items have been uploaded to the appropriate store directories.

The custom layouts and headers still work and if needed, are placed in the original directory so they can be found for each product category that one desires to have a custom header/footer style for.

This also ties into the new CSS manager, where the style sheet for the template can be edited within that manager.

Another detail is that the new templates, appropriately named "TheAgora", are CSS & HTML 4.01 compliant.

This new system also allows designers to submit buttonsets and header/footer templates to the AgoraCart community that will be easy to implement for most folks that can atleast use FTP in some form or another. Another version will come soon that will allow a tarball to be uploaded and installed via a manager interface.

We'll also be attempting to create a few more templates / themes before final release of version 5.0.0

Well, that be the news fer now...

Until next time,

Mister Ed
Understanding osCommerce - Protecting the Admin Area
Ok so you have osCommerce installed and you're starting to poke around the admin area, looking at all of the available features and controls, making some of your initial global configurations. And suddenly it hits you, "wait a minute, I didn't have to log in to get here?!".

That's right you didn't. While many if not most open source web applications will provide some sort of 'admin' account and the functionality to create an ID and password, fresh out of the box osCommerce does not. So you are probably asking yourself, "how can I leave my admin area wide open? That's a obvious security hole". You're not alone, that is one of the most frequently asked questions in the osCommerce support forums.

For whatever reason the core developers of osCommerce chose not to provide built in security for the admin area. It doesn't take a genius to figure out that some sort of security is required. Fortunately the solution is usually fairly simple to implement and reasonably secure, that is to use a .htaccess file. Now let me quickly note this applies to Linux/Unix Apache based systems. If you are using a Windows server, the security is configured through the folder properties etc. The majority of osCommerce implementations are on Linux hosts, so that's what I'm going to talk about here.

The .htaccess file is a plain text file that provides the ability to configure not only security but also things such as search friendly URL's. For those interested a more indepth discussion of .htaccess can be found here.

The .htaccess file uses a separate file which stores the password for an account in an encrypted format. There are some command line and other utilities for setting up folder protection using .htaccess, however for the most part you should generally not have to rely on those. Most web hosts will provide within the control panels some functionality to password protect folders. Behind the scenes this will set the .htaccess and the password files for you. If your host uses Cpanel, go to the applet titled "Password Protect Directories", drill down to the folder you wish to protect, add an account and password, and you are all set.

If you have trouble with this, your hosting package doesn't make password protecting directories readily available, contact them for help. I've seen far too often people having problems and posting questions that their web host would actually be the best equipped to help with. Your web hosting company should be your friend and should provide you with timely help. If they aren't, get another one I highly recommend Host Dime. I've used them for three years and they provide excellent service at a reasonable price.

Another important thing to know when you are password protecting a folder, you only have to set a password on the top level folder, i.e. catalog/admin. All the folders underneath are then protected, so you don't have to apply a password to each of the sub folders under admin.

In addition to going directly and setting up .htaccess on your web there are also some contributions available, Administration Access Level Accounts is one for example. I've never used any of those particular contributions myself, but if you want to go that route I suggest browsing the contributions area of the osCommerce site.

Happy Coding
Understanding osCommerce - Language Files
Previously we talked about some files which are included in most pages of the osCommerce system, header.php, column_left.php, column_right.php, and footer.php. All four of these files deal directly with the visual appearance of osCommerce. There are some other files which are also included in each page with in the system. application_top.php and application_bottom.php are two of these files. application_top.php is basically the bootstrap include for each page. It contains calls to connect to the database, constant definitions, etc. And application_bottom.php serves as a clean up file for the page.

There is also another file included, the language file, and that's what I'm going to center this discussion on today. The architecture of osCommerce provides support provides for localization through the use of language files. Out of the box, the default installation of osCommerce provides support for three languages, English, German, and Spanish. It is through the use of these language files that the system is able to dynamically adjust to the chosen language of a visitor to your cart. For example if a user to your cart modifies their personal language setting to German the labels, buttons, and other text on the pages of your cart will appear in German. Same thing for a user choosing English or Spanish, through some available osCommerce contributions or simply by doing it yourself other languages can also be added by following the existing model.

If you look at the code for a visual page, somewhere near the top you'll find a line of code that looks similar to this:

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


Of course we can expect that DIR_WS_LANGUAGES is a defined constant for the 'languages' folder and that assumption would be correct, this folder can be found within the 'includes' folder. '$language' is a PHP variable, if you are new to PHP variables always begin with the '$' character, its value is the language chosen by visitor to your cart, i.e. English. FILENAME_CREATE_ACCOUNT is a defined constant, file name constants are defined in the filename.php file which is also found in the 'includes' folder. In this specific example FILENAME_CREATE_ACCOUNT is defined as create_account.php. So when your web server reads this file it sees:

require(languages/english/create_account.php);


So now lets go back and take a look at the languages folder. Inside we see three files english.php, german.php, and espanol.php. We also see three folders with similar names, English, German, and Espanol. What I am going to explain here applies equally to all three default languages, but for the sake of simplicity I'm going to refer to English.

The english.php file is a general purpose language file. Meaning that it contains language definitions which are applied across all pages. Let's take another look at some example code:

define('HEADER_TITLE_TOP', 'Top');


This is taken from the english.php file and defines the word 'Top' which appears at the far left of the breadcrumbs trail on the navigation bar. I specifically used this example because it appears on every page of an osCommerce cart and because it's frequently a piece of text that site owners want to change when they start customizing things. So lets say rather than 'Top' we wanted it to say 'Home', we would just simply modify the code to look like this:

define('HEADER_TITLE_TOP', 'Home');


Rather than 'Top' in the breadcrumbs trail, 'Home' would appear on every page of the cart. As developers we always want to be able to make changes in a single location and have the change appear everywhere it's used. english.php accomplishes this goal for words that are used in multiple pages within the cart.

Now an osCommerce shopping cart is made up with a few dozen visual pages, most with text and several labels. In theory we could include all of those definitions within the english.php file, after all it is available to every page in the cart. However if we were to do so the english.php file would grow rather large. Performance would be impacted not to mention it would become fairly difficult to manage. So to address that issue the architecture of osCommerce uses language files which are specific to the individual pages in the cart.

Lets take a look inside the 'languages/english' folder. Inside we find a list of files that basically mirror the file names from the root folder of the osCommerce cart. It makes it all fairly easy to follow because the language file has the same name as the visual file, it's just in a different location. Browsing the list of files we can find create_account.php from our example above. Inside this create_account.php file we will find the English translations of the labels and text that are specific to the 'Create Account' page.

So lets do a practical example. After you have done a default installation of osCommerce, you have this working shopping cart. But right in the middle of your home page is some text along the lines of 'Congratulations your installation of osCommerce was successful......" Obviously this is one of the first things we want to change for our new cart. Since the main page of our cart is index.php we are going to go looking for the language file at includes/language/english/index.php. Lucky for me and this example the file is there where I would expect to find it.

Before we open up the language file, lets take a look at the code for the main page, the index.php file which resides in the root folder. Inside this file there is a lot of code dealing with displaying new products, etc. But if we scroll down almost to the bottom of the page we find this section of code:

<td class="main"><?php echo tep_customer_greeting(); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_MAIN; ?></td>


Now the first line that says
'<?php echo tep_customer_greeting(); ?>'
That calls a function to display the customer greeting, 'Welcome Guest would you like to log yourself in?....' We're not going to cover that at this time, but I wanted to point that out to avoid confusion. What we are looking for here in the last line in the example:

<td class="main"><?php echo TEXT_MAIN; ?></td>


This is where the larger body of the main page text is coming from. Its saying to echo or print to the screen the value of the constant 'TEXT_MAIN'. Ok so now we know what to look for, we can go ahead and open up includes/language/english/index.php. The first define statement in the file looks something like this (It's rather long so I've shortened it for this example):

define('TEXT_MAIN', 'This is a default setup of the osCommerce project, products shown are for demonstrational purposes, <b>any products purchased will not be delivered nor will the customer be billed</b>. Any information seen on these products is to be treated as fictional.........');


You'll likely want to be more creative, but for the sake of example lets assume you want to change the text to read 'You have arrived at my new store'. You probably have the hang of it by now and you should as the change is simple:

define('TEXT_MAIN', 'You have arrived at my new store');


Save the file and upload and you're done, well almost. If your intentions are to keep your site multilingual, you also need to make the corresponding changes in the includes/languages/german/index.php and includes/languages/espanol/index.php files. with the proper translations for those languages.

Finally there is one other thing that falls outside the rule for language files and that is 'buttons'. If we go back to the 'includes/language/english' folder, we can see a sub folder there named 'images' inside the 'images' folder we can find a 'buttons' folder. The whole path goes like this, 'includes/languages/english/images/buttons'. This is where all of the button images are stored which are used for the osCommerce cart. Since the buttons display text, those too are displayed in the selected language. For example button_continue.gif in this folder is the button which displays 'Continue' in English. To make modifications here you'll need to open up Photoshop or another graphics editor, which is beyond the scope of this article but perhaps something we will tackle in the future.

Happy coding!
Understanding osCommerce - Basic Customization
This is the first in what I plan to be an ongoing series of articles concerning osCommerce and its architecture. We will start out with some basics and eventually get into some more complex issues as the series progresses. To get the most value out of these articles, its going to help a great deal if you have at least a basic understanding of HTML, PHP, and Cascade Style Sheets (CSS).

When you look at osCommerce as a whole, it can be rather daunting. The system is extremely robust, but with that comes some complexity. However with many things large and complex if you begin by breaking them into little bits, trying not to chew too much at one time, it all becomes a lot easier to digest.

The great majority of osCommerce installations start with the basic default package. Whether you uploaded it yourself and followed the included installation routine or it came from your web hosting though Fantastico or some other means, you start out looking at a 'default' osCommerce installation. At that point right out of the box you have a working shopping cart. Now its time to start putting your customizations to your new shopping cart, to start making it your own. In order to perform those customizations you need to start gaining an understanding of how things are put together, so lets start there.

If you were to examine the code within the pages that make up the system, you would find that every visual page contains several common parts. Speaking specifically about the visual parts, there are four external files with are 'included' into each visual page, these are header.php , column_left.php, column_right.php, and footer.php. In each visual page within osCommerce there is one master table that holds everything which in a nutshell looks like this image:

osCommerce Page Layout

The file names themselves are fairly self documenting. The header.php contains the main logo or graphic that appears on the top of each page. The column_left.php and column_right.php each contain the various utility boxes such as shopping cart, reviews, best sellers, new products, etc. And the footer.php contains the copyright notice. Finally the center of the table, the 'body content' is defined within the individual page.

Now there is a little more to it because each of these files can in turn also include other files to help define them, though essentially if you want to change the appearance of an area of the your cart the corresponding file which defines that area of the page is where you will begin to work. Remember because all four of these files are included in each page of the cart, when you make a change to any one of them, you change the appearance of every page in your cart.

So lets wrap this up with a practical example. One of the first things anyone wants to do with a default installation of osCommerce is change the banner at the top of the page. Now we know that because the banner appears at the top of the page we want to take a look at header.php.

As with all four of these files we will find header.php in the includes folder. Opening up the file we find the following code at around line 57:

<td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?></td>


The part of this we want to pay particular attention to is:

tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce')


tep_image is an osCommerce function which renders an HTML image tag. The function takes two parameters, the image file name and the image 'alt' text. The 'DIR_WS_IMAGES' is a defined constant which refers to the images folder. So translating that the first parameter in this case is actually images/oscommerce.gif . The second parameter, the 'alt' is 'osCommerce', this is the text that will show up in the balloon when a user holds their mouse cursor over the image.

Lets assume that you have a logo image for your store which is named mystore.gif. Swapping out the logo images is a fairly simple process. First you would upload mystore.gif to the images folder. Secondly you would edit the code by changing oscommerce.gif to mystore.gif. And finally change 'osCommerce' to your store name or something else appropriate. Save and upload the file and you are done.

A couple of notes to keep in mind:

The dimensions of oscommerce.gif 204 pixels wide by 50 pixels tall. If the dimensions of your logo differ it will effect the appearance. Sometimes it won't matter other times it will and you might have to experiment. In the future we will talk about changing the entire header.php file for a different look.

The most common mistake anyone makes are misplaced or missing apostrophes ( ' ). If you are getting errors that's always the first thing to check for.

And the most important thing, before making a change to any file in the system ALWAYS make a back up of the file first, so that you always have something to fall back on if things go very wrong.

Happy Coding!

HOME | REVIEWS | NEWS | FORUM | ABOUT US | RESOURCES | SUBMIT ARTICLES

 

Creative Commons License This work is licensed under a Creative Commons Attribution-No Derivative Works 2.5 License. Unless otherwise labeled by its originating author, the content found on Shopping Cart Review is made available under the terms of a Creative Commons Attribution-No Derivative Works 2.5 License, with the exception that no rights are granted -- since they are not ours to grant -- in any logo, graphic design, trademarks or trade names.