COD only if Coupon is live

By | November 27, 2008

A previous post introduced the idea of making modules in osCommerce “interactive” based upon other inputs…

Stefan asks;

What I need is for the COD Method of payment to work only with a valid voucher. In other words you cannot use the COD Method of payment without first entering a valid voucher code.

I had already installed my Discount Coupon modification onto Stefans store, which was seen to work very well, then Stefan posed that question to me. I was sure that this should be really quite simple to get working…and after a bit of lateral thinking, all it took was the following code (added to the COD module):

[php]if (!tep_session_is_registered(‘coupon_code’)) $this_enabled = false;[/php]

Which basically says;

if a session called “coupon_code” is NOT present, then disable the “Cash On Delivery” module. This works as my coupon module sets a number of sessions, one of them being “coupon_code”, when a coupon is live.

Easy as 123. Can you think of ways to make your site more interactive for your shoppers?

Leave a Reply

Your email address will not be published.