[SOLVED] state dropdown

13 years 8 months ago #140519 by Joe028
Replied by Joe028 on topic Re:state dropdown
Oh, another thing I noticed. If I choose to edit the invoice address through the registration process, I am presented with the invoice-state drop down box. If I choose a state for example "Ohio", then when I save it and I check the phpmyadmin, the invoice-state field has a value of the abbreviated Ohio state, just "OH".

Please Log in to join the conversation.

13 years 8 months ago #140521 by cliffvt
Replied by cliffvt on topic Re:state dropdown
Joe

I saw the problem straight away!

The issue is that your cb_statedrop field has the options in FULL where the Invoice state field stores them in 2-digit codes.

So you would need to change your cb_statedrop fields to be:

AK
AL
AZ etc...

Then they will match!

You could also change your edit.front.invoice.xml to rather have the values show like this:

<option value="Alaska">Alaska</option>
<option value="Alabama">Alabama</option>
etc...

BUT the problem with that is that new features being implemented for VAT/GST will use those codes and it means that you are changing core stuff.

So I would go with using 2 letter codes in your field.

That will sort the problem.

Cheers

Cliff

Post edited by: cliffvt, at: 2010/08/23 20:16

Please Log in to join the conversation.

13 years 8 months ago #140527 by Joe028
Replied by Joe028 on topic Re:state dropdown
Wonderful. I will look into this in a bit and hopefully resolve it. Thank you very much for taking your time to help me out.

Joe

Please Log in to join the conversation.

13 years 8 months ago #140529 by Joe028
Replied by Joe028 on topic Re:state dropdown
Yes, indeed you solved my problem. Thanks. I opted to change the xml file to show the full name of the state, just a preference I have so that I can use my state dropdown box for searches and registration fields as well. I will never be charging a VAT or sales tax with the site I am using cbsubs on so I hope that I will never be confronted with any issues, but I did comment the xml file to remind myself later if it comes up.

Also I opted to put a default value for Country as United States since I am currently only set up to make sales in the United States. Also I commented out the "VAT number" field. I am hoping that none of what I just did creates more problems. I can't foresee any if I don't charge and VAT or sales tax.

Thanks again.

Joe

Please Log in to join the conversation.

13 years 8 months ago #140544 by krileon
Replied by krileon on topic Re:state dropdown
Your state field within Field Management must match CBSubs invoice state field drop-down. Please review the following source.

[code:1]
<select size="1" class="inputbox" id="address_state" name="address_state">
<option selected="selected" value="">--- Click to select state ---</option>
<optgroup label="U.S. - States">
<option value="AK">Alaska</option>
<option value="AL">Alabama</option>
<option value="AR">Arkansas</option>
<option value="AZ">Arizona</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DC">District of Columbia</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
.....
[/code:1]

Notice Alaska is actually stored in the database as AK. What this means is your drop-down should have values such as the following.

AK
AL
AR
AZ
etc...

and NOT the following.

Alaska
Alabama
Arkansas
Arizona
etc...

Please also note this transfer is only done ONE time and that's generally at registration. Now you maybe wondering how you get it to DISPLAY like Alaska, that's easy, simply use language strings such as the following example in CBs language files.

[code:1]
define( 'AK', 'Alaska' );
define( 'AL', 'Alabama' );
define( 'AR', 'Arkansas' );
define( 'AZ', 'Arizona' );
[/code:1]

This will cause the display to translate, but not the actual inputs value to translate giving you the same appearance as CBSubs invoice.

Optionally you CAN edit CBSubs invoice rendering by editing the XML found at components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/xml/edit.front.invoice.xml, but I do NOT recommend doing this unless you are absolutely sure and comfortable with the changes (take note that when you upgrade CBSubs your changes will be lost! make a back-up before upgrading!).

Post edited by: krileon, at: 2010/08/23 22:21


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.

13 years 8 months ago #140580 by Joe028
Replied by Joe028 on topic Re:state dropdown
Thanks to all you guy's help I have got it set exactly how I want it now. My .xml file was only modified to add the United States as the default value and I commented out all the "states" other than the US states.

I changed my dropdown box to the 2 character states, and added the code in the language file so it shows the full state name.

Then I added some css:
[code:1]
#cbfr_vat_number{display:none;}
[/code:1]

and now my .xml is pretty much the way it should be and the display is how I like it. Thanks again for the help.

Joe

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.262 seconds