Home » Opening an Online Store » 07 - osCommerce
7

osCommerce - Customization

Customizing Oscommerce to your preferences

As you can see, there is a bunch of text in the middle and it still shows oscommerce across the top. In a minute, we'll work on getting that looking more like your site than the default osCommerce installation. First let's make a backup of the files so if we make a mistake, we can revert back to before we made the change. So click on Tools and then "Database Backup"

Then click on Backup

It gives you a warning not to interrupt the backup. Click the Backup button, and when it's complete, you will see the backup listed.

Now on to changing some files. The file containing the text is located in the corresponding languages file, in this example it's catalog/includes/languages/english/index.php. Open this file (you may need an FTP client at this point. All files like this should be opened in a program like notepad. Do not open in a program like Word and try to edit.).

The easiest way to edit the file will be to open it with Notepad and save it somewhere you will remember. Then when you are done with it, drag it back into the FTP connection you have open, and choose yes when it asks you to overwrite the current file. Once you have the file open, locate the words that are showing on the page, for example "This is a default setup..." This is where you will edit the text

Now, highlight from that beginning text to where that text ends. So if you notice, the last sentence on the page is about the version. So find the ' mark after TEXT MAIN and the last mark after the last sentence, and highlight everything in-between. Then delete this whole section and type in whatever text you wish to have showing.

  • In this example, I wrote WELCOME

    Now you can see what this looks like on the page now, all the text that was there is gone, and now it just shows WELCOME.

    Now, let's work on replacing the oscommerce logo with yours, upload your logo to the /catalog/images/ directory of your store using your FTP client. Download the file catalog/includes/header.php and open it in a text editor. Find this code:

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

    Replace oscommerce.gif with the name of your file. Make sure you leave in the single quotes (') as they are very important.

    If you want, you can change the alt text of your image. This is the text that appears for those who use a text-based browser or a screen reader (such as blind people) to browse the web. The alt text is currently 'osCommerce' – you can change that to whatever you want. Again, the single quote characters are very important.

    For this example,the logo is called logo.jpg and my store is called “Lamp of the Soul .” I would rewrite the code to look like this:

      <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'logo.jpg', 'Lamp of the Soul') . '</a>'; ?></td>
    

    The file starts out with this:

    And then is changed to this:

    Now you see the store log is there instead of the oscommerce logo.

  • The next item that most people want to change is the color of the boxes, the text, etc. Most of the colors used throughout the osCommerce installation can be changed in the style sheet definition file. While we can't go into all the choices here, you will get an example and a list of what each section changes so you can play with the colors yourself. The style sheet definition file is located in the catalog folder and is named stylesheet.css. All colors in the style sheet are referred to by their html color number, for example #000000 is black and #ffffff is white. You can do a search on the Internet for "HTML color codes" and you will find all the codes for the different colors there. Let's change the background color from white to light blue to give you an idea of how this works. So we download the stylesheet.css and make the change to the background line here:

      BODY {
        background: #ffffff;
        color: #000000;
        margin: 0px;
      }
    

    We change it to:

    BODY {
     background: #CCCCFF;
     color: #000000;
     margin: 0px;
    }
    

    Then upload the changed file to the server and you will see the background is now light blue:

    Below is a listing of what each section represents to help you know which section changes which section of the site.

    .boxText
    Changes the font size of the text in all the boxes.

    Set the padding in the style sheet to have space on the left and right ... if you set padding on the top and bottom it will leave that much space between the text lines in certain boxes and is not recommended for the top and bottom padding.

    .errorBox
    Color and text size of error boxes with the red triangle ... ex: admin/backup.php where it will say backup directory does not exist, warning...I can write to your configuration files, etc.

    .stockWarning
    The style used for the stock level warning text shown on the shopping cart page when purchasing items.

    .productsNotifications
    The style used for the product notifications checkbox bar on the checkout success page.

    You can also put a color in the text box and it will make the text change on just that bar.

    .orderEdit
    The color style of the "edit" links shown on the checkout confirmation page.

    BODY
    Type color is text color in the left & right column boxes and the "text body" that is NOT linked.

    Background color is the page background color ... this acts as a base whereupon the header and columns are built.

    Set the border color which sets the color around the inside browser window including the scrollbar.

    Set the top border to 10 with the same color and it will drop down the table and the scrollbars of the browser.

    A
    The color style for ALL link colors throughout the entire store.

    A:hover
    The color style used for mouse-over links throughout the entire store.

    FORM
    The style used for forms. Changes the color of this text, "Use keywords to find the product
    you are looking for" in the "Quick Find" box on the left.

    TR.header (means table row.header and is a general setting for the whole table)
    The style used for the background color of the header.

    TR.headerNavigation
    The styles used for the breadcrumb navigation path (background color only of the top navigation as "Top >> Catalog >> etc)

    TD.headerNavigation
    Arrow colors that point forward and the vertical link separators | in the breadcrumb navigation path.

    If you set a background color here it will override the TR.headerNavigation color set.

    A colored border on the bottom can be set for a separation between the header and the categories.

    A padding value can be set which will only pad the Navigation Bar.

    A background image for the navigation table can be set also.

    A.headerNavigation
    Sets the text link colors for the breadcrumb navigation path links (Top Catalog etc.)

    A.headerNavigation:hover
    The mouse-over effects of the breadcrumb navigation path links (top, catalog, my account, cart contents, etc.)

    TR.headerError
    The styles used for the error messages shown in the header. The default is a red background with white text.

    TD.headerError
    The styles used for the error messages shown in the header. The default is a red background with white text.

    TR.headerInfo
    The styles used for the information messages shown in the header ... changes the bg color of the top box that appears when a new password is sent ...
    ex: A New Password Has Been Sent To Your Email Address

    TD.headerInfo
    The styles used for the information messages shown in the header ... changes the bg color of the top box that appears when a new password is sent ...
    ex: A New Password Has Been Sent To Your Email Address

    TR.footer
    This sets the color of the footer row where the date and counter are.

    TD.footer
    This is the size & color of the text in the footer row where the date and counter are. If you set a background color on this TD.footer tag it will override the TR.footer tag.

    .infoBox
    Sets the background border color around all the boxes and not the box headings except the "my account", "edit account", and "add a new address" boxes.

    .infoBoxContents
    Sets the color of ALL the inside of the boxes and puts a colored border around the comments boxes.

    Setting a text color here will color the numbers text in the boxes like the catalog listings and the "Best Sellers" box numbers and the "My Account", "Edit Account", & "Add Address" headings.

    .infoBoxNotice
    The style used for the outline of the box created at the top of the checkout_payment.php page when a customer inputs the wrong credit card number or expiration date.

    .infoBoxNoticeContents
    The style used for the body of the box created at the top of the checkout_payment.php page when a customer inputs the wrong credit card number or expiration date.

    TD.infoBoxHeading
    Sets the left and right column boxes and the new products box heading color and text color.

    The text size of the heading boxes can be changed ... anything above 10 you will need to enlarge the box graphics also (images/infobox)

    Padding can be added to these heading boxes.

    TR.accountHistory-odd, TR.addressBook-odd, TR.alsoPurchased-odd, TR.payment-odd, TR.productListing-odd, TR.productReviews-odd, TR.upcomingProducts-odd, TR.shippingOptions-odd
    TR.accountHistory-even, TR.addressBook-even, TR.alsoPurchased-even, TR.payment-even, TR.productListing-even, TR.productReviews-even, TR.upcomingProducts-even, TR.shippingOptions-even

    Sets the odd and even row colors on all box listings.

    TABLE.productListing
    Sets a border around the products listing table that shows the listing of the products.

    .productListing-heading
    The color of the background of the product listing heading that has "product name", "price", etc. The text style and color can also be set.

    TD.productListing-data
    Set a different background color for the product listing table and also set box padding, size, borders ... experiment!

    A.pageResults
    Sets the link on catalog/includes/split_page_results.php and page results numbered link colors at the bottom of the product pages.

    A.pageResults:hover
    Mouse over link colors on catalog/includes/split_page_results.php and page results numbered links mouse over color at the bottom of the product pages.

    TD.pageHeading, DIV.pageHeading
    The style used for page headings. Color on the checkout_success.php page that says "Your Order Has Been Processed!" and also on all the product heading pages as What's New Here? Enjoy Your Shopping! Text on all the product pages.

    Change the size of the text here.

    TR.subBar and TD.subBar
    The style used for the sub navigation bar.

    TD.main, P.main
    The size of the text can be set for all the main text area, the "My Account Info", "Edit Account", "Add Address", "Order History", & "Notifications" page boxes. If you set the text color it is the text color on all these ... not the column boxes.

    A padding can be also be set for all the body text in the store.

    TD.smallText, SPAN.smallText, P.smallText
    Copyright text color & size at the bottom of the page.

    "Include Subcategories" Text on the advanced_search.php page

    Page results text at the bottom of the product pages such as "Displaying 11 to 20 (of 32 products) Result Pages:"

    TD.accountCategory
    The style used for the account categories.

    TD.fieldKey and TD.fieldValue
    Text Sizes for the account parameter keys and values on the advanced_search.php page such as "Categories: Manufacturers: Price From: Price To:
    Date From: Date To:

    TD.tableHeading
    Text styles/sizes on the table headings of address_book.php and product_reviews.php page such as "No. Name Location"

    SPAN.newItemInCart
    The style used for marking new products added to the shopping cart so these products show what's in the shopping cart.

    CHECKBOX, INPUT, RADIO, SELECT
    The style used for certain HTML form elements like the size of the text inside the drop down boxes like manufacturers.

    SPAN.greetUser
    The style used for the user greeting "Welcome Guest!" on the first page.

    TABLE.formArea
    In "My Account Information", "Edit Account", and "Add Address" this is the inside box color.
    Set the border around the boxes in the border section.

    TD.formAreaTitle
    In "My Account Information", "Edit Account", and "Add Address" this is the size of the text headings.

    Changes the text color on top of the boxes on the "My Account Info" page.

    Leave the text color box blank and the color is black.

    A padding can also be set for space on the right and left sides.

    SPAN.markProductOutOfStock
    The text color used for marking products out of stock.

    SPAN.productSpecialPrice
    The style used on special product prices.

    TD.checkoutBar
    Bottom text on the checkout page that says:
    [ delivery address | payment method | confirmation | finished! ]

    SPAN.checkoutBarHighlighted
    The highlight color of the text showing which page you are on:
    [ delivery address | payment method | confirmation | finished! ]

    SPAN.errorText
    The style used for error text messages.

    .moduleRow
    The style used for the shipping and payment modules.

    .moduleRowOver
    The color of the bar on the checkout_payment.php page on a mouse over when you choose your payment method.

    .moduleRowSelected
    The color of the bar on the checkout_shipping.php showing the shipping charge & the selected payment method on th checkout_payment.php page.

    .checkoutBarFrom, .checkoutBarTo
    The color & size of the text at the bottom of the checkout pages that shows what page you are NOT on such as "Delivery Information Payment Information Confirmation Finished!"

    .checkoutBarCurrent
    The color & size of the text at the bottom of the checkout pages that shows what page you are on such as "Delivery Information Payment Information Confirmation Finished!"

    .messageBox
    .messageStackError, .messageStackWarning
    .messageStackSuccess

    The style used for message boxes. The error background colors like trying to delete an address that is your primary address in the account section.

    .inputRequirement
    The style used for form input requirement fields. The color of the asterisk * and the words "Required Information" on the account.php pages.

    .messageStack

    These are just some basics about osCommerce, there are literally many things you can do with it, so be sure to familiarize yourself with their online documentation and community forums.