Page 1 of 1

Set price based on location and question

PostPosted: April 10th, 2011, 7:04 am
by lucjager
Hi Would it be possible with php to set the price for an product based on location or question.

I'll show you and example,

Asumme you have four price plans:
1: europe and old member : 10
2: europe and new member: 20
3: US and old member: 15
4: US and new member: 30

What i would like to see is an question: Where do you live, -> just an simple list, with in our example US and europe. And after that one is being done an question with: are you an old or new member?

And that he price in the "PRO" forms is being addepted to the qeustion asked,

I hope this would be possible!

Thanks,

Luc

Re: Set price based on location and question

PostPosted: April 10th, 2011, 3:52 pm
by peterhuk
Hi lucjager,

I am not a pro user yet, but this sounds doable. You will probably need to sort
out the conditionals first ie provide dropdown box for location or if you really
want to be flash use ajax to do a arin.net ip look up to discove loaction.

Old members, well once again use a php script to check wpdb users->user_registered
use php date command to get days from registration till current day.
what you decide is an old member can be placed in a compare ie:

if($registered_days > $number _of_days_that _equal_old_member)
$user = 'old_member_price_for lacation'
else
$user = 'new_member_price_for lacation'

pop the results (togather with any user choice) into a S2Member shortcode and
you should be home and dry.

Hope this helps

Pete..

Re: Set price based on location and question

PostPosted: April 11th, 2011, 7:27 am
by lucjager
current i just thought about two questions: in html:

Where do you live?
<select name="menu">
<option value="<?php $location = US; ?>">US</option>
<option value="<?php $location = EUR; ?>">Europe</option>
</select>

old member?
<select name="menu">
<option value="<?php $member= yes; ?>">Yes</option>
<option value="<?php $member= no; ?>">No</option>
</select>

php if member=yes and location = eur then $cost= 10.00
php if member=no and location = eur then $cost= 20.00
php if member=yes and location = US then $cost= 50.00
php if member=no and location = US then $cost= 30.00

[s2Member-Pro-PayPal-Form level="2" ccaps="" desc="test" ps="paypal" cc="EUR" ns="1" custom="yourlink.com" ta="0" tp="0" tt="D" ra="0.01" rp="" rt="D" rr="BN" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="US" captcha="0" /]

and replace ra="<?php echo $cost; ?>" with something like this,... but my php is not good enough ;-)

Re: Set price based on location and question

PostPosted: April 11th, 2011, 10:20 pm
by Cristián Lávaque
Hi Luc.

Maybe you can solve this in a simple way using a dropdown list for the amount field of your button. Take a look at this post and see if it gives you some ideas viewtopic.php?f=4&t=2860&p=8524#p8503

About the old/new member, it's easy. Show the modification button in the Login Welcome Page and will only be shown to old members, and the new registration button in the Membership Options Page will create a new account.

Does that help?

Re: Set price based on location and question

PostPosted: April 12th, 2011, 10:47 am
by lucjager
hi Christian,

I would like to integrate this in the pro forms ;-),

I just need two questions with different value which i can combine!
"so the are you and old member" should be an select box!

I hope this will be possible

Re: Set price based on location and question

PostPosted: April 21st, 2011, 4:53 am
by toddz88
I'd love to know if you found a way to do this. I'm also using s2mPro forms, and am hoping to use a single form/page/shortcode that can set the Price dynamically, based on a php conditional.

Re: Set price based on location and question

PostPosted: April 21st, 2011, 12:58 pm
by Cristián Lávaque
toddz88 wrote:I'd love to know if you found a way to do this. I'm also using s2mPro forms, and am hoping to use a single form/page/shortcode that can set the Price dynamically, based on a php conditional.


Maybe this video will help you http://www.s2member.com/custom-fields-d ... lly-video/

If you need to change them dynamically in the browser, instead of the server, you'll have to use JavaScript. Maybe these will be helpful WP Admin -> s2Member -> API / Scripting -> s2Member JS/API Globals.