About Club osCommerce

Showcasing osCommerce…the good, the bad and the ugly!

StumbleUpon It! DIGG It!

COD only if Coupon is live

Written By Gary on Nov 27 2008 · Comments (0)

Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive - and you get a link from my homepage to your site. Cheers!


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:
  1. if (!tep_session_is_registered('coupon_code')) $this_enabled = false;

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?

No Comments

No comments yet.

Leave a comment

RSS feed for comments on this post · TrackBack URL

Hot 100 osCommerce Shops

View the osCommerce HOT 100These are the best looking, most exceptional osCommerce Stores as voted for by you.

New to osCommerce - get inspiration from these beautiful shops. Reckon your site has what it takes to become a member of the HOT 100? Submit it!