I have a module which lists the top 3 products on my website by views that week. Every week it resets to 0. I would like for the top product in this list to be discounted by 15 percent, the second by 10 percent and the third by 5 percent. The discounts are managed by a discount_id column. I can easily accomplish this but the problem is that the list is constantly changing and I need the old discount_id to be put back in when the product drops out of the top 3 list. So what I need in simple terms is:
if product is in top 3 list, copy discount_id to old_discount_id and then change discount_id. If product is no longer in top 3 list, copy old_discount_id over to discount_id. I also need it to distinguish between the different discount rate for each of the top 3 products. Is there a better way of doing this? Thanks for your time.
if product is in top 3 list, copy discount_id to old_discount_id and then change discount_id. If product is no longer in top 3 list, copy old_discount_id over to discount_id. I also need it to distinguish between the different discount rate for each of the top 3 products. Is there a better way of doing this? Thanks for your time.
Comment