I'm creating a product order form and would like to apply a promotional discount to each order.
The discount will be "buy any 5 products and you get the lowest priced item free"
If buyer select 10 items then the 2 cheapest items amongst his selection will be free and so forth.
Say I have form fields for product name i.e. product1, product 2, etc. ; product price (which will be entered by me) i.e. price1, price2, etc. and purchase qty (entered by buyer) i.e. qty1, qty2, etc, how do I output :
1. The product name(s) of all free products based on buyer's selections?
2. The total price of the order after the discount?
Or is this even possible at all with acrobat javascript??
The way to do this is to loop through all entries and collect a list. Then sort the list
Now the two cheapest prices are at the top of the array, in index 0 and index 1. All the other info can be derived from this.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script