} $tmp2 = array(); foreach ($tmp as $k => $v) { foreach ($arr as $k2 => $v2) { if ($k == $k2) { $tmp2[] = $v2; } } } $Products->list = $tmp2; } $tpl->Assign('list', $Products->list); } else { $tpl->Assign('list', array()); } $avaMan = $Contragent->GetContragentList(); $allMan = $Contragent->GetAllContragentList(); $CurrentCustomer = $Customer->SetFieldsById($current_user['id_user']); // Если нажата кнопка "Оформить заказ", "Сохранить черновик", "Редактировать информацию" или "Отменить редактирование" if (isset($_POST['p_order']) || isset($_POST['order']) || isset($_POST['apply']) || isset($_POST['cancel'])) { $Order = new Orders(); require_once $GLOBALS['PATH_block'] . 't_fnc.php'; // для ф-ции проверки формы list($err, $errm) = Order_form_validate(); if (!$err) { if ($id = $Order->Add($_POST)) { $tpl->Assign('msg', 'Заказ сформирован.'); $success = true; $Customer->updateContPerson($_POST['cont_person']); $Customer->updatePhones($_POST['phones']); unset($_POST);
$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 ($DeliveryService->SetList()) { $tpl->Assign('delivery_services', $DeliveryService->list); }