网站开发 · 2025年4月24日

ecshop配送方式出错lib_common.php on line 959

 ecshop只带的配送方式BUG

只要不是正式商业版的ECSHOP都会出现 配送方式配置出错。提示

Warning: number_format() expects parameter 1 to be double, string given in D:\**\lib_common.php on line 959

Warning: number_format() expects parameter 1 to be double, string given in D:\**\lib_common.php on line 959

原因是配送插件里面的免费额度为0,ec本身的bug导致了$price的值为空值,直接调用number_format出现了错误。

修改:

将includes\lib_common.php 的957~959行:
  else
    {
        $price = number_format($price, 2, ‘.’, ”);
    }

修改为

  else
    {
        if(!$price){
                $price = 0;
        }
        $price = number_format($price, 2, ‘.’, ”);
    }

即可。