[SOLVED] Conditional Plans

8 months 2 weeks ago - 5 months 3 weeks ago #327966 by Stanby
[SOLVED] Conditional Plans was created by Stanby
I have a form on my website that users fill in and what I'd like to do is only present plans depending on how they answer those questions.

For instance, person 1 fills out the form and it redirects them to a page whereby they have 2 plans tailored to them, person 2 fills out the form with different data and it redirects them to a page whereby they have 3 plans that are tailored to them.

Is this possible or would I have to customise cb subs?

I haven't used community builder since 2007 and a lot has changed and I haven't actively developed anything for about 6 years so I'm a little rusty.

Please Log in to join the conversation.

8 months 2 weeks ago #327969 by krileon
Replied by krileon on topic Conditional Plans
I assume you mean during registration as yes that's doable. Edit your plan within CB Paid Subscriptions > Plans. Next navigate to the Workflows tab. That tab is where you'll be configuring your conditions. An example condition as follows.

Dynamic Conditions on other plans and CB Fields to show this plan and to allow subscribing to it
Conditions: These conditions must be met on the registration form to show this plan at registration:

Conditions on CB Fields to show plan at registration
And following CB Field: cb_occupation
Condition: = (Is equal to)
Value: teacher

This would display the plan during registration if the field cb_occupation has a value of teacher. No redirect is necessary though. It will dynamically change plan availability directly on the registration form.

You can also apply conditions to plans for users who are already registered by adding conditions under "Subscriptions upgrades workflows" as purchases made by already registered users are considered Upgrades.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 months 2 weeks ago #327973 by Stanby
Replied by Stanby on topic Conditional Plans
Thank you, excellent, community builder has come a long way.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

8 months 1 week ago - 8 months 1 week ago #328044 by Stanby
Replied by Stanby on topic Conditional Plans
Okay, I've had a chance to test the conditional plan, however, it seems I can only get one condition from one field, the membership price is based on 4 radio fields.

On our public pages, we have a quote generator that will give them the price of their membership (their membership includes insurance which is the reason for the price difference) and if they wish to purchase they enter their email and click continue which takes them to registration.

This equates to over 40 separate plans.

So, could you point me in the right direction, should I A.) grab the value from the database (public quote) and validate it is the right entry via their email and use that to select the correct plan (this would only be one conditional field then) or B.) is their a way to add a numeric value to the radio selections and place those in the registration form which will give them a price which then can be used to determine the plan?

Am I also right in assuming that I would need to use cb_query to achieve this or am I missing something that would be so much simpler?

I have a number of other questions, but I'll leave those until I get this first bit correct.

Please Log in to join the conversation.

8 months 1 week ago #328062 by krileon
Replied by krileon on topic Conditional Plans

Okay, I've had a chance to test the conditional plan, however, it seems I can only get one condition from one field, the membership price is based on 4 radio fields.

Unfortunately it can only condition off of 1 field at this time.

This equates to over 40 separate plans.

Maybe a better way to do this would be to have 1 plan and just modify its price using CBSubs Promotions. A negative promotion can be used to increase the price of a plan.

The way I'd probably do this is combine a few things to reduce the maintenance overhead. First create a Code field using CB Code Field. The code field should use PHP to calculate the price based off your other fields. Example as follows.

$price = 0;

if ( $user->get( 'cb_field1' ) == 'value1' ) {
    $price += 20; // add 20 to the price
}

if ( $user->get( 'cb_field2' ) == 'value2' ) {
    $price += 5; // add 5 to the price
}

return -$price;

Now you'd create a promotion that uses the value of that field as its promotion value. This promotion should be an always applied one instead of a coupon code and should be conditioned to only apply to your 1 specific plan. This should result in the price dynamically increasing entirely based off whatever criteria you want in your code field, which you can freely add to or adjust whenever you like. This also means you only need to maintain 1 plan, 1 promotion, and 1 field.

If you want to show them the code field during registration you'll need to combine it with CB Core Fields Ajax and turn on its Update On for all the fields the code field depends on. This will allow its display during registration to refresh. So for example the Update On with the above should have cb_field1 and cb_field2 selected and when those fields values change the code field will update.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Stanby

Please Log in to join the conversation.

8 months 1 week ago - 8 months 1 week ago #328066 by Stanby
Replied by Stanby on topic Conditional Plans
Do you have any holiday time coming up? May I kidnap you for a few weeks? (kidding) I promise no kidnapping. Thanks again much appreciated. My PHP knowledge is limited, well tucked away in a dusty corner of my brain somewhere.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.506 seconds

Facebook Twitter LinkedIn