Fields/Subscription dependencies

1 year 9 months ago - 1 year 9 months ago #329748 by galanopd
Fields/Subscription dependencies was created by galanopd
Hi,
  1. When a user upgrades his plan e.g. from planA to planB, I need some fileds to change their values. I can make this work by changing Intergrations->CBfields within each plan but there is a limitation in the amount of fields available for this action, only 10. What if I need more fields to change, should I implement this with AutoActions and if yes, how?
  2. A user can Subscribe, Unsubscribe from and Re-subscribe to a plan. Is it possible for a user to be able to Delete a subscription (like Administrator can) or somehow disable re-subscribing to the plan he was before the upgrade in case he unsubscribes from the active one?
  3. Is it possible when a user upgrades from planA to planB, the required and related to planB fields to appear before upgrading? What happens now is that the user upgrades from planA to planB and then only if he decides to edit his profile the system doesn't allow to save it unless the required fields are filled. So, if he doesn't edit his profile, he will go on having planB and the required fields empty.
  4. In the following scenario I have a problem upgrading to PlanB1 or PlanB2 when user unsubscribes from any child plan of parent PlanA but doesn't unsubscribe from their parent PlanA. The message says that PlanA has mandatory options PlanA1 and PlanA2. There is no problem upgrading to PlanB1or PlanB2 as long as the user is subscribed to any child plan of PlanA.
    PlanA (parent plan)
    -PlanA1 (child plan)
    -PlanA2 (child plan)
    PlanB (parent plan)
    -PlanB1 (child plan)
    -PlanB2 (child plan)
    I have tried changing PlanA and PlanB (root plans) to non-exclusive but it didn't work. Moreover, all child plans need to be exclusive.
Thank you

Please Log in to join the conversation.

1 year 9 months ago #329751 by krileon
Replied by krileon on topic Fields/Subscription dependencies

When a user upgrades his plan e.g. from planA to planB, I need some fileds to change their values. I can make this work by changing Intergrations->CBfields within each plan but there is a limitation in the amount of fields available for this action, only 10. What if I need more fields to change, should I implement this with AutoActions and if yes, how?

Using CB Auto Actions for that would be the best approach then. You can use a Field action with the below then you'll be able to change as many fields as you like.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Not Equal To
Value: A

Be sure to replace PLAN_ID_HERE with the actual id of your plan as found in CBSubs > Plans.

A user can Subscribe, Unsubscribe from and Re-subscribe to a plan. Is it possible for a user to be able to Delete a subscription (like Administrator can) or somehow disable re-subscribing to the plan he was before the upgrade in case he unsubscribes from the active one?

It is not possible for them to delete a subscription. They can only unsubscribe. Why do you need to delete a subscription?

Is it possible when a user upgrades from planA to planB, the required and related to planB fields to appear before upgrading? What happens now is that the user upgrades from planA to planB and then only if he decides to edit his profile the system doesn't allow to save it unless the required fields are filled. So, if he doesn't edit his profile, he will go on having planB and the required fields empty.

No, it is not possible to request for them to complete several fields during the subscription process. They would have to do that after subscribing in profile edit.

In the following scenario I have a problem upgrading to PlanB1 or PlanB2 when user unsubscribes from any child plan of parent PlanA but doesn't unsubscribe from their parent PlanA. The message says that PlanA has mandatory options PlanA1 and PlanA2. There is no problem upgrading to PlanB1or PlanB2 as long as the user is subscribed to any child plan of PlanA.

That's working as intended. They have an active subscription to Plan A and its child plans are set to Exclusive, which is also Mandatory/Required in CBSubs. That means they must have an active child plan of Plan A or it's going to throw a validation error. They would need to unsubscribe from Plan A in this case.


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.

1 year 9 months ago - 1 year 9 months ago #329756 by galanopd
Replied by galanopd on topic Fields/Subscription dependencies

Using CB Auto Actions for that would be the best approach then. You can use a Field action with the below then you'll be able to change as many fields as you like.

I suppose that Condition1 has var3=$this->status AND Condition2 var2=$this->plan_id. So how do I declare the options for the fields that I need?

It is not possible for them to delete a subscription. They can only unsubscribe. Why do you need to delete a subscription?

Actually I don't need to delete a subscription but I don't want the user to be able to go back to the old plan and re-subscribe. For instance, from a personal plan he upgraded to a business one. I don't want him to move back and forth. Once in a business plan he has to go on having a business profile and from there upgrade to allbusiness plans. But he has the option to unsubscribe from the business plan and find himself being back to the personal plan. In my case I need to deactivate the Unsubscribe button for the child plans but not for the Parent ones. In case I deactivated it, it is deactivated from all plans and then the user can't change parent plans as he is not allowed to do so as parent plans are Lifetime ones. Maybe if there was a way to unsubscribe automatically from parent plan if he unsubscibes from all child plans? Is this possible?

No, it is not possible to request for them to complete several fields during the subscription process. They would have to do that after subscribing in profile edit.

I think that this is very important (especially in my case). Users shouldn't be able to upgrade without filling out the mandatory fields. This is succesfully implemented during registration using conditionals but during upgrade? I will end up having e.g. users upgraded to business profiles with empty business address fields or even business names! One way would be to disallow the upgrade from personal to business?

That's working as intended. They have an active subscription to Plan A and its child plans are set to Exclusive, which is also Mandatory/Required in CBSubs. That means they must have an active child plan of Plan A or it's going to throw a validation error. They would need to unsubscribe from Plan A in this case.

Ok this is understood, thanks

Please Log in to join the conversation.

1 year 9 months ago #329759 by krileon
Replied by krileon on topic Fields/Subscription dependencies

I suppose that Condition1 has var3=$this->status AND Condition2 var2=$this->plan_id. So how do I declare the options for the fields that I need?

All you need to do is change PLAN_ID_HERE in my example to whatever your plans actual id id. My above examples show how to run custom behavior for when a plan is activated and deactivated.

Actually I don't need to delete a subscription but I don't want the user to be able to go back to the old plan and re-subscribe. For instance, from a personal plan he upgraded to a business one. I don't want him to move back and forth. Once in a business plan he has to go on having a business profile and from there upgrade to allbusiness plans. But he has the option to unsubscribe from the business plan and find himself being back to the personal plan. In my case I need to deactivate the Unsubscribe button for the child plans but not for the Parent ones. In case I deactivated it, it is deactivated from all plans and then the user can't change parent plans as he is not allowed to do so as parent plans are Lifetime ones. Maybe if there was a way to unsubscribe automatically from parent plan if he unsubscibes from all child plans? Is this possible?

You can use CB Auto Actions with my above examples to delete subscriptions, unsubscribe from them, or subscribe to them. So I suppose that's a way for you to implement whatever custom logic you're needing.

If I understand correctly someone registers as Personal, which is free lifetime, and then upgrades to Business. You then don't want them renewing Personal. In that case edit Personal then under the Price tab turn off renewals so it can't be renewed.

I think that this is very important (especially in my case). Users shouldn't be able to upgrade without filling out the mandatory fields. This is succesfully implemented during registration using conditionals but during upgrade? I will end up having e.g. users upgraded to business profiles with empty business address fields or even business names! One way would be to disallow the upgrade from personal to business?

I don't have a solution for you beyond redirecting them to profile edit and asking them to fill out the business section. I assume this would only be hurting them so there isn't really a reason for them to personally not fill that out. You could do the redirect during login or even after payment complete if that information is empty. We don't currently have a way to require additional fields during the payment process, but it's something we'd like to implement; it's tricky though since we don't want that data being pushed to profile until payment is confirmed so we'd basically need a "staging" area to temporarily hold that profile data then once payment completes push to profile.


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.

1 year 9 months ago - 1 year 9 months ago #329762 by galanopd
Replied by galanopd on topic Fields/Subscription dependencies

All you need to do is change PLAN_ID_HERE in my example to whatever your plans actual id id. My above examples show how to run custom behavior for when a plan is activated and deactivated.

I was asking about the fields of each plan but I think I found it by adding their values in the Action tab. Thanks

If I understand correctly someone registers as Personal, which is free lifetime, and then upgrades to Business. You then don't want them renewing Personal. In that case edit Personal then under the Price tab turn off renewals so it can't be renewed.

This it doesn't seem to be working as expected for my case... When I unsubscribe from Business even though Personal is set to Non-renewable, I am back to an activated Personal plan. Both Personal and Business are child plans of the same parent plan. It does work though when I unsubscribe from Personal, then I am not allowed to re-subscribe to it.

I don't have a solution for you beyond redirecting them to profile edit and asking them to fill out the business section. I assume this would only be hurting them so there isn't really a reason for them to personally not fill that out.

You are correct in this...

You could do the redirect during login or even after payment complete if that information is empty.

I tried CB Login workflows->URL for first login visit-> MyURL/cb-profile-edit leaving empty both Configuration->Registration->First Login Redirect and module CBLogin->Login Options->Login Redirection URL and it doesn't redirect to profile edit but only to profile view. Maybe because I have activated 2 step verification of loginguard MyURL/component/loginguard/?view=methods&layout=firsttime?
EDIT: I think 2-step verification is irrelevant as it works when I set module CBLogin->Login Options->Login Redirection URL->MyURL/cb-profile-edit but this is for regular redirects and not registration/upgrade one-off.

We don't currently have a way to require additional fields during the payment process, but it's something we'd like to implement; it's tricky though since we don't want that data being pushed to profile until payment is confirmed so we'd basically need a "staging" area to temporarily hold that profile data then once payment completes push to profile.

Fully understood

Please Log in to join the conversation.

1 year 9 months ago #329764 by krileon
Replied by krileon on topic Fields/Subscription dependencies

This it doesn't seem to be working as expected for my case... When I unsubscribe from Business even though Personal is set to Non-renewable, I am back to an activated Personal plan. Both Personal and Business are child plans of the same parent plan. It does work though when I unsubscribe from Personal, then I am not allowed to re-subscribe to it.

Is Personal a free lifetime plan? If that's the case be sure free lifetime plans create subscriptions in CBSubs > Settings > Global otherwise they don't have any subscription checks to determine if an subscription is even a renewal or not. Both Personal and Business plans should be marked exclusive as well.

I tried CB Login workflows->URL for first login visit-> MyURL/cb-profile-edit leaving empty both Configuration->Registration->First Login Redirect and module CBLogin->Login Options->Login Redirection URL and it doesn't redirect to profile edit but only to profile view. Maybe because I have activated 2 step verification of loginguard MyURL/component/loginguard/?view=methods&layout=firsttime?
EDIT: I think 2-step verification is irrelevant as it works when I set module CBLogin->Login Options->Login Redirection URL->MyURL/cb-profile-edit but this is for regular redirects and not registration/upgrade one-off.

Use non-SEO URLs for redirects or any URL parameter really. Below is the URL for profile edit. It will SEO during routing.

index.php?option=com_comprofiler&view=userdetails

You'll probably only want this to happen if they haven't filled out your business fields and are subscribed to the business plan. You'll need CB Auto Actions for that. The below should work fine for this, but since you're using a 3rd party extension that interrupts login flow it may not.

Global
Triggers: onAfterUserLoginSuccess
Type: Redirect
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Subscriptions
User: Action User
Operator: Has
Plans: SELECT_BUSINESS_PLAN_HERE
Status: Active
Condition 2
Field: SELECT_BUSINESS_ADDRESS_FIELD_HERE
User: Action User
Operator: Empty
Action
URL: index.php?option=com_comprofiler&view=userdetails
Message:
You are a business subscriber, but have not completed your business profile. Please complete your business profile for best experience.

CB Auto Actions is extremely powerful. As you can see there's A LOT you can do with it. The URL can be customized even further as well. For example if you want it to use a specific menu item then add the following to the URL.

&Itemid=MENU_ID_HERE

If you want it to link to a specific tab then add the following to the URL.

&tab=TAB_ID_OR_NAME_HERE


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: galanopd

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.215 seconds

Facebook Twitter LinkedIn