示例#1
0
 public function getShippings($weight, $height)
 {
     $shipping_method = new BasketModel();
     $ship_mtd = $shipping_method->getActiveShipping();
     // Заносим в массив названия способов доставки
     $ship = ['1st Class Recorded', '2st Class Recorded', '1st Class Standard', '2st Class Standard', '5'];
     $dscr = 'При выборе данного способа доставки вам нет необходимости подтверждать факт получения посылки своей подписью.';
     if (isset($weight) && isset($height)) {
         $max_height = max($height);
         echo "<br>---------------------";
         print_r($max_height);
         echo "---------------------<br>";
         echo "<br>---------------------";
         print_r($weight);
         echo "---------------------<br>";
         $shipng = [];
         // if($weight > 750 && $weight < 1950)
         // {
         // 	$shipng[] = array('name'=>$ship['0'], 'price'=>'4.40', 'delivery'=>'Срок доставки . $max_height .',
         // 		'check'=>'checked', 'description'=>'');
         // 	$shipng[] = array('name'=>$ship['1'], 'price'=>'3.90', 'delivery'=>'Срок доставки 29.06 - 30.06',
         // 		'check'=>'', 'description'=>'');
         // 	$shipng[] = array('name'=>$ship['2'], 'price'=>'3.30', 'delivery'=>'Срок доставки 29.06 - 30.06',
         // 		'check'=>'', 'description'=>$dscr);
         // 	$shipng[] = array('name'=>$ship['3'], 'price'=>'2.80', 'delivery'=>'Срок доставки 29.06 - 30.06',
         // 		'check'=>'', 'description'=>$dscr);
         // }
         if ($weight > 0 && $weight && $max_height > 2.5) {
             $shipng[] = array('name' => $ship['0'], 'price' => '4.40', 'delivery' => 'Срок доставки ' . $this->shippingTime()[0], 'check' => $ship_mtd[0], 'description' => '', 'id' => '3');
             $shipng[] = array('name' => $ship['1'], 'price' => '3.90', 'delivery' => 'Срок доставки ' . $this->shippingTime()[1], 'check' => $ship_mtd[1], 'description' => '', 'id' => '4');
             $shipng[] = array('name' => $ship['2'], 'price' => '3.30', 'delivery' => 'Срок доставки ' . $this->shippingTime()[2], 'check' => $ship_mtd[2], 'description' => $dscr, 'id' => '5');
             $shipng[] = array('name' => $ship['3'], 'price' => '2.80', 'delivery' => 'Срок доставки ' . $this->shippingTime()[3], 'check' => $ship_mtd[3], 'description' => $dscr, 'id' => '6');
         }
         if ($weight > 0 && $weight < 750 && $max_height <= 2.5) {
             // $shipng[] = array('name'=>'1st Class Recorded', 'price'=>'2.05', 'delivery'=>'Срок доставки 29.06 - 30.06', 'check'=>'checked');
             // $shipng[] = array('name'=>'2st Class Recorded', 'price'=>'1.84', 'delivery'=>'Срок доставки 29.06 - 30.06', 'check'=>'2');
             // $shipng[] = array('name'=>'1st Class Standard', 'price'=>'0.95', 'delivery'=>'Срок доставки 29.06 - 30.06', 'check'=>'');
             // $shipng[] = array('name'=>'2st Class Standard', 'price'=>'0.74', 'delivery'=>'Срок доставки 29.06 - 30.06', 'check'=>'');
             $shipng[] = array('name' => $ship['0'], 'price' => '2.36', 'delivery' => 'Срок доставки ' . $this->shippingTime()[0], 'check' => $ship_mtd[0], 'description' => '', 'id' => '3');
             $shipng[] = array('name' => $ship['1'], 'price' => '2.29', 'delivery' => 'Срок доставки ' . $this->shippingTime()[1], 'check' => $ship_mtd[1], 'description' => '', 'id' => '4');
             $shipng[] = array('name' => $ship['2'], 'price' => '1.26', 'delivery' => 'Срок доставки ' . $this->shippingTime()[2], 'check' => $ship_mtd[2], 'description' => $dscr, 'id' => '5');
             $shipng[] = array('name' => $ship['3'], 'price' => '1.19', 'delivery' => 'Срок доставки ' . $this->shippingTime()[3], 'check' => $ship_mtd[3], 'description' => $dscr, 'id' => '6');
         }
         return $shipng;
     }
 }