[OsCommerce] Create Google Adsense box for your OsCommerce store

Introduce well-known open sources
mobilesoftvn
Site Admin
Posts: 8
Joined: Fri Jun 05, 2015 4:43 pm

[OsCommerce] Create Google Adsense box for your OsCommerce store

Postby mobilesoftvn » Sat Aug 01, 2015 11:20 am

I had a client who wanted to display Google AdSense adds on the right column of his store. Now I need to say, that I’m not the greatest fan of such an idea: A store is there to make money by selling its products or services, not through advertising or anything else. Each visitor should be focused on what the store has to offer, any ads or similar displays are just a distraction in my opinion.

Honestly, if your store doesn’t make enough money, you should focus on that, or start advertising for the store and not on the store. Anyway, this was the request, so if you like something like this too, here you go.

1. Step 1: Create the files
All boxes are in OsCommerce in folder includes/modules/boxes/. The corresponding language files are in folder catalog /includes/languages/english/modules/boxes/ and have exactly the same filename as the box it self.

What we do now is to take the most simple box that exist, that is bm_information.php, make a copy and rename it to be bm_adsense.php. Same we do with the corresponding language file. So we have 2 files now called bm_adsense.php.

Keep them open in your editor, do not upload them and more important do not install and activate them in admin, you will get errors at that stage


* 2. Step 2: Basic setup
As we know, all boxes are so called “classes” and do write configuration values (constants) to the database. That mean that some parts of the content of that files must be unique. Before doing anything else, we need to make the file contents “unique” in that meaning. We do this by replacing class function names and constants as follows:

* 3. Step 3: File modification

Return to “Open Sources”

Who is online

Users browsing this forum: No registered users and 1 guest