|
@@ -476,6 +476,14 @@ function materio_user_uc_cart_checkout_form_alter(&$form, &$form_state, $form_id
|
|
// dsm($member_profile, "member_profile");
|
|
// dsm($member_profile, "member_profile");
|
|
|
|
|
|
$location = (object) $member_profile->field_adresse['und'][0];
|
|
$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");
|
|
// dsm($location, "location");
|
|
|
|
|
|
// $phone_field = field_get_items('profile2', $member_profile, 'field_private_phone');
|
|
// $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_city" => $location->locality,
|
|
// "billing_zone" => ,
|
|
// "billing_zone" => ,
|
|
"billing_postal_code" => $location->postal_code,
|
|
"billing_postal_code" => $location->postal_code,
|
|
- "billing_country" => $location->country,
|
|
|
|
|
|
+ "billing_country" => $location->uc_country_id,
|
|
);
|
|
);
|
|
|
|
|
|
foreach ($correspondances as $order_field => $value) {
|
|
foreach ($correspondances as $order_field => $value) {
|