Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


DeeJay86

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!

Link to comment
Share on other sites

  • 5 months later...

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";

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

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
Link to comment
Share on other sites

  • 1 year later...

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";

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

  • 1 year later...

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...