A5下载文章资讯

分类分类

ecshop配送插件运费计算规则

2015-04-08 09:13作者:zhao

ECSHOP内置的配送插件运费规则有两种模式,一种是按重量计算(fee_compute_mode == ‘by_weight’),另一种是按商品件数计算(fee_compute_mode == ‘by_number’)。

按重量计算规则=首重费用+续重费用。大多数快递均以1000克为计量单位,EMS以500克为单位计算。

配送插件文件位置:/includes/modules/shipping/,运费计算函数如下:

/**

*计算订单的配送费用的函数

*

*@paramfloat$goods_weight商品重量

*@paramfloat$goods_amount商品金额

*@paramfloat$goods_number商品件数

*@returndecimal

*/

functioncalculate($goods_weight,$goods_amount,$goods_number)

{

if($this->configure['free_money']>0&&$goods_amount>=$this->configure['free_money'])

{

return0;

}

else

{

@$fee=$this->configure['base_fee'];

$this->configure['fee_compute_mode']=!empty($this->configure['fee_compute_mode'])?$this->configure['fee_compute_mode']:'by_weight';

if($this->configure['fee_compute_mode']=='by_number')//按商品件数计算

{

$fee=$goods_number*$this->configure['item_fee'];

}

else//按商品重量计算

{

if($goods_weight>1)

{

$fee+=(ceil(($goods_weight-1)))*$this->configure['step_fee'];

}

}

return$fee;

}

}

calculate函数有三个必要参数,商品重量是按重量计算运费的参数,商品件数是按商品件数计算运费的参数,而商品金额用来确定是否符合免运费条件。

展开全部

相关

说两句网友评论
    我要跟贴
    取消