iris lines designs

802 257 7391

JoomlaSolutions - and other discoveries

A place to keep track of and share CMS and CSS solutions

Feb 14

Paypal RSForm that allows user to set quantity in Paypal Cart

Posted by: barb

Tagged in: rsForms , php , PayPal , Joomla , extensions , Breezing Forms


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:

dropdown with quantities

This might have been OK, but when you got to the shopping cart you got this:

four copies quantity 1

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.

custom form

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.

Products Item price $79.00 Quantity:1

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:

form lets user know they can change quantity later

shopping cart showing update qty button

form with quantity and price adjusted


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:

  1. I set $business to the paypal account email address.
  2. I set $item_name to "Designed to Shine at $39.99"
  3. I set $amount to "Total1"  (see note #2 above)
  4. I added a line setting $undefined_qty to '1'
  5. I set $return to the url of the thank you page.
  6. 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, 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. ©2010 photo by Rich Kaszeta