Skip to Content Skip to Menu

[SOLVED] CB to Virtuemart 2 Country and State fields

  • slingshot
  • slingshot
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
12 years 4 months ago - 12 years 2 months ago #202580 by slingshot
I'm using CB 1.8 with CB Auto Actions 3.0 and have the VirtueMart 2.x auto action setup to sync my CB user data with VM. After a user adds a product to the cart and goes to the check out everything syncs fine (name, address, etc) EXCEPT the Country and State.

I'm sure this has to do with the fact that the Country and State fields in VM are drop downs - and are only text fields in CB. I tried to change them to select drop downs in CB but the data still doesn't sync.

The user still just gets an error when they first got to the cart letting them know that they don't have their Country and State entered yet.

Is there some other workaround to resolve this? Thanks in advance for any help!!!

J 2.5.4
CB 1.8
VM 2.0.6
Last edit: 12 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago #202596 by krileon
The values in VM must match the values in CB. For example if the value of the option of the dropdown select is "USA" for example then the value in CB must also be "USA". It also does not sync in VM. It only syncs on the trigger you specified (after profile upgrade for example).


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.

  • slingshot
  • slingshot
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
12 years 4 months ago #202604 by slingshot
Replied by slingshot on topic Re: CB to Virtuemart 2 Country and State fields
Here is the CB registration form code for my Country drop down select field:

<select name="cb_countryus" id="cb_countryus" class="required inputbox">
<option value=""> </option>
<option value="United States" id="cbf37">United States</option>

Now, here is the VM registration form code for the Country drop down select field:

<select id="virtuemart_country_id" name="virtuemart_country_id" class="virtuemart_country_id">
<option value="" selected="selected">-- Select --</option>
<option value="223">United States</option>

For some reason VM uses a value of 223 for the United States (something do to with country code perhaps). I am unable to edit that within VM.

As you can see the CB field uses the value of "United States" and I don't see an option to change that within the field management area.

So, how can I tweak the value of my CB field to match VM? I would have to make it "223" for the US and it should work perfectly.

How can I be the only one to have this issue?! I can't find anyone else online asking these questions!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago #202631 by krileon
You'll have to edit your country field and change it to 223. You can then translate it from 223 to United States using language strings so when users edit the field they see United States instead of 223. Example to translate is as follows.

Old Method:
define( '223', 'United States' );

New Method:
'223' => 'United States',


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.

  • rustle44
  • rustle44
  • OFFLINE
  • Posts: 40
  • Thanks: 4
  • Karma: 1
12 years 2 months ago - 12 years 2 months ago #208120 by rustle44
hey Guys here is the language thread for USA & Canad for the VM auto action (old way)
**** IMPORTANT
I had to edit the country code for Canada (38) as it caused a conflict with the state code for Oregon (also 38)
So I had to log into phpmyadmin and edit the db `jos_virtuemart_countries`

so i changed Canada to '388' to avoid the conflict - use any number you want that is not already taken
Once you have done this go to the db `jos_virtuemart_states` and change the 13 provinces/territories for Canada to match the country code

In addition I had to change the state code for
WI, NH, , MA, FL, IN, CA, AR, ARZ, AL

as these states ended up conflicting with the main list selector in the cb admin.
so if you look closely below you will see that I added 2 digit before each state code in the `jos_virtuemart_states`
*******

//Country and States Codes
DEFINE( '223', 'United States' );
DEFINE( '38', 'Canada' );
DEFINE( '232', 'US Virgin Islands' );
DEFINE( '246', 'Canada TE' );
DEFINE( '172', 'Puerto Rico' );
DEFINE( '88', 'Guam' );

DEFINE( '1001', 'Alabama' );
DEFINE( '1002', 'Alaska' );
DEFINE( '1003', 'Arizona' );
DEFINE( '4', 'Arkansas' );
DEFINE( '1005', 'California' );
DEFINE( '6', 'Colorado' );
DEFINE( '7', 'Connecticut' );
DEFINE( '8', 'Delaware' );
DEFINE( '9', 'District Of Columbia' );
DEFINE( '1010', 'Florida' );
DEFINE( '11', 'Georgia' );
DEFINE( '12', 'Hawaii' );
DEFINE( '13', 'Idaho' );
DEFINE( '14', 'Illinois' );
DEFINE( '1015', 'Indiana' );
DEFINE( '16', 'Iowa' );
DEFINE( '17', 'Kansas' );
DEFINE( '18', 'Kentucky' );
DEFINE( '19', 'Louisiana' );
DEFINE( '1020', 'Maine' );
DEFINE( '21', 'Maryland' );
DEFINE( '22', 'Massachusetts' );
DEFINE( '23', 'Michigan' );
DEFINE( '24', 'Minnesota' );
DEFINE( '25', 'Mississippi' );
DEFINE( '26', 'Missouri' );
DEFINE( '27', 'Montana' );
DEFINE( '28', 'Nebraska' );
DEFINE( '29', 'Nevada' );
DEFINE( '1030', 'New Hampshire' );
DEFINE( '31', 'New Jersey' );
DEFINE( '32', 'New Mexico' );
DEFINE( '33', 'New York' );
DEFINE( '34', 'North Carolina' );
DEFINE( '35', 'North Dakota' );
DEFINE( '36', 'Ohio' );
DEFINE( '37', 'Oklahoma' );
DEFINE( '38', 'Oregon' );
DEFINE( '39', 'Pennsylvania' );
DEFINE( '40', 'Rhode Island' );
DEFINE( '41', 'South Carolina' );
DEFINE( '42', 'South Dakota' );
DEFINE( '43', 'Tennessee' );
DEFINE( '44', 'Texas' );
DEFINE( '45', 'Utah' );
DEFINE( '46', 'Vermont' );
DEFINE( '47', 'Virginia' );
DEFINE( '48', 'Washington' );
DEFINE( '49', 'West Virginia' );
DEFINE( '1050', 'Wisconsin' );
DEFINE( '51', 'Wyoming' );

DEFINE( '52', 'Alberta' );
DEFINE( '53', 'British Columbia' );
DEFINE( '54', 'Manitoba' );
DEFINE( '55', 'New Brunswick' );
DEFINE( '56', 'Newfoundland and Labrador' );
DEFINE( '57', 'Northwest Territories' );
DEFINE( '58', 'Nova Scotia' );
DEFINE( '59', 'Nunavut' );
DEFINE( '60', 'Ontario' );
DEFINE( '61', 'Prince Edward Island' );
DEFINE( '62', 'Quebec' );
DEFINE( '63', 'Saskatchewan' );
DEFINE( '64', 'Yukon' );
Last edit: 12 years 2 months ago by rustle44.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum