Skip to Content Skip to Menu

[#5539] CBsubs subscription price depending on a field

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 1 month ago #271227 by krileon

Can we get the basket page before all the information tab ? so
that the customer will check the price before registering

No, the basket relies on a user object. A user that isn't registered doesn't have one. Your conditions also would have no affect as there's no user object to condition off of.

Can we have a dynamic text in the plan depending upon the drop down field ? so that it's not a price change but only a text change explaining

CBSubs has no such feature. You'd have to write the jQuery for that then load it using CB Auto Actions.

Could I add an auto action code with jquery checking the dropdown field chosen on registration and showing the correct price on the CBsubs tab ?

Yes, that could work.

If yes what would be the trigger to use ?

The below trigger should work fine.

onBeforeRegisterFormDisplay

However, we tried to use afterdrawplan but the action writes the jquery code only to the first plan.
Can you suggest another trigger ? we want to write the jquery code to three plans to display three different prices

The jQuery only needs to be loaded once. What jQuery you supply though needs to be able to handle all 3 plans price being changed. Example as follows.

Code:
$( '#FIELD_NAME' ).on( 'change', function() { switch ( $( this ).val() ) { case 'N1': $( '#cbregProduct_PLAN_ID_1' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_2' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_3' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); break; case 'N2': $( '#cbregProduct_PLAN_ID_1' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_2' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_3' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); break; case 'N3': $( '#cbregProduct_PLAN_ID_1' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_2' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_3' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); break; case 'N4': $( '#cbregProduct_PLAN_ID_1' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_2' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); $( '#cbregProduct_PLAN_ID_3' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' ); break; } });

The above assumes all 3 plans will have different prices. If they're the same price the 3 lines can be reduced down to 1 like the below.

Code:
$( '#cbregProduct_PLAN_ID_1,#cbregProduct_PLAN_ID_2,#cbregProduct_PLAN_ID_3' ).find( '.cbregPint' ).html( 'DOLLARS' ).siblings( '.cbregPcts' ).html( 'CENTS' );


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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
9 years 1 month ago - 9 years 1 month ago #271380 by activha
Hi
Thanks for the idea this is something that we tried but it may bring problems if we want to use promotions or coupons at a later stage in our business model.

So we went the way with 10 plans monthly and annually, and simplifying things by using a lot of language substitutions to only alter language files when there are modifications.

However, we have a validation problem.
We show the plans at registration using a drop down field on the first tab which then condition the display of the selected plan on the first tab.
But is seems that the plan field only tries to validate on the first plan value, meaning that it this first plan value is not displayed, the field does not try to validate the second one and the user can register without the correct plan.
In this case he is registered with the default plan which is absolutely not the intention.

So can you change the cbsubs plan validation process so that it respect the drow down value selected on the first tab ?
Or can you suggest a jquery to add by auto action so that the validation process respects the plan displayed on the tab ? (based on your above code)

We had to write this to respect the validation process:
Code:
$('#cbf6425').on( 'change', function() { switch ($(this).val()) { case 'Professionnel': $('#cb_choix').change(function() { switch ($(this).val()) { case '0': $('input[id=cbpplan1]:radio').val(['1']); break; case '1' : $('#cb_lignes').change(function() { switch ($(this).val()) { case 'N1': $('input[id=cbpplan6]:radio').val(['6']); break; case 'N2': $('input[id=cbpplan39]:radio').val(['39']); break; case 'N3': $('input[id=cbpplan41]:radio').val(['41']); break; case 'N4': $('input[id=cbpplan40]:radio').val(['40']); break; case 'N5': $('input[id=cbpplan7]:radio').val(['7']); break; } }); } }); break; case 'Particulier': $('input[id=cbpplan10]:radio').val(['10']); break; break; } });

However this is not very functional as a clic on Particulier does not show the correct plan, only a second clic shows it.

Do you have any idea to simplify this or enhance it to make it work. This is a pity that we cannot have a validation process for plans based on something else than the first field plan.
Could you write something validating not the first tick field but showing a display elsewhere for instance ?

Thanks for helpind on this one
Last edit: 9 years 1 month ago by activha.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 1 month ago #271407 by krileon
Don't mark any plans as default and none should be selected. If all the plans are marked exclusive then a required error should be thrown when it sees no plan is selected. When they hide from CBSubs conditioning it should unselect the plan.

Are you trying to hide the entire plan selection it self and have it done from a field? Why do you need a field at all? Why not let users select the plan then have a field that you set using CBSubs Fields instead of doing the reverse?


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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
9 years 1 month ago #271418 by activha
Hi
We absolutely need to guide our users and not display all plans.
They have to select one radio box to choose between professional and personal
Then they have to answer two questions and only the relevant plan will be displayed. If not people are lost and do not select the correct one.

If we don't set a default plan we have problems for people buying through hikashop. When they log in the system does not recognize them as they don't have a subscription.

A validation process for plan would be the best.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
9 years 1 month ago #271424 by krileon
There is a validation process. The problem is you have a default plan selected. This means a plan is initially selected so there's nothing to validate as the required state has been met. Beyond that there's no further validation necessary. You could use jQuery on the before registration display form trigger to uncheck the default plan.


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 or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
9 years 1 month ago #271430 by activha

There is a validation process. The problem is you have a default plan selected. This means a plan is initially selected so there's nothing to validate as the required state has been met. Beyond that there's no further validation necessary...


No there is no real validation on the plans.
Even if we do not have a default plan selected, the validation process only occurs on the first tick of the first plan. Which means that if this plan is hidden because it is not relevant to the user, there is no validation for the plans and the step is simply ignored or the user may go to the next step and register without a subscription, then leading to inability to log in because of no subscription.

This was why we had to have a default plan, then use drop down fields, then use a jquery auto action. It would be much simpler that the validation process on the plan field respects the visible plan and validate only the visible plan and not the hidden ones.

And I know that you suggested putting the plan tab on the last position but it simply does not apply to our business model. We need to have the plans to be dependent on a field value and selected before submitting the user infos.

Can you make that the validation process respect the visible plans ? and that the error be shown on all plan ticks and not only the first one ?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum