Posted by: ci-dubi-je-wi on Feb 14, 2012
How I spent my Valentines' Day while my musician husband was on the road....
working on a site that needed a form to collect information along with a paypal button for payment.
I had built the form in BreezingForms chosen in part because of their built in Paypal support, however, when I got the paypal account set up and put in the button, it led to a paypal payment form where the user could not alter the quantity. What if someone wanted to order two or more of my products?
I did not find the BreezingForms website particularly helpful, and got no response from a ticket submitted, so I decided to re-subscribe to rsForms which I had used on other sites in the past.
Lo and behold, with their Paypal plugin and their single product option I was still getting the same results -- a shopping cart with one item and no option to change quantity. Their multiple products option looked promising -- sort of -- and I tried this:
This might have been OK, but when you got to the shopping cart you got this:
Item price $159.96 Quantity:1 just didn't seem to convey the transaction accurately.
Next I tried the rsForm custom paypal script that their tech support suggested in response to my ticket. Below is the form generated by the script that you upload to rsForms using their restore tool.
While this let the user set the quantity in the form there were other problems: The shopping cart was even less accurate about what was being purchased and the price. And the price wasn't even right! My client would lose the $1.98 that had been dropped because the formula parsed an integer of the price before multiplying by the quantity.
Some research on PayPal -- pretty frustrating at that -- finally led me to the key: I needed to be able to pass "undefined_quantity=1" along with the other parameters the form script was sending to Paypal.
Here's the final solution:
Yeah! So here's what I needed to change from the solution the rsForms tech support suggested:
1. I used the plugin Paypal field for a single product and set the price there.
2. I used the plugin Paypal Total field (and changed the name to total1 because I hadn't yet deleted the script solution total field.)
3. I modified the provided script as follows:
- I set $business to the paypal account email address.
- I set $item_name to "Designed to Shine at $39.99"
- I set $amount to "Total1" (see note #2 above)
- I added a line setting $undefined_qty to '1'
- I set $return to the url of the thank you page.
- I added a string to pass the undefined_quantity set to $undefined_qty.
This probably could have been done directly, but I struggled with the syntax and found something that worked.
I've tried to paste the code here, tried running code through postables.com, tried adding a screenshot of the code -- when I do, I can't save my blog post. I give up! Refer to the rsforms blog and my notes above.