示例#1
0
      $total += $weight->type_weight * $_SESSION['cart_qty'][$key];
   }
   
   $total_weight = $total;
   
   
   if($ajx_country == 'Indonesia'){
      $courier = $_ajax->get_rate($ajx_city);
   
   
      /* --- DATA --- */
      echo '<select class="form-control" id="id-shipping" name="courier_service" onChange="setRate()" >';
	  echo '<option value="0">-- Select Shipping Method --</option>';
   
      foreach($courier as $courier){
         $name        = $_ajax->get_courier($courier->courier_name);
         $ship_weight = ceil($total_weight / $courier->courier_weight);
		 $active      = $_ajax->get_active_shipping($courier->courier_name);
		 
		 if($active->active_status == 'Active'){
		    $active_class = '';
		 }else if($active->active_status == 'Inactive'){
		    $active_class = 'class="hidden"';
		 }
		 
		 if($temp_currency == 1){
		    $courier->courier_rate = $courier->courier_rate;
		 }else if($temp_currency == 2){
		    $courier->courier_rate = $courier->courier_rate / $_global_general->currency_rate;
		 }
         
 $ajx_city = filter_var($_POST['city'], FILTER_SANITIZE_STRING);
 $session_type = $_SESSION['cart_type_id'];
 $session_qty = $_SESSION['cart_qty'];
 /* --- TOTAL WEIGHT --- */
 $total = 0;
 foreach ($session_type as $key => $type) {
     $weight = $_ajax->get_cart($type);
     $total += $weight->type_weight * $_SESSION['cart_qty'][$key];
 }
 $total_weight = $total;
 if ($ajx_country == 'Indonesia') {
     $courier = $_ajax->get_rate($ajx_city);
     /* --- DATA --- */
     //echo '<select class="form-control" id="id-shipping" name="courier_service" onChange="setRate()" >';
     foreach ($courier as $key_courier => $courier) {
         $name = $_ajax->get_courier($courier->courier_name, 'Active');
         $ship_weight = ceil($total_weight / $courier->courier_weight);
         $ship_price = $ship_weight * $courier->courier_rate;
         echo '<div class="input-grp radio">';
         echo '<label>';
         echo '<input type="radio" name="opt-shipping" id="id-opt-shipping-' . $key_courier . '" value="' . $courier->courier_rate_id . '" ';
         if ($key_courier == 0) {
             echo 'checked';
         }
         echo '>';
         echo '<img src="' . BASE_URL . '../' . $courier->courier_logo . '">';
         echo '<div class="input-grp-select"></div>';
         echo '<div class="input-grp-content">';
         echo '<p class="input-grp-title"><strong>' . $courier->courier_name . '</strong></p>';
         if (isset($_SESSION['voucher']['validity']) && in_array('2', $_SESSION['voucher']['validity'])) {
             //echo '<option value="'.$courier->courier_rate_id.'" rate="'.$ship_price.'">'.$name->courier_name.' - Free Shipping</option>';