Example #1
0
 } elseif (!empty($order_info['s_firstname'])) {
     $firstname = $order_info['s_firstname'];
 } elseif (!empty($order_info['b_firstname'])) {
     $firstname = $order_info['b_firstname'];
 }
 $fio = $lastname . ' ' . $firstname;
 $phone = "";
 if (!empty($order_info['phone'])) {
     $phone = $order_info['phone'];
 } elseif (!empty($order_info['s_phone'])) {
     $phone = $order_info['s_phone'];
 } elseif (!empty($order_info['b_phone'])) {
     $phone = $order_info['b_phone'];
 }
 if (!empty($rec_city_code)) {
     $offices = RusSdek::pvzOffices(array('cityid' => $rec_city_code));
 }
 foreach ($sdek_shipments as $key => $shipment) {
     $data_sdek = db_get_row("SELECT register_id, order_id, timestamp, status, tariff as tariff_id, address_pvz, address, file_sdek, notes FROM ?:rus_sdek_register WHERE order_id = ?i and shipment_id = ?i", $shipment['order_id'], $shipment['shipment_id']);
     $data_shipping = fn_get_shipping_info($shipment['shipping_id'], DESCR_SL);
     if (!empty($data_shipping['service_params'])) {
         if (!empty($data_sdek)) {
             $data_shipments[$shipment['shipment_id']] = $data_sdek;
             $data_status = db_get_array("SELECT * FROM ?:rus_sdek_status WHERE order_id = ?i AND shipment_id = ?i ", $params['order_id'], $shipment['shipment_id']);
             if (!empty($data_status)) {
                 foreach ($data_status as $k => $status) {
                     $status['city'] = db_get_field("SELECT city FROM ?:rus_city_sdek_descriptions as a LEFT JOIN ?:rus_cities_sdek as b ON a.city_id=b.city_id WHERE b.city_code = ?s", $status['city_code']);
                     $status['date'] = date("d-m-Y  H:i:s", $status['timestamp']);
                     $data_shipments[$shipment['shipment_id']]['sdek_status'][$status['id']] = array('id' => $status['id'], 'date' => $status['date'], 'status' => $status['status'], 'city' => $status['city']);
                 }
             }
Example #2
0
 private function _getRates($response)
 {
     $rates = array();
     if (!empty($response['result']['price'])) {
         $rates['price'] = $response['result']['price'];
         if (!empty($response['result']['deliveryPeriodMin']) && !empty($response['result']['deliveryPeriodMax'])) {
             $plus = $this->_shipping_info['service_params']['dateexecute'];
             $min_time = $plus + $response['result']['deliveryPeriodMin'];
             $max_time = $plus + $response['result']['deliveryPeriodMax'];
             $date = $min_time . '-' . $max_time . ' (' . __('days') . ')';
             if (!empty($date)) {
                 $rates['date'] = $date;
             }
         }
         $rec_city_code = $this->city_id;
         $tarif_id = $this->_shipping_info['service_params']['tariffid'];
         if (!empty($rec_city_code) && $tarif_id == SDEK_STOCKROOM && $tarif_id == $response['result']['tariffId']) {
             $params = array('cityid' => $rec_city_code);
             $offices = RusSdek::pvzOffices($params);
             if (!empty($offices)) {
                 $rates['offices'] = $offices;
             } else {
                 $rates['clear'] = true;
             }
         }
     }
     return $rates;
 }