How to implement coupon function in php
luster
luster 2017-08-04 11:13:24
0
1
1813

To create a coupon, how to connect the coupon with the item to be discounted. That is to say, the coupons offer discounts on specific products.

luster
luster

reply all(1)
大家讲道理

Coupon table:
Type: discount coupon or price coupon
Value: discount percentage or coupon amount
Random string: It is the coupon code, randomly generate one

Generate coupon:
1. Insert coupon table A record
2. Give the coupon code of the coupon to the user

When the user submits an order:
1. There is an input box for entering the coupon code on the order submission interface
2. In the code of creating the order, judge whether the coupon Whether the code is empty, if it is empty, add the order process normally
3. If the coupon code is not empty, use the coupon code submitted by the user to query the coupon table, obtain the discount amount, and update the amount to be paid for the order.
4. After modifying the order amount, delete this record in the coupon table to prevent the reuse of a coupon.
5. Normal adding order process


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template