Jump to content
Sign in to follow this  
DeeJay86

edir orders module - number_format() expects parameter 1 to be double, string given in...

Recommended Posts

I have the module installed, had been for a long time but after the new php version everything seems to be bongus, finally i get most errors made up but this edit_orders 5.0.9b addon still has a error that i cannot seem to get fixed.

The error is:

Warning: number_format() expects parameter 1 to be double, string given in /customers/*******/*******/httpd.www/admin/edit_orders.php on line 1740

 

And it appears as soonest i get into the edit_orders.php through pressing the "Edit Oder" button on an existing order.

 

 

Thanks in advance!

Share this post


Link to post
Share on other sites

Not without seeing lines 1730-1750 of the edit_orders.php file.

 

 

Hi! I know that this is a old tread but i have the same problem.

 

          '                    <td align="right" class="dataTableContent"><input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . number_format($order->totals[$i]['value'], 2, '.', '') . '" size="6"><input name="update_totals['.$i.'][class]" type="hidden" value="' . $order->totals[$i]['class'] . '"><input name="update_totals['.$i.'][id]" type="hidden" value="' . $shipping_module_id . '" id="' . $id . '[id]"></td>' . "\n";

Share this post


Link to post
Share on other sites

Have had the same problem today,

 

After a bit of searching I found a solution, basically the fix is to add (double) just after number_format(

 

 

<td align="right" class="dataTableContent">
<input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . number_format((double)$order->totals[$i]['value'], 2, '.', '') . '" size="6">

 

Being reasonably new to php & mysql I really don't understand why this works - maybe someone can explain :unsure:

Edited by ReDYeViL

Share this post


Link to post
Share on other sites

I reopen the thread because I have the same problem now. It worked fine until I changed hosting. I searched and the only solution that works for me is to add @ before number_format($order->totals[$i]['value'], 2, '.', '')

 

But not to be stuck, has this separately, It must be well

 

 @ number_format($order->totals[$i]['value'], 2, '.', '')

 

 

This is the full line edit_orders.php and edit_orders_ajax.php

<td align="right" class="dataTableContent"><input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . @ number_format($order->totals[$i]['value'], 2, '.', '') . '" size="6" onChange="obtainTotals()"><input name="update_totals['.$i.'][class]" type="hidden" value="' . $order->totals[$i]['class'] . '"><input name="update_totals['.$i.'][id]" type="hidden" value="' . $shipping_module_id . '" id="' . $id . '[id]"></td>' . "\n";

Share this post


Link to post
Share on other sites

Adding @ is never a good idea. All it does is suppress error messages. It would be better to figure out what went wrong in the first place and fix it once and for all.

 

Did your change of hosting involve an upgrade in PHP version? From what to what?

 

Most likely, the first parameter to the call ("string") has something bogus in it, such as , or . group separators, or a $ sign, or something mixed in with the numeric value expected. It would be good to print out the $order->totals[$i]['value'] amount and see what it has besides a number.

 

PHP ought to be able to convert a number as a string, or an integer value, to a real (double) value. If it can't, that sounds like a PHP bug.

Share this post


Link to post
Share on other sites

Todays record for dragging up the oldest post is awarded to @@MrPhil :D

 

:D no comment :thumbsup:


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

In my defense, they were advocating something hazardous that I felt should be corrected. If I had noticed this post a year ago, I would have commented then.

Share this post


Link to post
Share on other sites

Have had the same problem today,

 

After a bit of searching I found a solution, basically the fix is to add (double) just after number_format(

 

 

<td align="right" class="dataTableContent">
<input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . number_format((double)$order->totals[$i]['value'], 2, '.', '') . '" size="6">
Being reasonably new to php & mysql I really don't understand why this works - maybe someone can explain unsure.gif

 

 

 it is the solution!

 

<td align="right" class="dataTableContent"><input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . number_format($order->totals[$i]['value'], 2, '.', '') . '" size="6"><input name="update_totals['.$i.'][class]" type="hidden" value="' . $order->totals[$i]['class'] . '"><input name="update_totals['.$i.'][id]" type="hidden" value="' . $shipping_module_id . '" id="' . $id . '[id]"></td>' . "\n";

Replace With:

<td align="right" class="dataTableContent"><input name="update_totals['.$i.'][value]" id="'.$id.'[value]" value="' . number_format((double)$order->totals[$i]['value'], 2, '.', '') . '" size="6"><input name="update_totals['.$i.'][class]" type="hidden" value="' . $order->totals[$i]['class'] . '"><input name="update_totals['.$i.'][id]" type="hidden" value="' . $shipping_module_id . '" id="' . $id . '[id]"></td>' . "\n";
Edited by quetevendo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×