ecshop订单中配送方式报错

警告内容:Warning: number_format() expects parameter 1 to be double, string given in D:\wamp\www\ecshop_old\includes\lib_common.php on line 966

 

解决这个问题的时候,一开始我也是先到网上查看相关的解决方案,

大部分都说是lib_common.php的price_format ()里面的$price变量没有判断$price为空时调用number_format()函数出错,

然而ecshop2.7.3上面已经加了相应的判断:if($price==='') { $price=0; }

  所以问题不在这儿,我又找到了订单里面编辑配送方式的对应的代码,发现$shipping_list[$key]['free_money'] = price_format($shipping['configure']['free_money'])的这个里面的$shipping['configure']是序列化的,但是ecshop里面并没有进行反序列化的处理,所以导致$shipping['configure']['free_money']的值是'a',这样在price_format ()里面并没有判断他不是数字,所以出错,现在的思路已经清晰了,只要更改将$shipping['configure']进行反序列化的处理,然后获得相应free_money的值,就可以解决问题了,详细的更改代码:

将:admin/order.php的2201行的$shipping_list[$key]['free_money'] = price_format($shipping['configure']['free_money'])这行代码先注释掉,然后加上一下代码:

    $shipping['configure'] = unserialize($shipping['configure']);
            $sun_shipping = array();
            foreach($shipping['configure'] as $row){
                $sun_shipping[$row['name']] = $row['value'];
            }
            $shipping_list[$key]['free_money'] = price_format($sun_shipping['free_money']);
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值