Originally Posted by
s_mack
Thank you, and any hints on where to look would be appreciated.
Probably like this ...
Code:
/**
* Calculate the amount based on acceptable currencies
*/
function calc_order_amount($amount, $paypalCurrency, $applyFormatting = false) {
global $currencies;
$amount = ($amount * $currencies->get_value($paypalCurrency));
if ($paypalCurrency == 'JPY' || (int)$currencies->get_decimal_places($paypalCurrency) == 0) {
$amount = (int)$amount;
$applyFormatting = FALSE;
}
return ($applyFormatting ? number_format($amount, $currencies->get_decimal_places($paypalCurrency)) : $amount);
}
and
Code:
// tidy up all values so that they comply with proper format (number_format(xxxx,2) for PayPal US use )
if (!defined('PAYPALWPP_SKIP_LINE_ITEM_DETAIL_FORMATTING') || PAYPALWPP_SKIP_LINE_ITEM_DETAIL_FORMATTING != 'true' || in_array($order->info['currency'], array('JPY', 'NOK', 'HUF'))) {
if (is_array($optionsST)) foreach ($optionsST as $key=>$value) {
$optionsST[$key] = number_format($value, ((int)$currencies->get_decimal_places($paypalCurrency) == 0 ? 0 : 2));
}
if (is_array($optionsLI)) foreach ($optionsLI as $key=>$value) {
if (substr($key, 0, 8) == 'L_TAXAMT' && ($optionsLI[$key] == '' || $optionsLI[$key] == 0)) {
unset($optionsLI[$key]);
} else {
if (strstr($key, 'AMT')) $optionsLI[$key] = number_format($value, ((int)$currencies->get_decimal_places($paypalCurrency) == 0 ? 0 : 2));
}
}
}
Bookmarks