Search code examples
phpmysqlshopping-cartcoupon

Coupon code Verification in an Ecommerce site


Hi all I am implementing a coupon code verification option in my Ecommerce website. I have two types of coupons either flat amount or percentage. How to tackle both of these in backend. I mean in database schema.


Solution

  • CouponTypeTBL
    id type
    1  flat
    2  percent
    
    CouponTBL
    id  typeid  uniquecode  amount   validfromdate   validtodate  useddate  status etc...
    1   1       a1-xx       100.00   ....
    2   2       cvd11       7.5      ...
    

    So you have here a coupon:

    a1-xx which is a flat amount of 100

    and

    cvd11 which gives a 7.5% discount.

    You can make this model more complex, which currency, if flat will there be an amount left if used under the fixed amount etc .. etc..