If PMA is used with a discount module lilke uc_discounts_alt and in the mean time it's chosen a payment method whit the PMA Adjustment field leaved blank, it returns the following warning:
"warning: number_format() expects parameter 1 to be double, string given in C:\XAMPP\htdocs\drupal\sites\cosmeticaduepuntozero.com.store\modules\ubercart\contrib\uc_pma\uc_pma.module on line 203."
So I solved substituting the following code:
$ret['value'] = number_format(str_replace(variable_get('uc_currency_dec', '.'), ".", $ret['value']), 2);
with:
$clean_str = str_replace(variable_get('uc_currency_dec', '.'), ".", $ret['value']);
if ($clean_str == '') {
$ret['value'] = 0;
}
else {
$ret['value'] = number_format($clean_str, 2);
}
It works for me.
bye
tG
Comment | File | Size | Author |
---|---|---|---|
#2 | 964156.patch | 653 bytes | roderik |
Comments
Comment #1
keesje CreditAttribution: keesje commentedThe fix can be much simpler. I had the same problem here: Kerstbomen winkel. No discount module installed. Just put a 0 (zero) in every "adjustment" field that is left blank for active payment methods. Works for me ;).
Comment #2
roderikTrue, but when we're patching the module anyway... let's make it more robust.
Comment #3
roderik.
Comment #4
loparr CreditAttribution: loparr commentedThank you for this patch. warning message no longer appears.
Comment #5
chinita7 CreditAttribution: chinita7 commentedMy error is also gone. Thanks.
Comment #6
GiorgosKpatch works great
Comment #7
kopeboy CreditAttribution: kopeboy commentedThis is not right, cause now I see the line item even if adjustment is not present.
BEFORE:
Example with COD (I want to apply a fee):
Subtotal: 100
Discount 1: -10
COD fee: 5
Order total: 95
+ Errors in the log.
BEFORE:
Example with paypal (I apply no fee):
Subtotal: 100
Discount 1: -10
Order total: 90
+ Errors in the log.
NOW:
Example with paypal (I apply no fee):
Subtotal: 100
Discount 1: -10
PayPal Website Payments Standard fee: 0
Order total: 90
No errors in the log, but HORRIBLE for the user.
Comment #8
jimi CreditAttribution: jimi commentedSame warning today (after release drupal 6.33)
The patch apparently fixes the problem
(but new error with the paybox cgi module :
CGI error: order , path: ../[path]/module[paybox].cgi
I am in touch with the hotline paybox to solve it)