Hello,

I offer a service on my site that shows merchants prices on specific items so that my visitors can find the best price.

Here's the problem: Up until now I have used excel to clean up the data feeds and just went ahead and added all coupons to the excel file and then added a column with the final price in excel after any applicable coupons had been applied. Then I would insert this file into my MySQL database. Obviously, this method has problems. Sometimes coupons expire quickly and are hard to keep up with or the merchants add more which means changing the entire excel file and re-inserting in the database.

What I would like to do is create a coupons table that can be compared against the products table to see where the coupons need to be applied. This way I can compare the expiration date against the current date to see if the coupons is still usable.

This wouldn't be that tough but I need the products on the page to be sorted by price upon the customer landing on that page. This is easy to do with the way I have it set up now since I can just sort by the final price field that I created in excel. But I am assuming that a temporary table would be the way to go with the new method. Am I right?

Also, many coupons are just simple dollars off such as "Take $5 off any order over $50" but others are percentages like "Take 10% off any order over $75". How can I right a code that would be able to check if it's a dollars off or percentage coupon and still be able to place the right final price field into the temp table. I use some pretty complex temp tables on the site already but this seems like it would need to be some type of if else statement. But I don't know how this can be used when creating a temp table.

I hope this at least makes a little sense. Anybody got any ideas?

Thanks