View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Discount Codes

Thread began 10/14/2009 9:06 am by Alf | Last modified 11/24/2014 12:42 pm by Alf | 3395 views | 17 replies

Jason ByrnesWebAssist

First off, you should follow the solution recipe for static coupon codes to get coupon codes working. That tutorial can be found In the Solution Recipes section of the eCart Support Page titled "Creating a Coupon system for your eCart store":

To convert that to be database driven:

1) Create a table in your database to hold the coupon codes. it should have a structure similar to:
couuponID - Auto Number, Primary key Column.
couponCode - varchar
couponAmount - double

To add a coupon code of "test" that will give a 10% discount, you would create the follwoing record:
couponID | couponCode | couponAmount
1 | test | 0.10

2) Next is to add a recordset to the page to lookup the coupon amount based on the code the user enters.

On the server behaviors panel, click the plus button and select Recordset. In Simple view, set the record set to use the coupon table we created. Set the name of the recordset to "rsCoupon" In the Filtering Section, set it to filter the couponCode column Equal to the Form Variable txtPromoCode, this is name of the text box created in the coupon code system tutorial.

3) Now we need to create another session variable to hold the discount amount. On the server behaviors panel, click the plus button and select eCart -> General -> Set Session Value. Set the trigger to "recordset rsCoupon Not Empty". Set the name of the session variable to "PromoAmount". Click the lightning bolt next to value, expand the rsCoupon recordset and select the couponAmount column.

4) The PromoCode session variable needs to be modified as well. Set the trigger to "recordset rsCoupon Not Empty" so it will only get set if the promcode sexists in the database.

5) The last step is to modify the Promotional Discount rule in eCart. Remove the "If Session variable == WebAssist" triger.

Add a new trigger "Session variable exists "PromoCode""

Add another trigger "Session variable exists "PromoAmount""

Then Modify the charge rule "Bases on Cart SubTotal "Times" "$_SESSION['PromoAmount']"

so that the discount will use the value stored in the session variable from the database.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...