[SOLVED] Change billing address in CB Paid Subscription

2 years 2 months ago #328578 by activha
During registration or new user there is no issue as the address fields are the same for information tab and CBSubs.

Both on backend and frontend the autoaction does not update the CBSubs fields in cbsubs_payment_baskets for the user.

I have tried both as a moderator from frontend or backend and as a user on frontend

Please Log in to join the conversation.

2 years 2 months ago #328580 by krileon
Not sure what to suggest. How are you confirming it's not working? Have tested it and can see that cb_subs_inv_first_name was updated fine in _comprofiler so seams to be working. Note this does not update the invoice name for existing invoices. This is strictly used for new invoices only. Existing invoices pull their information from the basket itself.


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 years 2 months ago #328582 by activha
So we're back to the old conflict basket/invoice :-)

We need to update the table cbsubs_payment_baskets with the correct data for name/addresses, not only the _comprofiler table. For all recurring payments the data (name/address...) seems to be taken from the basket while the customer may have changed its data a couple of times during the recurring time.

This means that what you call invoices (baskets) are wrong after a time for all recurring payments.

Is there a way to update the correct data apart from a direct change in the cbsubs_payment_baskets table ?

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #328586 by krileon

Is there a way to update the correct data apart from a direct change in the cbsubs_payment_baskets table ?

Use a Query action on onAfterUserUpdate, onAfterUpdateUser triggers and update the address information for their basket rows in _cbsubs_payment_baskets. There is no other way to do this.


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 years 2 months ago - 2 years 2 months ago #328594 by activha
Excellent idea, I forgot about query auto actions for this.

I think that this should be ok ?
UPDATE `#__cbsubs_payment_baskets`  SET `first_name` = '[firstname]', `last_name` = '[lastname]', `payer_name` = '[name]',`address_street` = '[cb_address]',`address_zipcode` = '[cb_zipcode]',`address_city` = '[cb_city]', `address_state` = '[cb_state]', `address_country` = '[cb_pays]', `contact_phone` = '[cb_phone]' [cb:if cb_company>"0"], `payer_business_name` = '[cb_company]' [/cb:if] WHERE `user_id` = '[user_id]'

But it will update all table rows. How could I simply update the last ones that exist at the time of the change ?
I think that changing the last existing invoice should be enough. Often customers complain that the last invoice arrived with the wrong address or person in charge in case of moves in the company.

Please Log in to join the conversation.

2 years 2 months ago #328599 by krileon
I believe you also have the option of just modifying "Customer address format" in CBSubs > Settings > Display > Invoices. It passes through normal user substitutions so you could for example replace [ADDRESS_FIRST_NAME] with [firstname] if you wanted.

How could I simply update the last ones that exist at the time of the change ?

Order by the id column so the most recent is first (e.g. `id` DESC) then apply LIMIT 1 so you only are updating the most recent entry. This should work fine since you're not joining any other tables since order by and limit in update queries is only allowed in single table queries.


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.192 seconds

Facebook Twitter LinkedIn