Using Oscommerce Banner Manager as a widget area
Posted by Lindsayanng on June 21st, 2010I have been using Oscommerce for some time and have almost always just removed the banner manager completely because it was I never felt there was a need for it. That was until I started using wordpress and found the fun you can have with widget areas!! So now you can use your oscommerce banner manager as a widget and area and basically made spots on your site that are easily updated by a user with no need to get into the files – can you say YAY?
So a little background on what the banner manager is and how it works:
The Oscommerce banner manager is meant to be a way to measure the effectiveness of an ad placed on your site as well as a way for you to rotate ads and automate the start and end dates for ads. While this is a really cool feature in itself, who puts ads on their e-commerce websites? Most people actually urge against putting outside ads on an ecommerce site because it makes you look cheap, and no one wants to look cheap.
So let’s use these little nuggets of administrated content areas as widgets! With the banner manager you can paste your own HTML into the area or upload a picture. This means that you can literally use it the same as a wordpress text widget with the added feature of an image upload!
Here is how you do it.
First, go to your admin and click on “Tools” and then “Banner Manager”. The banners are organized by groups and then each individual banner is titled. So you likely see the default banner there called “Oscommerce” within the group “468×50″. We are going to ignore that one and create our own instead.
Click “new banner” and enter your banner title. This will be a name that you give to this banner and this banner only. Try and use a basic name with no capital letters so you don’t make mistakes when it comes time to use it; we will use the group name “homepage” because we are putting this area on the home page. Then the banner url is the link that you will add to your image. This is basically where people will be directed to if they click on your banner/widget area. So if you are creating a graphic that will lead people to your photo gallery, you would put the url for the photo gallery.
Next you will create a new “group”. This group is going to be the name that we will put all banners under that we would like to display in the same location. So if we have a new area where we want to rotate through 10 images, they will all need to be under the same group name.
Use the upload field to upload an image and/or link to one that already exists on your server. There are specific instructions for these fields on the banner page.
You can leave the date fields blank if you want this to be in infinite ad or you can add dates to set the dates where you want your ad to start and end. You can also make it end after a certain number of impressions, but that is more for advertising.
That is it as far as what you do on the back end.
Now we need to place the code in the files that will tell your site where to place this widget area.
You will need SOME knowledge of oscommerce coding to choose the correct place to put this but if you need help, just post here. Otherwise, if you would like to put this widget area on your home page, you can open catalog/includes/languages/english/index.php and fine the TEXT_MAIN definition.
Add this code here:
<?php
echo tep_display_banner('dynamic', 'homepage');
?>
This will display a random banner from the homepage group, which is what the goal is.
There are some other little gems inside of this banner manage though. You can display just one specific banner – so if you want to display one specific banner somewhere else on your page, you don’t need to duplicate it and put it in it’s own category. Instead you just use this code.
<?php
echo tep_display_banner('static', '1');
?>
Now unfortunately it does not allow you to allow you to use the banner’s title (maybe I will create a patch to allow this some day) but you need to use the banner ID. The ID can be found in the url to edit the banner.
When you look at the list of banners, you have the ability to click on one to highlight the banner and possibly choose to edit it. Instead of clicking edit, just click on the banner you would like to display and look at the url bar. You will see this:
http://hugmeup.com/admin/banner_manager.php?page=1&bID=2
Where you have ID=2, that is the url telling you that the banner ID is 2! Stick that in the code above and you are ready to go!
So enjoy this little nugget of wisdom.. Even play with the HTML feature instead of the banner image feature. You can add any type of HTML code you could want, which leaves you open to adding all different kinds of areas. You can leave it as a dynamic quote of the day that rotates, any “grab this code” html from other sites’ widgets, and more.
If you use this as a widget area, I would love to have a look at your site. Feel free to drop a link and show me what you have done.
