creating discount coupons/codes

Discussion in 'PHP' started by billybrag, Nov 15, 2006.

  1. #1
    Hello All,

    I have written a basic cart for myself in php and wondered if i could pick peoples brains.

    I want to be able to offer discount codes for use with the shop, but have no experiance in how these work and wondered if people had any tips/tricks/suggestions, or indeed if anyone knows of a basic script for this

    thanks all

    Mike
     
    billybrag, Nov 15, 2006 IP
  2. ajscottsr

    ajscottsr Peon

    Messages:
    388
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Mike:

    I don't know that there's enough information here to be able to answer that question reasonably. Let me give you sort of an overview.

    Let's assume that your script uses a MySQL database for the products.

    You then have to decide on what the coupon schema is, i.e. is it a percentage off, is it free shipping, is it $ off a purchase of $$ or more, or is it a specific discount for a specific product.

    If you want only one of the above, then its pretty simple. Create an additional table to store the coupon codes. In the table, I'd recommend an ID number (autoincrement, different then the code itself), coupon code (actual code a user would enter), description to display, amount of discount, amount or product id required to be eligible for discount and expiration date.

    If you're wanting to do multiple types of coupons, it gets a bit more complex. Because each coupon has to identify what type it is and then has to identify the related product, minimum purchase, etc. The program also has to be complex enough to determine how to apply the different types of coupons.

    All in all, this could range anywhere from relatively simple to a substantial project just depending on how much you want.

    Then you have security features to consider. Can the same user apply 2 different coupons in the same purchase? Can the same user use the same coupon on 2 different purchases? Do you want to set a maximum number of times a particular coupon can be redeemed (or make the codes unique and void it once its been used)? Do you want to tie the use of a particular coupon code to an affiliate program (each affiliate gets a unique code)? Do you want to program codes in advance that will work only on a certain day or on certain days of the week? The possibilities are endless.
     
    ajscottsr, Nov 15, 2006 IP
    streety likes this.
  3. billybrag

    billybrag Peon

    Messages:
    324
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the reply Anthony,

    Ill look into it :)
     
    billybrag, Nov 15, 2006 IP