<?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'];
<?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'];
} else { $User = new Users(); $User->SetUser($_SESSION['member']); $current_user = $User->fields; $tpl->Assign('User', $User->fields); } unset($parsed_res); $Page = new Page(); $Page->PagesList(); $tpl->Assign('list_menu', $Page->list); $GLOBALS['IERA_LINKS'] = array(); $GLOBALS['IERA_LINKS'][1]['title'] = "Корзина"; if ($User->fields['gid'] == _ACL_CUSTOMER_ || $User->fields['gid'] == _ACL_ANONYMOUS_ || $User->fields['gid'] == _ACL_DILER_ || $User->fields['gid'] == _ACL_CONTRAGENT_) { $Customer = new Customers(); $Customer->SetFieldsById($User->fields['id_user']); $SavedCity = new Citys(); $SavedCity->GetSavedFields($Customer->fields['id_city']); $SavedContragent = new Contragents(); $SavedContragent->GetSavedFields($Customer->fields['id_contragent']); $DeliveryMethod = new Delivery(); $DeliveryMethod->SetDeliveryList(); $SavedDeliveryMethod = new Delivery(); $SavedDeliveryMethod->GetSavedFields($Customer->fields['id_delivery']); $Cart = new Cart(); if (isset($GLOBALS['REQAR'][1]) && is_numeric($GLOBALS['REQAR'][1])) { if (isset($_POST['add_order'])) { $Cart->FillByOrderId($GLOBALS['REQAR'][1], true); } else { $Cart->FillByOrderId($GLOBALS['REQAR'][1]); } header('Location: ' . _base_url . '/cart/');
$id_customer = $ord['id_customer']; $Customer = new Customers(); $Customer->SetFieldsById($id_customer, 1, true); $tpl->Assign('Customer', $Customer->fields); // Получить данные контрагента $id_contragent = $ord['id_contragent']; $Contragent = new Contragents(); if (isset($ord['id_remitter'])) { $remitter = $Contragent->GetRemitterById($ord['id_remitter'], true); $tpl->Assign('remitter', $remitter); } $Contragent->SetFieldsById($id_contragent); $tpl->Assign('Contragent', $Contragent->fields); $tpl->Assign('date', date('d.m.Y', $ord['target_date'])); $tpl->Assign('id_order', $ord['id_order']); $Citys = new Citys(); $city = $Citys->SetFieldsById($ord['id_city']); if ($ord['id_delivery'] == 1) { // самовывоз $addr_deliv = "Самовывоз<br>" . $ord['descr']; } elseif ($ord['id_delivery'] == 2) { // Передать автобусом $addr_deliv = "Передать автобусом - " . $city['names_regions'] . "<br>" . $ord['descr']; } elseif ($ord['id_delivery'] == 3) { // служба доставки $addr_deliv = "Служба доставки - " . $city['shipping_comp'] . "<br>" . $city['names_regions'] . "<br>" . $city['address']; if (isset($ord['descr'])) { $addr_deliv .= "<br>" . $ord['descr']; } } $tpl->Assign("addr_deliv", $addr_deliv);
//Получаем клиента $id_customer = $orders_data[$order_id]['id_customer']; $Customer = new Customers(); $Customer->SetFieldsById($id_customer); //Получаем контрагента $id_contragent = $orders_data[$order_id]['id_contragent']; $Contragent = new Contragents(); $Contragent->SetFieldsById($id_contragent); //Получаем поля и присоединяем к данным о заказе $customer_data = $Customer->fields; $contragent_data = $Contragent->fields; $orders_data[$order_id]['customer_data'] = $customer_data; $orders_data[$order_id]['contragent_data'] = $contragent_data; //Форматируем дату $orders_data[$order_id]['date'] = date("d.m.Y", $orders_data[$order_id]['target_date']); $Citys = new Citys(); $city = $Citys->SetFieldsById($orders_data[$order_id]['id_city']); // Варианты доставки if ($orders_data[$order_id]['id_delivery'] == 1) { // самовывоз $orders_data[$order_id]['addr_deliv'] = "Самовывоз"; $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr']; } elseif ($orders_data[$order_id]['id_delivery'] == 2) { // Передать автобусом $orders_data[$order_id]['addr_deliv'] = "Передать автобусом - " . $city['names_regions']; $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr']; } elseif ($orders_data[$order_id]['id_delivery'] == 3) { // служба доставки $orders_data[$order_id]['ds'] = $city['shipping_comp']; $orders_data[$order_id]['addr_deliv'] = $city['names_regions'] . "<br>" . $city['address']; $orders_data[$order_id]['addr_descr'] = $orders_data[$order_id]['descr'];
} $Customer = new Customers(); $Customer->SetFieldsById($User->fields['id_user']); $SavedCity = new Citys(); $SavedCity->GetSavedFields($Customer->fields['id_city']); $SavedContragent = new Contragents(); $SavedContragent->GetSavedFields($Customer->fields['id_contragent']); $DeliveryMethod = new Delivery(); $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(!isset($mc->get("filters")[$_GET['q']])){ // $mc->set("filters", array($_GET['q']=>'all')); // } // } // Список заказов $orders = $Customer->GetOrders($orderby); $order_statuses = $Order->GetStatuses(); //print_r($orders); $Contragent = new Contragents(); foreach ($orders as &$order) { $Order->SetFieldsById($order['id_order']); $Contragent->SetFieldsById($Order->fields['id_contragent']); $order['contragent_info'] = $Contragent->fields; } $Citys = new Citys(); foreach ($orders as &$order) { $Order->SetFieldsById($order['id_order']); $Citys->SetFieldsById($Order->fields['id_city']); $order['city_info'] = $Citys->fields; $order['products'] = $Order->GetOrderForCustomer(array("o.id_order" => $order['id_order'])); } $tpl->Assign('orders', $orders); /*$arr = array(); foreach($orders as &$order_2){ $arr = $Order->GetOrderForCustomer(array("o.id_order" => $order_2['id_order'])); }*/ //$tpl->Assign('products', $arr); $Users->SetUser($_SESSION['member']); $tpl->Assign('User', $Users->fields); $tpl->Assign('Customer', $Customer->fields);
break; case 'GetCart': echo json_encode($_SESSION['cart']); 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 : ''; // список всех менеджеров
} if (isset($_POST['NDS'])) { $settings['NDS'] = $_POST['NDS']; } $settings['pay_form'] = isset($_POST['pay_form']) ? $_POST['pay_form'] : null; // Получание информации о заказе $Order = new Orders(); $Order->SetFieldsById($settings['order']); $order_details = $Order->fields; $Customers = new Customers(); $Address = new Address(); $address = $Address->GetAddressById($order_details['id_address']); $tpl->Assign('address', $address); if ($_POST['personal_client']) { $order_details['cont_person'] = $_POST['personal_client']; } else { $Customers->SetFieldsById($_POST['client']); $cstmr = $Customers->fields; if ($cstmr) { $tpl->Assign('cstmr', $cstmr); $Citys = new Citys(); $Citys->SetFieldsById($cstmr['id_city']); $order_details['address'] = $Citys->fields; } } $Invoice = new Invoice(); $ord = $Invoice->GetOrderData($settings['order']); $tpl->Assign('order_details', $order_details); $tpl->Assign('settings', $settings); $tpl->Assign('order', $ord); echo $tpl->Parse($GLOBALS['PATH_tpl'] . 'tcpdf.tpl');
<?php $GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/personal/'); // Подключаем необходимые классы $Customers = new Customers(); $cities = new Citys(); $contragents = new Contragents(); $delivery = new Delivery(); $deliveryservice = new DeliveryService(); $regions = new Regions(); // Все классы подключены $Address = new Address(); $addresses = $Address->GetListByUserId($_SESSION['member']['id_user']); $tpl->Assign('addresses', $addresses); /* selecting clear data */ // about customer $Customers->SetFieldsById($Users->fields['id_user']); $Customer = $Customers->fields; $cont_person = explode(' ', $Customer['cont_person']); // outside managers $contragents->SetList(); $availablemanagers = $contragents->list; // regions $allregions = $Address->GetRegionsList(); // delivery methods $delivery->SetDeliveryList(); $alldeliverymethods = $delivery->list; /* selecting saved data */ // city if ($Customer['id_city'] > 0) { $cities->GetSavedFields($Customer['id_city']);