Skip to Content Skip to Menu

CbSubs urgent issue

  • krileon
  • krileon
  • ONLINE
  • Posts: 48995
  • Thanks: 8373
  • Karma: 1454
4 days 26 minutes ago #340741 by krileon
Replied by krileon on topic CbSubs urgent issue
If you populate it from fields you don't need to make it mandatory. If country is all that's relevant you'd just need to be sure it's configured to populate the invoice country from field and you're done.

Note it only populates once during initial registration so you may want to use CB Auto Actions to push your country field into the cb_subs_inv_address_country hidden profile field using a Field action. The tax rates should then still apply fine and then you can either leave invoice address as non-mandatory or just turn it off (turning it off would require CB Auto Actions to synchronize entirely).


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.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 425
  • Thanks: 37
  • Karma: 3
  • Add-ons
3 days 23 hours ago #340742 by liaskas
Replied by liaskas on topic CbSubs urgent issue
Thank you Krileon... you realy give me hope!

So if these fields are filled, then we do not need mandatory or not-mandatory activation right?

Using CB Auto Actions is a great solution.

Can you please advise regarding the creation of auto action?

Is onCPayBeforeDrawSubscription a good trigger for this?

Type is Field?

I guess no conditions are needed... or we have to condition against non empty "cb_subs_inv_address_country"?

Action
Field -> cb_subs_inv_address_country
Operator -> ?
Value -> ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48995
  • Thanks: 8373
  • Karma: 1454
3 days 22 hours ago #340743 by krileon
Replied by krileon on topic CbSubs urgent issue

So if these fields are filled, then we do not need mandatory or not-mandatory activation right?

Correct, it should still calculate tax based off location as long as cb_subs_inv_address_country is filled. There's no internal checks that I can see that mandate the invoice address to be enabled. It's just entirely checking those profile fields directly. So how those fields get filled can be entirely up to you. You could for example completely turn off the invoice address fields and populate cb_subs_inv_address_country from your own field using CB Core Fields Ajax.

Can you please advise regarding the creation of auto action?

Is onCPayBeforeDrawSubscription a good trigger for this?

I'd probably just do them during registration and profile edit to synchronize them when necessary. For existing users you can just run a 1 time database query to synchronize them and then future profile edits/registrations will always synchronize. The below should work fine for this.

Global
Triggers: onAfterUpdateUser, onAfterUserUpdate, onAfterUserRegistration, onAfterNewUser
Type: Field
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1_YOUR_FIELD_HERE]
Operator: Not Equal To
Value: [var3_YOUR_FIELD_HERE]
Action
Field: cb_subs_inv_address_country
Operator: Set
Value: [YOUR_FIELD_HERE]

Replace YOUR_FIELD_HERE with the name of your country field (e.g. cb_country). The condition is to ensure it only synchronizes when that field changes as you don't want to do saves when not necessary. The above covers both frontend and backend registrations and user edits.

As for the query to quickly 1 time synchronize everyone the below should work. Be sure to replace PREFIX_ with whatever your database table prefix is.
Code:
UPDATE `PREFIX_comprofiler` SET `cb_subs_inv_address_country` = `YOUR_FIELD_HERE`

Now just turn off invoice address entirely and you're done. You won't have to bother your users for that during payments as it'll just use their profile field for it. If you need to synchronize more than country let me know and can provide adjustments to the above auto action to cover multiple fields, but in short you'd add OR conditions for those other fields to check for value changes then under Action add more field rows for them.


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.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 425
  • Thanks: 37
  • Karma: 3
  • Add-ons
3 days 22 hours ago #340744 by liaskas
Replied by liaskas on topic CbSubs urgent issue
Looks like problems do not end!

The Countries are not stored by the name of the county. They are stored by the iso2 code...

Example:
Greece is stored as GR
Bulgaria is stored as BG
...etc

so they are copied to the cb_subs_inv_address_country as iso2 code?

Is this correct?
 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48995
  • Thanks: 8373
  • Karma: 1454
3 days 21 hours ago #340745 by krileon
Replied by krileon on topic CbSubs urgent issue
I believe cb_subs_inv_address_country works with both country name and iso2. It should work fine and if not we can look into fixing it so it can work with either.


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.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48995
  • Thanks: 8373
  • Karma: 1454
3 days 2 hours ago #340746 by krileon
Replied by krileon on topic CbSubs urgent issue
Ok, proposed a change to CBSubs country conversion code so it can convert from ISO-2, ISO-3, or Name safely. This is currently pending review, but would allow your stored ISO-2 to work fine.

In addition to this I've tested that with "Invoicing address handling at payment time" in CBSubs > Settings > Display > Invoices set to "No invoicing address shown" and with cb_subs_inv_address_country populated with ISO-2, ISO-3, or Name the Tax Rate applies successfully. So this should fulfill your needs.

Once this change is reviewed and merged a new CBSubs build release will be available.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum