Пример #1
0
 /**
  * 物流对应的国家列表
  */
 function index($id)
 {
     if (!$id) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
     }
     $delivery_service = DeliveryService::get_instance();
     $delivery_country_service = Delivery_countryService::get_instance();
     //验证此条物流
     $data = $delivery_service->get($id);
     if (!$data['id']) {
         remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
     }
     //初始化请求结构体
     $query_struct = array('where' => array('delivery_id' => $id), 'like' => array(), 'orderby' => array('position' => 'ASC', 'id' => 'ASC'), 'limit' => array('per_page' => 2000, 'offset' => 0));
     // 每页条目数
     controller_tool::request_per_page($query_struct, $request_data);
     $count = $delivery_country_service->query_count($query_struct);
     // 模板输出 分页
     $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page']));
     $query_struct['limit']['offset'] = $this->pagination->sql_offset;
     $query_struct['limit']['page'] = $this->pagination->current_page;
     //调用列表
     $delivery_countries = $delivery_country_service->get_delivery_countries_by_position($query_struct);
     $this->template->content = new View("site/delivery_country");
     $this->template->content->delivery_countries = $delivery_countries;
     $this->template->content->data = $data;
     $this->template->content->countries = $delivery_country_service->get_countries();
 }
Пример #2
0
<?if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){
	$Cart = new Cart();
	$Region = new Regions();
	$City = new Citys();
	$DeliveryService = new DeliveryService();
	$Delivery = new Delivery();
	$Orders = new Orders();
	$Address = new Address();
	/*$Orders->Add($_POST['user_number']);*/
	if(isset($_POST['action'])){
		switch($_POST['action']){
			case "GetRegionsList":
				$Region->SetList();
				foreach($Region->list as $region){
					if($region['region'] != ''){?>
						<li class="mdl-menu__item" data-value="<?php 
echo $region['id_city'];
?>
"><?php 
echo $region['region'];
?>
</li>
					<?}
				}
				break;
			case "GetCitiesList":
				$res = $City->SetFieldsByInput($_POST['input']);
				foreach($res as $city){
					if($city['name'] != ''){?>
						<li class="mdl-menu__item" data-value="<?php 
echo $city['id_city'];
Пример #3
0
 function del_country()
 {
     $return_struct = array();
     $request_data = $this->input->get();
     // 修改返回状态数据
     $return_struct['status'] = 1;
     $return_struct['code'] = 200;
     $return_struct['msg'] = 'ok';
     $delivery_service = DeliveryService::get_instance();
     $delivery_country_service = Delivery_countryService::get_instance();
     if (empty($request_data['delivery_id']) or empty($request_data['ids'])) {
         remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
     }
     $delivery = $delivery_service->get($request_data['delivery_id']);
     if ($delivery['site_id'] != $this->site_id) {
         remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
     }
     $query_ids = explode('-', $request_data['ids']);
     foreach ($query_ids as $ids) {
         $delivery_countries = $delivery_country_service->get($ids);
         if ($delivery_countries['delivery_id'] != $delivery['id']) {
             remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
             break;
         }
         if (!$delivery_country_service->remove($ids)) {
             $return_struct['status'] = 0;
             $return_struct['code'] = 501;
             break;
         }
     }
     header('Content-Type: text/javascript; charset=UTF-8');
     exit(json_encode($return_struct));
 }
Пример #4
0
<?if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){
	$Cart = new Cart();
	$Region = new Regions();
	$City = new Citys();
	$DeliveryService = new DeliveryService();
	$Delivery = new Delivery();
	$Orders = new Orders();
	/*$Orders->Add($_POST['user_number']);*/
	if(isset($_POST['action'])){
		switch($_POST['action']){
			case "GetRegionsList":
				$Region->SetList();
				$str = '';
				foreach($Region->list as $region){
					if($region['region'] != ''){
						$str .= '<li class="mdl-menu__item" data-value="'.$region['id_city'].'">'.$region['region'].'</li>';
					}
				}
				echo json_encode($str);
			;
			break;

			case "regionSelect":
				$res = $City->SetFieldsByInput($_POST['region']);?>
				<option selected="selected" disabled="disabled" class="color-sgrey">Город</option>
				<?foreach($res as $r){?>
					<option value="<?php 
echo $r['names_regions'];
?>
"><?php 
echo $r['name'];
Пример #5
0
$DeliveryMethod->SetDeliveryList();
$SavedDeliveryMethod = new Delivery();
$SavedDeliveryMethod->GetSavedFields($Customer->fields['id_delivery']);
$Region = new Regions();
if ($Region->SetList()) {
    $tpl->Assign('regions', $Region->list);
}
$City = new Citys();
if ($City->SetList()) {
    $tpl->Assign('citys', $City->list);
}
$Contragent = new Contragents();
if ($Contragent->GetContragentList()) {
    $tpl->Assign('manager', $Contragent->GetContragentList());
}
$DeliveryService = new DeliveryService();
$Deliverys = new Delivery();
if (isset($SavedCity->fields)) {
    if ($DeliveryService->SetListByRegion($SavedCity->fields['names_regions'])) {
        $tpl->Assign('delivery_services', $DeliveryService->list);
    }
    if ($Deliverys->SetFieldsByInput($SavedCity->fields['shipping_comp'], $SavedCity->fields['names_regions'])) {
        $tpl->Assign('delivery', $Deliverys->list);
    }
} else {
    if ($DeliveryService->SetList()) {
        $tpl->Assign('delivery_services', $DeliveryService->list);
    }
    if ($Deliverys->SetList()) {
        $tpl->Assign('delivery', $Deliverys->list);
    }
Пример #6
0
 /**
  * 添加订单第三步
  */
 function add_again()
 {
     /*权限检查*/
     role::check('order_add');
     if (!$_POST) {
         remind::set(Kohana::lang('o_order.change_site'), 'order/order_add', 'error');
     }
     $user_id = $this->input->post('user_id');
     $email = $this->input->post('email');
     /* 存放用户添加货品的信息 */
     $cart_data = array();
     /* 订单产品的总价 */
     $good_price = 0;
     $shipping_price = 10;
     $good_info = array();
     $address_info = array();
     /* 得到国家列表*/
     $country_query_struct = array('where' => array('active' => 1), 'orderby' => array('id' => 'ASC'));
     $country_list = Mycountry::instance()->query_assoc($country_query_struct);
     if (empty($country_list)) {
         remind::set(Kohana::lang('o_order.no_country'), 'order/order_add', 'error');
     }
     /* 得到默认地址信息*/
     $address_query_struct = array('where' => array('user_id' => $user_id), 'limit' => array('per_page' => 1, 'offset' => 0), 'orderby' => array('date_add' => 'DESC'));
     $address = Myaddress::instance()->query_assoc($address_query_struct);
     if (!empty($address)) {
         foreach ($address as $value) {
             $address_info = $value;
         }
     }
     /*得到站点物流方式*/
     $carrier_list = DeliveryService::get_instance()->select_list();
     if (empty($carrier_list)) {
         remind::set(Kohana::lang('o_order.no_carrier'), 'order/order_add', 'error');
     }
     $query_struct = array('where' => array());
     $currency_info = Mycurrency::instance()->query_assoc($query_struct);
     /*处理已选中货品信息*/
     $good_amount = $this->input->post('amount');
     foreach ($good_amount as $key => $value) {
         if ($value <= 0) {
             continue;
         }
         $good = ProductService::get_instance()->get($key);
         if ($good['store'] <= 0 && $value > 999) {
             $value = 999;
         }
         if ($good['store'] > 0 && $value > $good['store']) {
             $value = $good['store'];
         }
         /* 计算总价 */
         $good_price += $good['price'] * $value;
         $good['cart_num'] = $value;
         $good_info[] = $good;
         $cart_data[$key] = $value;
     }
     /*session*/
     $this->session = Session::instance();
     $this->session->set('cart_data', $cart_data);
     /*模板输出*/
     $this->template->content = new view("order/order_add_3");
     $this->template->content->good_price = $good_price;
     $this->template->content->shipping_price = $shipping_price;
     $this->template->content->user_id = $user_id;
     $this->template->content->email = $email;
     $this->template->content->country_list = $country_list;
     $this->template->content->carrier_list = $carrier_list;
     $this->template->content->currency_info = $currency_info;
     $this->template->content->address_info = $address_info;
     $this->template->content->good_info = $good_info;
 }
Пример #7
0
            $tpl->Assign('msg', 'Контрагент не добавлен.');
            if ($Contragents->db->errno == 1062) {
                $errm['email'] = "Такой email уже есть в базе.";
                $tpl->Assign('errm', $errm);
            }
        }
    } else {
        // показываем все заново но с сообщениями об ошибках
        $tpl->Assign('msg', 'Контрагент не добавлен!');
        $tpl->Assign('errm', $errm);
    }
}
$Parking = new Parkings();
if ($Parking->SetList()) {
    $tpl->Assign('parkings', $Parking->list);
}
$City = new Citys();
if ($City->SetList()) {
    $tpl->Assign('citys', $City->list);
}
$DeliveryService = new DeliveryService();
if ($DeliveryService->SetList()) {
    $tpl->Assign('delivery_services', $DeliveryService->list);
}
if (!isset($_POST['smb'])) {
    $_POST['id_user'] = 0;
    $_POST['parkings_ids'][] = 0;
    $_POST['citys_ids'][] = 0;
    $_POST['delivery_services_ids'][] = 0;
}
$tpl_center .= $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_contragent_ae.tpl');
Пример #8
0
     break;
 case 'GetCartPage':
     unset($parsed_res);
     if (G::IsLogged()) {
         $Users->SetUser(G::GetLoggedData());
         $tpl->Assign('User', $Users->fields);
     }
     // Устанавливаем базовый ценовой режим если пользователь не является менеджером
     if ($Users->fields['gid'] != _ACL_MANAGER_) {
         $_SESSION['price_mode'] = 3;
     }
     // Подключаем необходимые классы
     $Cities = new Citys();
     $Contragents = new Contragents();
     $Delivery = new Delivery();
     $Deliveryservice = new DeliveryService();
     $Regions = new Regions();
     // Все классы подключены
     // выборка базовых данных
     // о покупателе
     $Customers->SetFieldsById($Users->fields['id_user']);
     $customer = $Customers->fields;
     $cont_person = explode(' ', $customer['cont_person']);
     $customer['last_name'] = $cont_person[0];
     $customer['first_name'] = isset($cont_person[1]) ? $cont_person[1] : '';
     $customer['middle_name'] = isset($cont_person[2]) ? $cont_person[2] : '';
     $customer['phone'] = isset($phones) ? $phones : '';
     // список всех менеджеров
     $Contragents->SetList();
     $managers_list = $Contragents->list;
     // список всех областей
Пример #9
0
 /**
  *  显示退货单细节
  */
 public function return_detail($id)
 {
     /* 权限检查*/
     role::check('order_doc_return');
     $return = Myorder_return_log::instance($id)->get();
     $ship_status = Kohana::config('order.ship_status');
     $return_list = array();
     $return_list['id'] = $return['id'];
     //退货单id
     $return_list['return_num'] = $return['return_num'];
     //退货单号
     $return_list['order_num'] = Myorder::instance($return['order_id'])->get('order_num');
     //订单号
     $return_list['carrier'] = DeliveryService::get_instance()->get_delivery_name($return['carrier_id']);
     $return_list['email'] = $return['email'];
     //用户邮箱
     $return_list['manager'] = Mymanager::instance($return['manager_id'])->get('username');
     //操作员
     $return_list['currency'] = $return['currency'];
     //币种
     $return_list['total_shipping'] = $return['total_shipping'];
     //运费金额
     $return_list['return_status'] = $ship_status[$return['return_status_id']]['name'];
     //退货状态
     $return_list['content_admin'] = $return['content_admin'];
     //管理员备注
     $return_list['content_user'] = $return['content_user'];
     //用户备注
     $return_list['date_add'] = $return['date_add'];
     //添加时间
     /* 得到订单货品信息 */
     $return_list['return_data'] = array();
     $return_data = unserialize($return['return_data']);
     $order_products = Myorder_product::instance()->get_order_products_by_order_id($return['order_id']);
     foreach ($order_products as $val) {
         foreach ($return_data as $k => $v) {
             if ($v['id'] == $val['id']) {
                 $return_list['return_data'][$k]['SKU'] = $val['SKU'];
                 $return_list['return_data'][$k]['name'] = $val['name'];
                 $return_list['return_data'][$k]['attribute_style'] = empty($val['attribute_style']) ? '默认' : $val['attribute_style'];
                 $return_list['return_data'][$k]['quantity'] = $val['quantity'];
                 $return_list['return_data'][$k]['sendnum'] = isset($v['send_num']) ? $v['send_num'] : '未知';
                 $return_list['return_data'][$k]['returnnum'] = $v['return_num'];
             }
         }
     }
     $this->template = new View('layout/commonfix_html');
     $this->template->content = new view("order/order_doc/doc_detail/return_detail");
     $this->template->content->return_list = $return_list;
 }
Пример #10
0
 public static function get_delivery($id)
 {
     return DeliveryService::get_instance()->get($id);
 }