close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Coupons from database issues

Thread began 9/07/2009 12:23 pm by bec341098 | Last modified 9/09/2009 1:13 pm by bec341098 | 2124 views | 3 replies

Jason ByrnesWebAssist

Please post a link to your site so I can look into the problem.

Here are the basic steps for setting up database driven promocodes:

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...