fixed tax country related bug in checkout
This commit is contained in:
parent
2553869978
commit
0f3912f6fd
@ -529,6 +529,32 @@ function materio_user_flatenize_form_values($ar_src, &$flat_ar){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function materio_user_uc_cart_checkout_start($order) {
|
||||||
|
// dsm($order);
|
||||||
|
$user = user_load($order->uid);
|
||||||
|
// dsm($user, 'user');
|
||||||
|
$member_profile = profile2_load_by_user($user, 'adherent');
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$correspondances = array(
|
||||||
|
"billing_country" => $location->uc_country_id,
|
||||||
|
);
|
||||||
|
// dsm($correspondances);
|
||||||
|
foreach ($correspondances as $order_field => $value) {
|
||||||
|
$order->{$order_field} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_form_alter().
|
* Implements hook_form_alter().
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user