can someone please give me an example on the internet of how the system of discount coupon generation and redemption is implemented for a website where a purchas开发者_运维问答e is made. Programming based on php.
Any help appreciated.
Regards
SK
Usually the discount coupons are associated with usename. That means a user can make use of coupons issued to him. The coupons are usually random alphanumeric string of suitable length. You can have a table of the form:
coupon# user-id expire-date used discount
---------------------------------------------
1jjkas2 abc123 01-05-20`0 false 0.05
coupon#
- Randomly generated coupon number : varcharuser-id
- Username to whom this coupon has been issued : varcharexpire-date
- when does this coupon expire :date/timestampused
- has this coupon been used : booleandiscount
- discount % : decimal
Generate a coupon for all or some of your users and populate the above table.
Next send an email to your users which contains the coupon# and expire-date.
Make provision for user to enter the coupon# when the user is about to check out. At that time check if the coupon can be used( check expire date,used field). If its valid, apply the discount to the final amount.
精彩评论