ecshop中现金减免优惠活动.doc_第1页
ecshop中现金减免优惠活动.doc_第2页
ecshop中现金减免优惠活动.doc_第3页
ecshop中现金减免优惠活动.doc_第4页
ecshop中现金减免优惠活动.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1. 新增代码在此文件中的注释:此注释已标识为蓝色/-weiyanhui-start-/-weiyanhui-end-2. 优惠规则:记得是总金额哦如果购买商品的总金额小于199元,则没有现金减免优惠如果购买商品的总金额大于等于199元小于599元,则减免现金99元如果购买商品的总金额大于599元,则减免现金199元3. 此函数在includes/lib_order.php文件中4. 找到库文件夹下面的order_total.lbi文件:找到如下代码: - $lang.discount: $total.discount_formated在其下方添加如下代码: - 减免现金: $total.jiesheng_price_formated5.以下为修改的lib_order.php文件中order_fee()函数:/* * 获得订单中的费用信息 * * access public * param array $order * param array $goods * param array $consignee * param bool $is_gb_deposit 是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral) * return array */function order_fee($order, $goods, $consignee) /* 初始化订单的扩展code */ if (!isset($orderextension_code) $orderextension_code = ; if ($orderextension_code = group_buy) $group_buy = group_buy_info($orderextension_id); $total = array(real_goods_count = 0, gift_amount = 0, goods_price = 0, market_price = 0, discount = 0, pack_fee = 0, card_fee = 0, shipping_fee = 0, shipping_insure = 0, integral_money = 0, bonus = 0, surplus = 0, cod_fee = 0, pay_fee = 0, tax = 0,/weiyanhui-start jiesheng_price =0);/weiyanhui-end $weight = 0; /* 商品总价 */ foreach ($goods AS $val) /* 统计实体商品的个数 */ if ($valis_real) $totalreal_goods_count+; $totalgoods_price += $valgoods_price * $valgoods_number; $totalmarket_price += $valmarket_price * $valgoods_number; /-weiyanhui-start-/如果总金额 199$totalgoods_price599的话,优惠199if($totalgoods_price199 & $totalgoods_price599)$totaljiesheng_price=199;$totaljiesheng_price_formated = price_format($totaljiesheng_price, false);/-weiyanhui-end- $totalsaving = $totalmarket_price - $totalgoods_price; $totalsave_rate = $totalmarket_price ? round($totalsaving * 100 / $totalmarket_price) . % : 0; $totalgoods_price_formated = price_format($totalgoods_price, false); $totalmarket_price_formated = price_format($totalmarket_price, false); $totalsaving_formated = price_format($totalsaving, false); /* 折扣 */ if ($orderextension_code != group_buy) $discount = compute_discount(); $totaldiscount = $discountdiscount; if ($totaldiscount $totalgoods_price) $totaldiscount = $totalgoods_price; $totaldiscount_formated = price_format($totaldiscount, false); /* 税额 */ if (!empty($orderneed_inv) & $orderinv_type != ) /* 查税率 */ $rate = 0; foreach ($GLOBALS_CFGinvoice_typetype as $key = $type) if ($type = $orderinv_type) $rate = floatval($GLOBALS_CFGinvoice_typerate$key) / 100; break; if ($rate 0) $totaltax = $rate * $totalgoods_price; $totaltax_formated = price_format($totaltax, false); /* 包装费用 */ if (!empty($orderpack_id) $totalpack_fee = pack_fee($orderpack_id, $totalgoods_price); $totalpack_fee_formated = price_format($totalpack_fee, false); /* 贺卡费用 */ if (!empty($ordercard_id) $totalcard_fee = card_fee($ordercard_id, $totalgoods_price); $totalcard_fee_formated = price_format($totalcard_fee, false); /* 红包 */ if (!empty($orderbonus_id) $bonus = bonus_info($orderbonus_id); $totalbonus = $bonustype_money; $totalbonus_formated = price_format($totalbonus, false); /* 线下红包 */ if (!empty($orderbonus_kill) $bonus = bonus_info(0,$orderbonus_kill); $totalbonus_kill = $orderbonus_kill; $totalbonus_kill_formated = price_format($totalbonus_kill, false); /* 配送费用 */ $shipping_cod_fee = NULL; if ($ordershipping_id 0 & $totalreal_goods_count 0) $regioncountry = $consigneecountry; $regionprovince = $consigneeprovince; $regioncity = $consigneecity; $regiondistrict = $consigneedistrict; $shipping_info = shipping_area_info($ordershipping_id, $region); if (!empty($shipping_info) if ($orderextension_code = group_buy) $weight_price = cart_weight_price(CART_GROUP_BUY_GOODS); else $weight_price = cart_weight_price(); / 查看购物车中是否全为免运费商品,若是则把运费赋为零 $sql = SELECT count(*) FROM . $GLOBALSecs-table(cart) . WHERE session_id = . SESS_ID. AND extension_code != package_buy AND is_shipping = 0; $shipping_count = $GLOBALSdb-getOne($sql); $totalshipping_fee = ($shipping_count = 0 AND $weight_pricefree_shipping = 1) ?0 : shipping_fee($shipping_infoshipping_code,$shipping_infoconfigure, $weight_priceweight, $totalgoods_price, $weight_pricenumber); if (!empty($orderneed_insure) & $shipping_infoinsure 0) $totalshipping_insure = shipping_insure_fee($shipping_infoshipping_code, $totalgoods_price, $shipping_infoinsure); else $totalshipping_insure = 0; if ($shipping_infosupport_cod) $shipping_cod_fee = $shipping_infopay_fee; $totalshipping_fee_formated = price_format($totalshipping_fee, false); $totalshipping_insure_formated = price_format($totalshipping_insure, false); / 购物车中的商品能享受红包支付的总额 $bonus_amount = compute_discount_amount(); / 红包和积分最多能支付的金额为商品总额 $max_amount = $totalgoods_price = 0 ? $totalgoods_price : $totalgoods_price - $bonus_amount; /* 计算订单总额 */ if ($orderextension_code = group_buy & $group_buydeposit 0) $totalamount = $totalgoods_price; else /-weiyanhui-start- $totalamount = $totalgoods_price-$totaljiesheng_price - $totaldiscount + $totaltax + $totalpack_fee + $totalcard_fee + $totalshipping_fee + $totalshipping_insure + $totalcod_fee; /-weiyanhui-end- / 减去红包金额 $use_bonus = min($totalbonus, $max_amount); / 实际减去的红包金额 if(isset($totalbonus_kill) $use_bonus_kill = min($totalbonus_kill, $max_amount); $totalamount -= $price = number_format($totalbonus_kill, 2, ., ); / 还需要支付的订单金额 $totalbonus = $use_bonus; $totalbonus_formated = price_format($totalbonus, false); $totalamount -= $use_bonus; / 还需要支付的订单金额 $max_amount -= $use_bonus; / 积分最多还能支付的金额 /* 余额 */ $ordersurplus = $ordersurplus 0 ? $ordersurplus : 0; if ($totalamount 0) if (isset($ordersurplus) & $ordersurplus $totalamount) $ordersurplus = $totalamount; $totalamount = 0; else $totalamount -= floatval($ordersurplus); else $ordersurplus = 0; $totalamount = 0; $totalsurplus = $ordersurplus; $totalsurplus_formated = price_format($ordersurplus, false); /* 积分 */ $orderintegral = $orderintegral 0 ? $orderintegral : 0; if ($totalamount 0 & $max_amount 0 & $orderintegral 0) $integral_money = value_of_integral($orderintegral); / 使用积分支付 $use_integral = min($totalamount, $max_amount, $integral_money); / 实际使用积分支付的金额 $totalamount -= $use_integral; $totalintegral_money = $use_integral; $orderintegral = integral_of_value($use_integral); else $totalintegral_money = 0; $orderintegral = 0; $totalintegral = $orderintegral; $totalintegral_formated = price_format($totalintegral_money, false); /* 保存订单信息 */ $_SESSIONflow_order = $order; $se_flow_type = isset($_SESSIONflow_type) ? $_SESSIONflow_type : ; /* 支付费用 */ if (!empty($orderpay_id) & ($totalreal_goods_count 0 | $se_flow_type != CART_EXCHANGE_GOODS) $totalpay_fee = pay_fee($orderpay_id, $totalamount, $shipping_cod_fee); $totalpay_fee_formated = price_format($totalpay_fee, false); $totalamount += $totalpay_fee; / 订单总额累加上支付费用 $totalamount_formated = price_format($totalamount, false); /* 取得可以得到的积分和红包 */ if ($orderextension_code = group_buy) $totalwill_get_integral = $group_buygift_integral; elseif ($orderextension_code = exchange_goods) $totalwill_get_integral = 0; else $totalwill_get_integral = get_give_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论