Building a business is not possible without the help and advice from people we like to call subject matter experts. One of the many rewards of building and running a business is to be able to meet people who are subject matter experts and freely offer their vast wealth of experience and expertise to a new business like ours. We have been fortunate, and are very appreciative, of the many people who are helping us build something very exciting! In a series of posts we would like to acknowledge a few of our friends…

We wanted to launch a special promotion (10% savings on all tableware purchases) for a local bank’s customers and needed to add a feature to capture and validate a coupon code in our shopping cart. Although WebAssist’s eCart shopping cart does have a couple of tutorials for discounts, it does not have one for coupon codes. We searched their user forum and found Kevin R. Rounsavelle’s excellent coupon code demo, which is accompanied by a well-written tutorial and a forum thread. Kevin is President of, which assists clients with the design and implementation of websites and eBusiness applications.

The demo and tutorial are written for WebAssist’s eCart shopping cart, but can easily be adapted to other shopping carts. The ASP and PHP versions of the coupon code can be found in the tutorial and forum thread, respectively.

Kevin’s demo and tutorial was a lifesaver! We completed the coupon code in a matter of a few hours. To resolve a couple of issues we experienced, we contacted Kevin and he agreed to quickly assist on a Friday evening between two client applications that were scheduled to go live. He was headed out of town on Saturday, and promised to continue with the help if we needed it upon his return (which was not necessary as his initial advice helped us fix the issues). We have since contacted Kevin with a question regarding a Web Assist tutorial for volume discounts in shopping carts, and he has been equally responsive and helpful.

We appreciate Kevin’s help on a couple of critical feature implementations (coupon code and volume discounts), and recommend his firm to anyone who is interested in eBusiness applications written in PHP or ASP. It is people like Kevin, and their participation and sharing in user forums and with demos and tutorials, that greatly benefit people like us who are building new businesses.

We have reproduced below a few comments/suggestions we have made to Kevin on his wonderful coupon code demo and tutorial.

  1. Please include the PHP discount_process code in the tutorial for those of us who do not use ASP. I did find it by searching all threads, but it would be nice to package it in the tutorial.
  2. Regarding the PHP discount_process code, any chance this could be updated for PHP 5 (no longer uses CHAR VARS). And in the redirects, I tried to use dynamic URLs, but it did not work. My reason to want to use dynamic rather than static URLs is that these pages are secured with an SSL certificate on my production box, but I don’t have an SSL certificate for my development box. It is a little cumbersome to have to manually change these URLs each time I move the files from development to production.
  3. Would be helpful to point out that session cookies have to be added to the header of each page that contains a shopping cart. I have an editable shopping cart (where customers input the coupon code), followed by the customer info page (billing/shipping info), followed by the read-only shopping cart for customer to confirm purchase. I also have a quick cart in the nav bar on every page.
  4. Another enhancement to the coupon tutorial would be to show how to create multiple coupons for marketing campaigns running in parallel.
  5. BTW, Kevin mentions an “advanced” tutorial that includes expiry options for coupons – has this been published and where? Would love to get my hands on it.


We received an immediate and very kind response from Kevin Rounsavelle to our suggestions, which we would like to share.

“To have multiple coupons, you just add multiple coupon codes to your discounts table in your database. You can then add either a rules table or custom code to specify if a customer can apply multiple discounts codes at the same time. I also use an ACTIVE field in my discounts table.

I haven’t had time to finish the advanced coupon code tutorial mostly because I have been working night and day on a retail ecommerce application that includes more discounts and merchandizing features than any other application on the market right now. I plan to release in around March 1.

However, expiration and start dates are really simple. You just have to add a startdate and enddate field to your discounts tables and then add some conditional code on your discounts processing page to only process records in the table that are between the two dates.

Example in ASP:

<% Dim TodaysDate, StartDate, EndDate
TodaysDate = Date
StartDate = DiscountsTable.Fields.Item(“StartDate”).Value
EndDate = DiscountsTable.Fields.Item(“EndDate”).Value
IF TodaysDate >= StartDate AND TodaysDate <= EndDate Then %>
<% Coupon Processing Code Goes Here %>
<% End If %>

Using the logic above, the coupon code(s) will not be processed unless today’s date falls between the starting and ending dates of the campaign.”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: