Hi all,i want to ask..Does anyone ever before create a discount system with php for ecommerce. I.e : Before discount,the price was $100,after discount the price become $85,and the $100 was stroked..Thanks..
A:
It's quite a short description, but I think you can create a table in your DB with associated to the item ID the discount percentage you want to apply...
Than on the aplication side you can fetch from the DB the original price, print it and after this the new price calculated easily by the original price and the discount percentage.
It's very easy :)
Lopoc
2009-09-21 17:43:08
Thanks a lot Lopoc.. :)
handoyo
2009-09-21 18:39:04
+3
A:
For changing text to be crossed out, use the <STRIKE> tag (Like this). The rest just involves multiplying current price by 1.00 - discount/100.0, or subtracting current_price * discount/100.0.
You can also use css (text-decoration:line-through;). Css is probably a better choice, really.
For example, a 15% discount means taking the price and multiplying by (1-15/100), which means price * 0.85.
Brian
2009-09-21 17:43:38