dynamic discount codes
hi there
I've followed the following instructions carefully, but none of my dynamic codes work...
I've attached my files, if you could have a look please that would be great
many thanks
-----------------------------------------------------
Originally Posted by Jason Byrnes
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":
ecart/
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.