fixed country ID on uc_checkout_form

This commit is contained in:
Bachir Soussi Chiadmi 2014-09-05 16:10:29 +02:00
parent ab40bcf861
commit 80e491f1d8

View File

@ -476,6 +476,14 @@ function materio_user_uc_cart_checkout_form_alter(&$form, &$form_state, $form_id
// dsm($member_profile, "member_profile");
$location = (object) $member_profile->field_adresse['und'][0];
# convert country code to UC country ID (pfff)
$countries = db_query("SELECT country_id, country_iso_code_2 FROM {uc_countries} WHERE version > :version", array(':version' => 0))->fetchAllKeyed();
foreach ($countries as $country_id => $country_code) {
if($location->country == $country_code){
$location->uc_country_id = $country_id;
break;
}
}
// dsm($location, "location");
// $phone_field = field_get_items('profile2', $member_profile, 'field_private_phone');
@ -497,7 +505,7 @@ function materio_user_uc_cart_checkout_form_alter(&$form, &$form_state, $form_id
"billing_city" => $location->locality,
// "billing_zone" => ,
"billing_postal_code" => $location->postal_code,
"billing_country" => $location->country,
"billing_country" => $location->uc_country_id,
);
foreach ($correspondances as $order_field => $value) {