修改ecshop快递超重的运费计算方式

2009-11-17 15:44 来源:www.chinab4c.com 作者:ecshop专家

    ecshop电子商务系统中,ecshop的快递计算方式,存在很大的问题,起步价和超重的计算方式,一点都不灵活。我们可以通过调整ecshop计费方式函数,来处理ECSHOP重量的问题。

1:首先修改定单中的计算重量方式
get_cart_goods函数
$total = array(
        'goods_price'  => 0, // 本店售价合计(有格式)
        'market_price' => 0, // 市场售价合计(有格式)
        'saving'       => 0, // 节省金额(有格式)
        'save_rate'    => 0, // 节省百分比
        'goods_amount' => 0, // 本店售价合计(无格式)
  'weight'    => 0,//重量
    );
修改该函数处理重量
修改循环函数
$row[goods_weight]    +=$GLOBALS[db]-> getOne("select goods_weight from ".$GLOBALS['ecs']->table('goods')." where goods_id = ".$row[goods_id]);
  $total['weight']    += $row[goods_weight]*$row['goods_number'];

统计出商品小计重量

2:cart_goods()函数中
$arr[$key][goods_weight]    +=$GLOBALS[db]-> getOne("select goods_weight from ".$GLOBALS['ecs']->table('goods')." where goods_id = ".$value[goods_id]);
循环显示出商品重量

 

 

3:修改select_shipping
//计算重量
 //计算价格和总量
 //xiongbin
 $total_weight = 0;
 $total_price = 0;
 foreach($cart_goods as $k => $v){
  $total_weight+= $v[goods_weight]*$v[goods_number];
  $total_price += $v[subtotal];//计算价格
 }
修改定单信息
 $order = flow_order_info();
  $order['total_price'] = $total_price;//总价格
  $order[total_weight]  = $total_weight;//总重量

  $order['chengshi']   = $_SESSION['flow_consignee']['district'];//快递区域

4:checkout
//计算重量
 //计算价格和总量
 //xiongbin
 $total_weight = 0;
 $total_price = 0;
 foreach($cart_goods as $k => $v){
  $total_weight+= $v[goods_weight]*$v[goods_number];
  $total_price += $v[subtotal];//计算价格
 }
 $smarty -> assign('total_weight',$total_weight);

 $order = flow_order_info();
 //xiongbin
 $order[total_weight] = $total_weight;//总重量
 $order[total_price]  = $total_price;//总价格
 $order['chengshi']   = $_SESSION['flow_consignee']['district'];//快递区域

5:lib_order.php的order_fee函数中
if($order[chengshi] == 692 ){//如果是广州地区
     if($order[shipping_id] == 1){
      if($order[total_price]<100){//小于100元
       if($order['total_weight']<10){
        $total['shipping_fee'] = 0;
       }else{
        $w = ($order[total_weight]-10);
        $total['shipping_fee'] =  ceil($w);

       }
      }else{//超过100元
       $b = floor($order[total_price]/100);//取得超过100公斤的数据
       $w = $b*10;//取得计算重量的界限
       if($w<$order['total_weight']){
        $chaochu = ($order['total_weight'] - $w);
        $total['shipping_fee'] = ceil($chaochu);
       }
       
      }
      
     }else{
      $total['shipping_fee'] = shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price['weight'], $total['goods_price'], $weight_price['number']);
     }
    }else{
     $total['shipping_fee'] = shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price['weight'], $total['goods_price'], $weight_price['number']);
    }

6:done中
//计算定单中的价格
 //xiongbin
 $total_weight = 0;
 $total_price = 0;
 foreach($cart_goods as $k => $v){
  $total_weight+= $v[goods_weight]*$v[goods_number];
  $total_price += $v[subtotal];//计算价格
 }
 $order['total_price'] = $total_price;//总价格
 $order[total_weight]  = $total_weight;//总重量

 $order['chengshi']   = $_SESSION['flow_consignee']['district'];//快递区域

 相关文章:

 ecshop首页推荐的分类也能倒计时

 ecshop订单列表中显示收货人姓名

 分析ecshop赠品在购物车中出现

 

来源:中国B4C电子商务

香港公司注册咨询