Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Quite complex forms in GravityForms WordPress

  • SOLVED

I have a booking form for customers to sign up for our service. I'll give an abridged explanation of the service and options. My question is how to calculate the pricing with multiple options that affect each other.

The business is a mobile petting zoo and pony ride service. Example calculation:

Customer chooses size of zoo, base price for 1-1/2 hour duration party:
Small = $285
Large = $345

Customer adds pony rides (or not) 0 - 2 ponies:
No ponies added = $0
$70 per pony added to base package for 1-1/2 hour duration

Customer may add extra time to party:
No extra time = $0 added
Add 1/2 hour with no ponies
Small petting zoo adds $60/half-hour
Large petting zoo adds $80/half-hour
If ponies were added, each half-hour adds the base adder ($60 or $80) plus an additional $10 per pony, per half hour.

The formula for this would be, where:
B = base price ($285 or $345)
E = extension price per half hour ($60 or $80)
PE = extension price for pony per half hour ($10)
NP = number of ponies
NT = Amount of time extended, in units of 1/2 hour

Final Price = B + 70*NP + NT(E + PE)

I would love it if I could simply ask them for their preferences and then plug their answers into the above formula, however Gravity Forms doesn't yet support complex calculations based on form inputs.

Here's my question:
Can you tell me how to get Gravity Forms to compute the total price? I have started down the road of making conditional blocks of menu code (show this item if....), but it gets very nested and complicated and I'd much rather use some kind of "hooks" to pull previous answers numerically.

Can this be done?

Answers (2)

2011-10-21

Gabriel Reguly answers:

Hi Kevin,

I can code a custom solution for you, but will cost like $75.

Regards,
Gabriel


Kevin Smith comments:

That wouldn't be unreasonable. If you can code it according to what I've sketched out, I'm sure I could build on it from there (the real pricing scheme is even more complex, but I didn't want to go into the myriad details).

What I like about Gravity Forms is the ability to say, add a new option and have it simply update the "bottom line" price if a customer chooses it.

Would your custom solution be something I could hack and expand? I've done some work in PHP, including our whole web site (it's since been given to a web master who converted it to ASP), but I'm not an expert. I would need a little instruction on how to install whatever you write into my site.


Gabriel Reguly comments:

Hi Kevin,

Yes, I can code a solution you could expand.

But I assume you would like instant answers to the form selections, so the solution would need jQuery.

Would you be confortable with it?

Regards,
Gabriel

P.S. I will not be available to work this weekend, but next week would be fine.

2011-10-21

Luis Cordova answers:

I recommend you find a hosting that supports php5.3 and then get symfony2 framework tied into wordpress for this form, it would be an interesting project, sf2 then can handle these forms and calculations the way they should. Forget about making something that was not designed to do what you intend to do it. Use the right tools. This however is an entire project not something of $25 value.