How To Add More Buttons To Your Website Header In osCommerce?

We can easily customize our osCommerce header, add as many buttons required in header. This is quite simple but still some people find difficult to execute. For them, let’s make simple so that they can easily understand. How to add more buttons of your choice like existing “checkout”, “cart content” and “my account” buttons.

Here we are providing stepwise procedure to add buttons in header:

The default osCommerce looks like this:

Step 1: In osCommerce catalog folder to edit go to catalog/includes/header.php use a copy of a file and do modifications in it.
(Note: Keep original file with you for backup.)

Step 2: Here, this part shows how to create button.

    • This code refers to the cart contents button which is already added in default osCommerce looks like this.

Default Header

  • Write the above code for creating button.

 
Default Code for Header

The role of tep_draw_button() function is it draws a button with a link and make it look like a simple button which can be clicked and used.

Step 3: To create a new button.

A button created should consists of button text, a link to a page like suppose if it belongs to cart button it should link to shopping cart where we can see our cart contents or any sort of a link and also a symbol that a button refers to.

Suppose we require Contact us button in header beside checkout button in our default osCommerce.

Create a new button with the help of tep_draw_button() function.

The code will look like this below.

tep_draw_button(HEADER_TITLE_CONTACT_US, ‘mail-closed’, tep_href_link(FILENAME_CONTACT_US))

Button is now created.

    • The button link: .

Next after creating checkout button using tep_draw_button() function. Add a link to a button created.Now to how to add a link Use tep_href_link() function to add link to a button.

tep_href_link(FILENAME_CONTACT_US)

Above button is linked to contact us page.

**You can refer list of all files and their constants in file

catalog/includes/filenames.php

    • The button link: .

This is following button code that we use as a reference:

Always use the text constants to define any text like.

HEADER_TITLE_CONTACT_US for contact us

Go to catalog/includes/languages/english.php open it.

define(‘HEADER_TITLE_CONTACT_US’, ‘Contact us’);

We can use different languages for our store and use defined constants anywhere in our store.

  • The button icon:
  • We can use icons for buttons.You have to follow the below reference for some jquery icons.Click on this link.

http://jqueryui.com/themeroller

There are couple of icons that we may need for our use for the contact us button, we want the envelope type icon and for that we have ìui-icon-mail-closedî in jquery.

In short we will reqiure:

  • button_text
  • button_link
  • button_symbol

For more reference you can see some examples.

Some more examples to draw a button-2

Step 4: How to place button to the header?

You can place that button to anywhere you like. Now, we want it in the header.
Lets add it to there.

Customized code for header(a)-2

Our store will now look like this:

Customized Header

Or else if you want the contact us button after my account use the below code.

For code :Customized code for header(b)

Customized code for header(b)-2

Some more examples you can refer as:

You can add login logoff button and many more buttons of your wish and requirement.

To access products in our store we can use button named browse products:

More examples on customized header-2

Well, we are ready with our creative header. You can go for a change in searching more ideas and customize it to look better.