I need someone to help with a calculation I need to make within a form.
I have a product order form (on localhost at the moment so I can't post a url.) The customer can pay in advance (PayPal or cheque) or buy on 2 weeks credit. If they pay in advance they get 2 free products for every 10 they order. If they buy on credit they get 1 free product for every 10 they order.
I need the form to calculate and display how many free products they're getting. For example:
Order 27 on credit = 27 + 2 free
Order 27 paid in advance = 27 + 4 free
One of the challenges has been the only option for rounding is to round everything up. In this case everything needs to be rounded down in order for it to deliver the correct result.
What I think could work best is to be able to remove the last digit from the integer and then multiply by either 2 or 1 - depending on whether paying in advance or on credit respectively. For example, if paying in advance (where they get 2 free products for every 10 ordered) if they ordered 42 products they would get 4 (42 with the 2 dropped) x 2 = 8 free products. Another example, if they order 49, with payment in advance, they would also get 8 free booklets (49 with the 9 dropped = 4 x 2 free products.)
I also need the output to be available as a merge tag for inclusion in confirmations and notifications.
You can contact me at +1.608.692.8802 or shaunkwilson at gmail dot com to let me know if you have any questions or suggestions.