[SOLVED] Conditional Plans

8 months 1 week ago #328072 by krileon
Replied by krileon on topic Conditional Plans
:laugh: Glad to be of help! Please let me know if you need any further instructions to get this setup. :) If you do choose to display the code field on registration it's going to show a negative number (this is due to the promotion needing to be negative) so if you really do need that behavior we'll need to do some extra work to format it nicely.


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 1 week ago #328087 by Stanby
Replied by Stanby on topic Conditional Plans
I'd forgotten just how much fun working on a project like this can be. Do you have a PM? Due to contractual obligations, I can't discuss what I'm doing openly, but I thought if I could show you and explain the challenges, you could perhaps give me your ideas on how to best achieve it, then if I am unable to do it myself I can pass some of the work onto a hungry developer.

I don't want to take up too much of your time though and only require your community builder expertise, I have until April to nail it all down.

Again, I appreciate your help.

Please Log in to join the conversation.

8 months 1 week ago #328088 by krileon
Replied by krileon on topic Conditional Plans
You can PM any confidential information directly to me using the link in my forum signature. You should see a "send me a private message" clickable link there.


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.

5 months 4 weeks ago #329100 by Stanby
Replied by Stanby on topic Conditional Plans

krileon wrote:

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.


Okay, everything is working except the promotion doesn't appear to be adding the -$price to the promotion. I think I am missing something somewhere.

Please Log in to join the conversation.

5 months 4 weeks ago - 5 months 4 weeks ago #329101 by krileon
Replied by krileon on topic Conditional Plans
Test your promotion with a static value to be sure it's even working as a condition or other parameter in the promotion could be wrong. Once you're sure the promotion itself is working you can set it to be based off your field.


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.

5 months 4 weeks ago #329103 by Stanby
Replied by Stanby on topic Conditional Plans
Will do, thanks.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.212 seconds

Facebook Twitter LinkedIn