Limit Shared Subscriptions based on user choice

2 months 2 weeks ago - 2 months 2 weeks ago #329994 by galanopd
Thanks but I had tried that too with no success.
Tried again now and the Integer field is not updating its value upon Option selection of the user...
Again, when I set the Integer field value manually in Profile Edit, then the discount is calculated properly and shown on the invoive before the user pays.


EDIT: For unknown reason, I checked again now and it works! I don't know why it wasn't working before. I always clean browser cache...

Case closed, thanks for your help!

EDIT2: I had to pay more attention before concluding it is working, sorry. The int field doesn't update, for sure
Attachments:

Please Log in to join the conversation.

2 months 2 weeks ago #329997 by krileon
Try setting a text field to [PLAN_OPTS_OPTION_USERLICENSES_P] in CBSubs Fields and see what it stores. It's possible the substitution is wrong so be sure to double check the option name. It may not like the underscore so you may also want to try [PLAN_OPTS_OPTION_USERLICENSESP]


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.

2 months 2 weeks ago - 2 months 2 weeks ago #330004 by galanopd
Steps followed

-Updated everything to the latest version
-Tried omitting underscore USERLICENSES_P -> USERLICENSESP
-Verified that substitution is not wrong, checked Option Name and even with copy/paste
-Verified that it doesn't push value upon selection (what I expect) but only upon renewal or upgrade completed.

So my conclusion is that Integration->CB Fields works fine BUT the value is not pushed before renewal or upgrade completion.
The latter is what I expect since the user needs to know the price before the transaction.

In my previous post www.joomlapolis.com/forum/255-developer-members-support/245045-limit-shared-subscriptions-based-on-user-choice?start=12#329994 I said it works when I set the value manually. This happens because after I set the value of the int field in edit profile, I click "update" so the new value is kept. Then I click to renew or upgrade my subscription and the discount is calculated correctly.

Please Log in to join the conversation.

2 months 2 weeks ago #330009 by krileon
CBSubs Fields is working fine then. Why do you need it to update the licenses field before subscribing? CBSubs Options itself is handling the price change so you don't need the code field to generate a discount as you can just set the price already properly discounted based off the number of licenses they chose. You should only need CBSubs Fields to update your field that you'll be using for CBSubs Family Plans share limit.

The only way I can think of at this point is to get rid of the code field for calculating the discount and just directly doing that in CBSubs Promotions, but I'm not sure if that'll work either. This would all be a strange workaround trying to avoid using CBSubs Options to its fullest. To do this you'd just set the discount amount similarly to how you've done in CBSubs Fields using the below.

[cb:if PLAN_OPTS_OPTION_USERLICENSES_P="ver-p-2"]3[cb:elseif PLAN_OPTS_OPTION_USERLICENSES_P="ver-p-3"]6[/cb:elseif][cb:else]0[/cb:else][/cb:if]


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.

2 months 2 weeks ago - 2 months 2 weeks ago #330014 by galanopd
It is a bit more complicated than this as I am trying to avoid too much overhead.

The code field holds 3 diff variables for the 3 diff plan types.
$licenses_p with discount options updates based on int field cb_lic_qty_p
$licenses_c1 with 20 discount options updates based on int field cb_lic_qty_c1
$licenses_c2 with more than 50 discount options updates based on int field cb_lic_qty_c2
The int fields are shown based on conditionals and all are connected in one code field.
Now this code field is passing its value to the promotion.
The issue is that if the int field is not updated the discount passed to the invoice will be based on the last kept value of the int field.
Using substitution in the promotion and combine all the above would be almost impossible.

Why do you need it to update the licenses field before subscribing?

Because the user must pay the correct amount based on Options that calculates price based on the amount of licenses chosen by the user
Option1 -> 2 -> +100%
Option2 -> 3 -> +200% and so on

Then based on the above I need somehow to calculate the right discount.

So there is no way to somehow update the int field upon option selection, right?

Please Log in to join the conversation.

2 months 2 weeks ago #330016 by krileon
I don't know what more to suggest. Your setup seams far more complicated than it needs to be. Don't try to apply a discount at all. Simply have that discount already factored into the price of the option. None of the integrations apply their changes early enough to be able to modify the field before payment so that your code field updates with that information to apply a discount.


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.

Moderators: beatnantkrileon
Time to create page: 0.191 seconds

Facebook Twitter LinkedIn