A-A+

Warning: number_format() expects parameter 1 to be double

2015年09月15日 编程技术 暂无评论

ecshop 配送设置是较常用的一个功能了,小虎博客在最近的一次系统设置方式设置时出现了如下的 bug:

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

这实际上是配送插件与 ecshop 不兼容所导致的,我们仔细看来检查一下配送插件里面免费额度为 0,而 ecshop 本身的 bug 导致了 $price 的值为空,所以在直接调用 number_format 的时候出现了上面的错误,找到了原因,再去解决就不难了,修改方式如下.

找到 includes\lib_common.php 的957~959行:

  1.  else  
  2.     {  
  3.         $price = number_format($price, 2, '.''');  
  4.     }  
  5. //修改为:  
  6.   else  
  7.     {  
  8.         if(!$price){  
  9.                 $price = 0;  
  10.         }  
  11.         $price = number_format($price, 2, '.''');  
  12.     }  

好了,清理一下后台的缓存,再去设置一下即可。

标签:

给我留言