PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Set price based on location and question

s2Member Plugin. A Membership plugin for WordPress®.

Set price based on location and question

Postby lucjager » April 10th, 2011, 7:04 am

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
User avatar
lucjager
Experienced User
Experienced User
 
Posts: 33
Joined: November 10, 2010

Re: Set price based on location and question

Postby peterhuk » April 10th, 2011, 3:52 pm

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..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Set price based on location and question

Postby lucjager » April 11th, 2011, 7:27 am

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 ;-)
User avatar
lucjager
Experienced User
Experienced User
 
Posts: 33
Joined: November 10, 2010

Re: Set price based on location and question

Postby Cristián Lávaque » April 11th, 2011, 10:20 pm

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?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Set price based on location and question

Postby lucjager » April 12th, 2011, 10:47 am

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
User avatar
lucjager
Experienced User
Experienced User
 
Posts: 33
Joined: November 10, 2010

Re: Set price based on location and question

Postby toddz88 » April 21st, 2011, 4:53 am

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.
User avatar
toddz88
Experienced User
Experienced User
 
Posts: 61
Joined: November 19, 2010

Re: Set price based on location and question

Postby Cristián Lávaque » April 21st, 2011, 12:58 pm

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.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron