开发者

example of discount coupon generation and redemption in php

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 : varchar
  • user-id - Username to whom this coupon has been issued : varchar
  • expire-date - when does this coupon expire :date/timestamp
  • used - has this coupon been used : boolean
  • discount - 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜