I am wondering if I could throw this out there and get a bit of feedback/advice on this project.
We are trying to provide our users with access to coupons that they can print from their computer. We currently use a learning management system (written in PHP) so our users will be logged in we can easily access their name, user_id, and the like with just a few lines of PHP.
As the user is going through material, they will see a graphic that says, "click her for a coupon". This graphic can popup a new windows. In the new window, we want to have information about the merchant/discount and a button that says, "print". After the user clicks print, a dynamically generated coupon would be created and print out.
Features/Restrictions we would like in place:
- dynamically generated coupons: merchant name, discount, location, logo, unique coupon id number and user's name drawn from a database and contained on the coupon as it is generated "on-the-fly"
- users can only print the coupon one time
- If the user tries to print the coupon more than one time, they should see a message that says, "you have already printed this coupon on INSERT PRINTED DATE HERE"
- We would also like the user to be able to access a sort of coupon dashboard where they would see a list of all the coupons and a column with the "status" of a coupon which would indicate if the coupon is "locked", "unlocked and printed", or "unlocked and not printed". A coupon will be "locked" until the view the graphic for the first time that says, "click here for the coupon"
Does anybody have any ideas on the logic of this setup? I am thinking of doing the following:
- When the user clicks the graphic that says, "click here to print", that will be a link that opens a new window like displayOffer.php?id=123
the id variable will correspond to the coupon_id variable.
How would you guys go about tracking when the coupon has been displayed, when the user clicks print, and assigning unique coupon id#s to each coupon?
So far, I am thinking I will need the following DB tables setup: