本文整理匯總了PHP中CommonModel::calcshippingfee方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::calcshippingfee方法的具體用法?PHP CommonModel::calcshippingfee怎麽用?PHP CommonModel::calcshippingfee使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::calcshippingfee方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: act_repeatShipments2
//.........這裏部分代碼省略.........
$address = $orderUserInfoStreet1 . "\n" . $orderUserInfoStreet2 . "\n" . $orderUserInfoCity . "\n" . $orderUserInfoState . "\n" . $orderUserInfoZip . "\n" . $orderUserInfoCountryName;
//字段拚接成地址
$orderWhInfoWeighTime = date('Y-m-d', $orderWhInfoData['weighTime']);
//稱重時間,亦可以當做發貨時間 $scantime
$OrderCalcWeight = $orderData['calcWeight'];
//估算重量,單位是kg $calculate_weight
$orderWhInfoActualWeight = number_format($orderWhInfoData['actualWeight'] / 1000, 3);
//實際重量 $orderweight2
$totalweight = $orderWhInfoActualWeight;
//總重量
$mailway_c = $channels[$OrderChannelId];
//根據運輸管理係統的接口獲取
$isContainCombineSku = CommonModel::judge_contain_combinesku($orderId);
//$ebay_combineorder 判斷訂單是否包含組合料號,返回true or false
if (count($orderDetail) == 1) {
//訂單明細中隻有一條記錄時,訂單中隻有一種料號
$orderDetailTotalData = array_pop($orderDetail);
//取得orderDetail中的這條總記錄數據,包括orderDetailData和orderDetailExtenData
$orderDetailData = $orderDetailTotalData['orderDetailData'];
//明細中的常用數據
$orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
//明細中的擴展數據
$orderDetailSku = $orderDetailData['sku'];
//該明細下的$sku
$orderDetailExtenItemId = $orderDetailExtenData['itemId'];
//itemId $ebay_itemid
$orderDetailAmount = intval($orderDetailData['amount']);
//$amount 該明細下的sku對應的數量
$orderDetailRecordnumber = $orderDetailData['recordNumber'];
//該明細對應平台的recordnumber $recordnumber
$orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount;
//itemPrice(平台對應的銷售單價)*對應數量 $ebay_itemprice
// $ebay_shipfee = round_num(($OrderActualTotal - $orderDetailItemPrice), 2);
$ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
//round_num(($OrderActualTotal - $orderDetailItemPrice), 2); //訂單總價-sku對應的總價得出運費,$ebay_shipfee
$ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
$skus = GoodsModel::get_realskuinfo($orderDetailSku);
//獲取該sku下對應的真實料號信息(包括料號轉換及組合料號對應真實料號信息)
$values_skus = array_values($skus);
//得到sku的數量
$goods_location = CommonModel::getPositionBySku($orderDetailSku);
//倉位
$goodsInfo = GoodsModel::getSkuinfo($orderDetailSku);
//獲取真實sku的詳細信息,包括采購名稱和可用庫存
$goodsWeight = $goodsInfo['goodsWeight'];
//料號重量
$goods_cost = isset($goodsInfo['goodsCost']) ? round($goodsInfo['goodsCost'], 2) : 0;
//采購成本
$pmId = isset($goodsInfo['pmId']) ? $goodsInfo['pmId'] : '';
//包材Id
$ebay_packingmaterial = $packings[$pmId]['pmName'];
//包材名稱
$ebay_packingCost = $packings[$pmId]['pmCost'];
//包材成本
$purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : '';
$cguser = $staffLists[$purchaseId];
//采購名稱
$combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku);
//判斷該sku是否是組合料號,如果是返回combineSku,sku,count關係記錄數據,不是則返回false
if ($combineSku !== false) {
//為組合訂單
$goods_costs = 0;
$combine_weight_list = array();
$goods_costs_list = array();
foreach ($skus as $k => $v) {
$goodsInfo2 = GoodsModel::getSkuinfo($k);
示例2: combinePackage
public static function combinePackage($tableName, $plateform_arr, $carrierIds, $id_array, $storeId = 1)
{
self::initDB();
$list = self::selectList($tableName, $plateform_arr, $carrierIds, $id_array);
//var_dump($list); exit;
if (!$list) {
self::$errCode = 301;
self::$errMsg = "沒有需要合並的訂單!";
return false;
}
/*foreach($list as $key=>$value){
$key = $value['id'];
}
var_dump($key); exit;*/
BaseModel::begin();
$combineNum = 0;
foreach ($list as $key => $value) {
$where = "b.userName = '{$value['userName']}' \n\t\t\t\t\tAND b.countryName = '{$value['countryName']}' \n\t\t\t\t\tAND a.accountId = {$value['accountId']} \n\t\t\t\t\tAND a.transportId = {$value['transportId']} \n\t\t\t\t\tAND b.state='{$value['state']}' \n\t\t\t\t\tAND b.city='{$value['city']}' \n\t\t\t\t\tAND b.street='{$value['street']}' \n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND a.calcWeight<=2 \n\t\t\t\t\tAND a.isLock=0 \n\t\t\t\t\tAND a.is_delete=0 \n\t\t\t\t\tAND a.combinePackage=0 \n\t\t\t\t\tAND a.orderStatus={$value['orderStatus']}\n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND is_delete = 0 AND storeId = " . $storeId;
$records = combinePackageModel::selectRecord($tableName, $where, $id_array);
//var_dump($records); exit;
if (!$records) {
continue;
} else {
$weightlists = array();
$orderinfo = array();
$countryName = $records[0]['countryName'];
$transportId = $records[0]['transportId'];
foreach ($records as $record) {
$omOrderId = $record['id'];
$omOrderId = $record['id'];
$orderinfo[$record['id']] = $record;
$arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
//var_dump($arrinfo); exit;
$realweight = $arrinfo[0];
$realcosts = $arrinfo[2];
$itemprices = $arrinfo[3];
$weightlists[$omOrderId] = $realweight;
}
//var_dump($weightlists); exit;
$keyarray = array();
$keyarrays = array();
$checkweight = 0;
foreach ($weightlists as $wk => $weightlist) {
$checkweight += $weightlist;
if ($checkweight > 1.85) {
$keyarrays[] = $keyarray;
$keyarray = array();
$checkweight = $weightlist;
$keyarray[] = $wk;
} else {
$keyarray[] = $wk;
}
}
if (!empty($keyarray)) {
$keyarrays[] = $keyarray;
}
//var_dump($keyarrays); echo "<br>";
foreach ($keyarrays as $orderlist) {
if (count($orderlist) < 2) {
continue;
}
$ordervalueweight = array();
$ordervalueactualTotal = array();
foreach ($orderlist as $orderid) {
$ordervalueweight[$orderid] = $weightlists[$orderid];
$ordervalueactualTotal[$orderid] = $orderinfo[$orderid]['actualTotal'];
}
//var_dump($ordervalueactualTotal); exit;
//var_dump($ordervalueweight); exit;
$firstorder = array_shift($orderlist);
//第一個訂單編號信息
//var_dump($firstorder);
$combineInfo = CommonModel::calcshippingfee(array_sum($ordervalueweight), $countryName, array_sum($ordervalueactualTotal), $transportId);
//郵寄方式計算
//var_dump($combineInfo); exit;
$weight2fee = calceveryweight($ordervalueweight, $combineInfo['fee']['fee']);
//var_dump($weight2fee); exit;
$firstweightfee = array_shift($weight2fee);
//第一個訂單重量運費信息
$data = array();
$data['combinePackage'] = 1;
$data['orderStatus'] = C('STATEPENDING');
$data['orderType'] = C('STATEPENDING_CONPACK');
$where = ' WHERE id = ' . $firstorder;
if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
self::$errCode = 303;
self::$errMsg = "更新主訂單失敗!";
BaseModel::rollback();
return false;
}
foreach ($orderlist as $sonorder) {
$data['combinePackage'] = 2;
$data['orderStatus'] = C('STATEPENDING');
$data['orderType'] = C('STATEPENDING_CONPACK');
$where = ' WHERE id = ' . $sonorder;
if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
self::$errCode = 304;
self::$errMsg = "更新子訂單失敗!";
BaseModel::rollback();
return false;
//.........這裏部分代碼省略.........