What is a sponsor?

You may have noticed that I ask for Sponsors and Advertisers. I’ve had a few queries as to what this entails, so here’s the lowdown;


A sponsor is someone who sees me talking about code on this blog and thinks “I could use that!”. I generally come up with ideas for code and sometimes I make code in a sloppy way as proof of concept – I don’t release sloppy code like I used to, hence I ask for people to pay me for my time in making a given set of code contributable. That’s all a sponsor is – someone who is kind enough to pay me to finish up code. Sponsored code gets written much faster than code which is not sponsored.


I also would like to get some advertisers for this blog – payable on a monthly basis for a text link on every page of the blog. Obviously links benefit you as this blog has a largish number of readers so if you offer a service that is in anyway linked to osCommerce or eCommerce in general you could end up making some sales to visitors from this blog.

Sponsors allow me to write code faster!
Advertisers allow me to keep this blog alive!

If you can help to sponsor code, or wish to advertise your services on this blog, please feel free to email me – oscshops@gmail.com – cheers, Gary

Donate To Charity – Reloaded!

OK, so it was brought to my attention that my system only is available at the same time as purchasing a product. There is a good reason for this => it’s an order_total module so it needs to have an order made to process it – and standard osCommerce does not allow an order to be made without products…

So, with a bit of lateral thinking I came up with a solution – use a faux (false) product. Easy in theory and fairly easy in practice…

1. Need to recode the shopping_cart box to always show the cart subtotal. Needed to do this to show the inputted charity amount even if no products are in the cart.

2. Need to recode the shopping cart page to show the update cart, checkout, buttons at all times. Needed in order to be able to input the charity amount and begin the checkout procedure.

3. Need to recode the checkout_shipping page to add 1 extra line of code to add a false (cost zero) product if the cart has a total of exactly zero items in it, and the cart total does not = zero. In other words, a charity donation. If there is already a real product in the cart along with a donation, then this is un-needed of course.

4. Add an extra contribution to skip the checkout_shipping calculations if the cart only has the faux product and donation in it.

5. A couple of small changes in application_top.php in order to deal with the adding and removal of the charity amount, and consequently the adding and removal of the faux product.

Here is a video showing the system in action. Obviously it still needs cleaning up a lot (sponsor needed for this if anyone is interested), and is on my test shop hence the messy layout. But it should give a general idea of where the contribution is at right now.

Donate To Charity – proof of concept – osCommerce

As per my mini blog post last night, here is a working version of a different version of my “Donate To Charity” codebase.

This version is completely different to the “Charity Round Up” module which was sponsored by Lindsay – as this version allows the buyer to insert an amount to donate whilst on the shopping cart page.

Have a look at this video and see what I mean;

I made this by using “sessions” to store the donated amount, and then activating an order_total module if the session is “live”. Fairly simple.

I wanted to show that it is possible with just a little bit of coding knowledge to come up with almost anything that is needed. If anyone wants this module, it’ll need cleaning up substantially and also it will need to have a mechanism added to allow the donator to change or remove his/her donated amount before checking out. Get in touch [ oscshops@gmail.com ] if you are willing to sponsor further development and a clean up of the code.

Code one thing, and find a solution for another

Over in the osCommerce forum, someone is after a “donation” contribution whereby a buyer can insert an amount to donate which will then be added to the cart total. I guessed that a competent(ish) coder should be able to get something workable within half a days worth of coding time. So I set out to make something that would work – it took all of 30 minutes.

Anyway, that’s by the by – the point of this blog post is that whilst I was coding this up I struck on an idea of how to remove discount coupon after it’s been applied – which is something that a lot of people have been asking for…

Have a look at this video

Hopefully it’ll show the “remove coupon” link next to the details of the live coupon, which, when clicked will remove the coupon entirely…

I’ll add this into the code for Version 3 of the coupon discount system.

Cookies, Links, Session IDs

Cheri asks;

I have an extra text box on my index page and I would like to add hyperlinks. I’m told that the HTML may cause problems, including the possibility of my customer’s carts getting emptied and/or logging the customer out. Do you agree with this? And what issues would forcing cookies possibly cause? Please explain in as simple terms as possible, I don’t know code, etc. The store is doing pretty well right now and the last thing I want to do is chase away customers. I just think adding hyperlinks on the front page would make the spiders happy. And we like happy spiders 🙂

All you need to remember is that any links that go to other osCommerce based pages in your own site MUST carry a SID. Any links elsewhere, need not.

So, to carry a SID, use the “tep_href_link” function;


Obviously in the example above we are linking to category ID = 24. You can pass more parameters as you need them;


What this will do is link the SSL page iny our site (https://) rather than the normal http page. Assuming you have SSL set up of course!

Hope this helps.

No cash? So barter!

I would imagine that 90% of people who run stores using osCommerce are doing it as a one-man trade or a part-time adventure. This means that there is a lot of scope for getting stuff for “free”…

At the moment I am updating one of my osCommerce shops to a new design. I needed a new logo. Of course, I could have created one myself or I could have bought an already made one, or I could have paid for someone more graphically inclined than me to make one.

Instead, I bartered my services as I was aware of someone in the osCommerce forum requiring a shipping module to be made. This guy is a good graphics whiz. Match made in heaven – I code the shipping module for him, he makes me a logo. Easy as 123. And it’s already all completed. He has his mo, I have my logo. Of course, now I actually need to get on and finish up the rest of the site, but that’s a job for next week.

So, the next time that you are thinking about purchasing something, see if you can get it for no cash – it only takes an email to see if they need something which you can give instead of cash. And the worst that can happen is they say “no”.

Sometimes, it doesn’t have to mean any work on your part. If you have a popular site, why not offer some form of banner advertising or a text link advert. And so on.

The commerce world does not always have to be about money! Think on that, over the weekend.

Problems Installing Coupons

Will asks;

I install you’re cintri into my shop (latest version voor de latest OSC shop)
I seem everything isworking at the backside from the shop, meaning i can type in a name for the voucher and a number (price or %) – At the from i see a block say “if you have a coupon please fill in here” but than nothing happend with the price in de shooping basket

Could you help me out please where to look? I put it on place number 3 from 5 at sort order total but nothing there?


1) if you order a item than you get the step where you need to select how to pay (PayPal or what ever) but here you wil see at the top of the screen/page the space to put in the code for you’re coupon ?! This box is ‘not’ standing inside the OSC frame? what did i do wrong?!

2) i add just a coupon with the number 2, this give’s you a discount off 1 euro (just a test ok)
but when you add this number inside the box and click on the PayPal payment and go to next page
This discount is NOT taken from the total? i put the same as you at Order Total Modul so on number 3
But it don’t take the discount or whatever, whats wrong here?

3) When i do a order by PayPal and i get a email and order noting from thediscount is there on it, so it’s there (meaning all things) but he don’t discount it?

can you check it please?!


Need help asap becaus e this problem need to befixed

OK – you have not installed the contribution properly – that is all.

For starters, make sure that the order_total module has a UNIQUE sort order – it cannot be the same as any other sort orders. Make it so that it comes directly underneath your subtotal. I usually change all the existing sort orders from 1 to 10, 2 to 20 and so on. Then place the coupon as sort order 15.

FOr your problem where the coupon box is not showing in the correct place, that means you added the code in the wrong place. So, change it 😉

I offer an installation service should you require it – please email me on oscshops@gmail.com – it is cheap and guaranteed to work or you pay nothing.