Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Copying Billing and Shipping Address Information

12 years 2 months ago - 12 years 2 months ago #214021 by edmundcheong
Say you have 2 address fields, billing address and shipping address.

If the shipping address is different, there's no issue. But if its the same, is there a functions to copy the billing address to the shipping address? Is there a plugin?

Example here: (but this is not a joomla cb solution) : www.encaffeinated.com/articles/view/copying_billing_and_shipping_address_information_with_jquery/

Thanks in advance,
Last edit: 12 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #214050 by krileon
You could create a delimiter field that is placed between the two sets of fields. That delimiter field would contain your button. You could then use CB Auto Actions to add jQuery to the profile edit and registration pages (see triggers dropdown, there's display triggers for both locations) that would copy the shipping input and push to the billing input on button click.

You could also have a checkbox field below the shipping field set and use CB Conditional to hide the billing fieldset with the checkbox saying something like "is shipping and billing address the same?". You'd then use CB Auto Actions and Field actions to check if that field is checked then push the shipping information to the billing information fields if you actually needed it stored to database for something.


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

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

12 years 2 months ago - 12 years 2 months ago #214235 by edmundcheong
Replied by edmundcheong on topic Re: Copying Billing and Shipping Address Information
Thanks for the help. It was really helpful!

Just one more thing.

I have created an auto action with the following attributes:

Title: Test Auto Action 1
Type: Field
Triggers: onBeforeUserProfileEditDisplay
User: Manually (Variable 1)
Access: Registered
Conditional: cb_contactaddress (not empty)

Field Action -
Field: cb_shippingaddress
Operator: Set (Field=value)
Value: [cb_contactaddress]


Okay, it seems to work when i click on "Edit Profile". That was really brilliant!

Just the part of creating a button in cb delimiter field, I cant seem to call the "auto action" which I have just created using the button.

I have renamed Triggers: onBeforeUserProfileEditDisplay to Triggers: getbillingaddress

And the cb delimiter field contains:

<Form Name ="form1" Method ="POST" ACTION = "getbillingaddress">
<INPUT TYPE = "Submit" Name = "Get Address" VALUE = "Get Address">
</Form>


How do you call an auto action using a button? Am I doing it wrongly?
Last edit: 12 years 2 months ago by edmundcheong.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #214254 by krileon
You would need to use a jQuery action and add jQuery to the page to react to the button click. The trigger you're using is correct, but the action shouldn't be Field based. The below jQuery should do the trick based off the input supplied below.

$( '#copyaddress' ).click( function() { $( '#cb_shippingaddress' ).val( $( '#cb_contactaddress' ).val() ) });

Also note you do not need the FORM element around your button in your delimiter field as it's invalid (profile edit is already a form). The below is what you should have for your button.

<input type="button" id="copyaddress" name="copyaddress" value="Copy Address" />


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.

12 years 2 months ago - 12 years 2 months ago #214258 by edmundcheong
Replied by edmundcheong on topic Re: Copying Billing and Shipping Address Information
Thank you so much!!! That really help..

I've been playing around with cb auto actions and it is a great plugin!!!

I see so many use for it..

Just one thing I need you to explain.. remember me saying:

I have renamed Triggers: onBeforeUserProfileEditDisplay to Triggers: getbillingaddress


If i rename the "trigger", how do I call the trigger? say for example in using:

1) a button?
2) or if I would like to call the trigger using a menu, how would the URL look like?

One more question, do you have more documentation on this plugin? And can you explain what the "users" condition mean for "automatic, user, manually and specific"? Sorry to trouble you with this..

Thanks again!
Last edit: 12 years 2 months ago by edmundcheong.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48708
  • Thanks: 8319
  • Karma: 1447
12 years 2 months ago #214259 by krileon
You can't create triggers like that. The trigger needs to be written in source and it's not possible to make one that dynamically responds to a button click. You must use jQuery so it can act on the DOM the instant the user clicks. Please see my previous post as I've provided the button HTML and jQuery for you (may need adjustments).


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