• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Order form with different prices for different qty

Order form with different prices for different qty 6 years 2 months ago #37948

I've got an order form with items in various price breaks. How can I apply the different prices to the calculation and form total?

Example :
10-50 items 9.99
51-100 items 8.99
101-151 items 7.99

Thanks in advance.
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 2 months ago #37950

  • itadmin9
  • itadmin9's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Greetings Wintercorn!

To accomplish this, you need some Javascript in your form. I built a quick test and this works with the latest RSFormPro version.

First, you need a place in your form for both the entered quantity and the price. I tried to use a Free Text field but it didn't work, so I used a normal Text field. I labeled it "Price Each", then in the Attributes->Additional Attributes I added:
id="Price" disabled

The "disabled" prevents the user from changing it themselves, but the script can still change it.

The user-editable Quantity field was given:
id="QTY"

Then, in the Form Properties, under CSS/Javascript, I wrote this little script:
<script type="text/javascript">
function calculatePrice(){
    var q = document.getElementById('QTY').value;
    var price = 9.99;
    if(q>50 && q<=100) {
        price = 8.99;
    }
    if(q>100 && q<=150) {
        price = 7.99;
    }
    if(q>150) {
        price = 6.99;
    }
    document.getElementById('Price').value=price;
}
</script>

It isn't the simplest thing, but it isn't too complex, either.

I hope the helps.
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 2 months ago #37955

  • itadmin9
  • itadmin9's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
I forgot a step! Sorry:

On the Attributes on the Quantity field, add:
onChange="calculatePrice()"

otherwise the function never gets called. Sorry I missed that originally.
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 2 months ago #37958

Thanks for the reply. I can't quite get this to work :-( Are you able to export the form so I can test and modify?

Update : It's not changing the price at all. It only shows the base price regardless of quantity.

More update : function calculatePrice is not defined.
Last Edit: 6 years 2 months ago by wintercorn. Reason: more updaterer
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 2 months ago #37959

  • itadmin9
  • itadmin9's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
It sounds like you may have put the Javascript part into the CSS (top) field of the CSS/JavaScript page, instead of in to the JavaScript (bottom) part?
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 2 months ago #37962

No, they are in the correct places. Do you have an export of your working form?

Thanks
The administrator has disabled public write access.

Order form with different prices for different qty 6 years 1 month ago #37965

Sorry, given up on RSForm Pro :( Used J2Store instead B)
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!