コード例 #1
0
ファイル: Jne.php プロジェクト: jeffhorus/sepatuku
 static function getPackingKayu($items)
 {
     $weight = Helper_Cart::getTotalWeightOfItems($items);
     if ($weight < 3000) {
         return 8500;
     }
     if ($weight < 5000) {
         return 11500;
     }
     if ($weight < 11000) {
         return 32500;
     }
     if ($weight < 16000) {
         return 42000;
     }
     if ($weight < 21000) {
         return 51500;
     }
     if ($weight < 26000) {
         return 59000;
     }
     return 100000;
 }
コード例 #2
0
ファイル: Cart.php プロジェクト: jeffhorus/sepatuku
 static function getSingpostInternationalFormula($params, $controller, $shippingMethod, $shippingCountry, $shippingCity)
 {
     $formula = function ($n, $items, $cart, $controller) use($shippingCountry) {
         $weight = Helper_Cart::getTotalWeightOfItems($items);
         $zone = Helper_Cart::_getSingpostZoneFromCountry($shippingCountry);
         $fee = 0;
         if ($zone == 'zone1') {
             $steps = array(20 => 0.5, 50 => 0.7, 100 => 1.1);
             foreach ($steps as $step => $val) {
                 if ($weight <= $step) {
                     $fee = $val;
                     break;
                 }
             }
             if (!$fee) {
                 $fee = 1.1 + ceil(($weight - 100) / 100) * 1.1;
             }
         } else {
             if ($zone == 'zone2') {
                 if ($weight <= 20) {
                     $fee = 0.7;
                 }
                 if (!$fee) {
                     $fee = 0.7 + ceil(($weight - 20) / 10) * 0.25;
                 }
             } else {
                 if ($weight <= 20) {
                     $fee = 1.3;
                 }
                 if (!$fee) {
                     $fee = 1.3 + ceil(($weight - 20) / 10) * 0.35;
                 }
             }
         }
         return 2.2 + $fee;
     };
     return $formula;
 }