Categories

How to link the template banners to a specific category/product

Simon Kilgour November 15, 2010
No votes yet.
Please wait...

Any osCommerce template can contain banners in the header and side columns. The template’s programmer often links them to a category, new products, specials listing and so on.

You may want to link them to your own category or to your own featured products. It’s not difficult to do. First you need to locate where this banner is coded. That is to locate a specific file. If the banner is located in the header most likely this banner can be found in the /includes/header.php file. If the banner is located in one of the side columns look for it in the /inludes/column_left.php or /inludes/column_right.php files.

If you have difficulties in locating the place where the banner is coded here are some tips for you:
– in your browser right-click (Ctrl-click on Mac) the image of the banner and select Properties (in Safari you can use “Open Image in New Window” instead).
– See the name of this image (e.g. banner1.gif)
– Use the search functionality of your file manager or search tools like .
– Having located the file, you can now search for the line where this image is sitting. Very often it’s Ctrl+F key stroke in any text editor.

You may see a line of code like this:

 
<a href=”<?php echo tep_href_link(‘products_new.php’)?>”><?php echo tep_image(DIR_WS_IMAGES.’banner1.gif’)?></a>
 


What you do after that is replacing the parameter for the tep_href_link() function for your own.

1. Linking to a category

Your code should look like this

 
<a href=”<?php echo tep_href_link(‘index.php?cPath=1′)?>”><?php echo tep_image(DIR_WS_IMAGES.’banner1.gif’)?></a>
 

Use your own value of cPath. You can get this value while you are browsing the category you are going to link to. Just take a look at the address bar of your browser and you’ll see the cPath value the current category has got.

2. Linking to a product

Your code should look like this

 
<a href=”<?php echo tep_href_link(‘index.php?products_id=10′)?>”><?php echo tep_image(DIR_WS_IMAGES.’banner1.gif’)?></a>
 

Use your own value of products_id. You can get this value while you are browsing the product page you are going to link to. Take a look at the address bar of your browser and you’ll see the products_id value of the current product.

3. Linking to the New Products, Specials is even easier

It’s enough to use a code like this

 
<a href=”<?php echo tep_href_link(‘products_new.php’)?>”><?php echo tep_image(DIR_WS_IMAGES.’banner1.gif’)?></a>
<a href=”<?php echo tep_href_link(‘specials.php’)?>”><?php echo tep_image(DIR_WS_IMAGES.’banner1.gif’)?></a>
 
This entry was posted in E-commerce Templates, OsCommerce, OsCommerce Tutorials and tagged banner, link, osCommerce. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket

Live Chat
We help you to choose the right product.