本文整理汇总了PHP中Customers::updateCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::updateCustomer方法的具体用法?PHP Customers::updateCustomer怎么用?PHP Customers::updateCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customers
的用法示例。
在下文中一共展示了Customers::updateCustomer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
$tpl->Assign('SavedContragent', $SavedContragent->fields);
$tpl->Assign('DeliveryMethod', $DeliveryMethod->list);
$tpl->Assign('SavedDeliveryMethod', $SavedDeliveryMethod->fields);
if (isset($_POST['apply'])) {
require_once $GLOBALS['PATH_block'] . 't_fnc.php';
// для ф-ции проверки формы
$nocheck[] = 'keystring';
if (isset($_POST['passwd']) && $_POST['passwd'] == '') {
$nocheck[] = 'passwdconfirm';
$nocheck[] = 'passwd';
}
list($err, $errm) = Register_form_validate($nocheck);
if (!$err) {
$tpl->Assign('msg', 'Информация обновлена.');
$User->updateUser($_POST);
$Customer->updateCustomer($_POST);
$Customer->updateContPerson($_POST['cont_person']);
$Customer->updatePhones($_POST['phones']);
$Customer->updateContragent($_POST['id_manager']);
$Customer->updateCity($_POST['id_delivery_department']);
$Customer->updateDelivery($_POST['id_delivery']);
if (!$Customer->fields['bonus_card']) {
$Customer->registerBonus($_POST);
} else {
$Customer->updateBonus($_POST['bonus_card']);
}
header("Location: " . _base_url . "/cabinet");
} else {
// показываем все заново но с сообщениями об ошибках
$tpl->Assign('msg', 'Информация не обновлена.');
$tpl->Assign('errm', $errm);
示例2: Add
public function Add($arr = null)
{
global $Cart;
global $Products;
global $Users;
if (isset($arr)) {
$GetCartForPromo = $Cart->GetCartForPromo($arr);
$OrderCart = array();
foreach ($GetCartForPromo['products'] as $k => $v) {
$OrderCart[$v['id_product']] = $v;
}
//unset($GetCartForPromo);
$jo_order = 1;
}
$OrderCart = $arr === null ? $_SESSION['cart']['products'] : $OrderCart;
// Если список товаров в корзине пуст
if (empty($OrderCart)) {
print_r('products error');
return false;
}
if (isset($_SESSION['cart']['promo']) && substr($_SESSION['cart']['promo'], 0, 2) == 'AG') {
if (!$Users->SubscribeAgentUser($_SESSION['member']['id_user'], substr($_SESSION['cart']['promo'], 2))) {
print_r('agent subscription error');
return false;
}
}
// $discount = 0;
// if(isset($_SESSION['cart']['discount'])){
// if(isset($_SESSION['price_mode']) && $_SESSION['price_mode'] == 1){
// $discount = 1;
// }else{
// $discount = $_SESSION['cart']['discount'];
// }
// }
// $this->UpdateSuppliersTurn();
// Пересмотреть проверку актуальности цен
// $Cart->IsActualPrices($err, $warn, $errm, $warnings);
// if($err){
// if(isset($_SESSION['errm'])){
// $_SESSION['errm'] = array_merge($_SESSION['errm'], $errm);
// }else{
// $_SESSION['errm'] = $errm;
// header('Location: '._base_url.'/cart/');
// exit();
// }
// }
// isset($_SESSION['member']['id_user']) ? $_SESSION['member']['id_user'] : $_SESSION['member']['id_user'] = $_POST['id_user'];
// isset($arr['discount']) ? $arr['discount'] : $arr['discount'] = 0;
// Определяем статус будущего заказа
$order_status = 0;
// Если у клиента есть промо-код - 11
if (isset($_SESSION['cart']['promo_code']) && $_SESSION['cart']['promo_code'] != '') {
// Написать проверку промо-кода
$f['id_order_status'] = $order_status = 11;
// Промо-заказ
} else {
$f['id_order_status'] = $order_status = 1;
// Обычный заказ
}
// Сохраняем номер заказа, на основании которого был создан текущщий
if (isset($_SESSION['cart']['base_order'])) {
$f['base_order'] = $_SESSION['cart']['base_order'];
}
$f['target_date'] = $target_date = strtotime('+2 day', time());
$f['creation_date'] = time();
$f['id_customer'] = isset($_SESSION['cart']['id_customer']) ? $_SESSION['cart']['id_customer'] : $_SESSION['member']['id_user'];
$Customers = new Customers();
$Customers->SetFieldsById($f['id_customer']);
$customer = $Customers->fields;
// Определяем адрес по-умолчанию
$Address = new Address();
if ($customer_address = $Address->GetPrimaryAddress($f['id_customer'])) {
$_SESSION['member']['id_address'] = $f['id_addrress'] = $customer_address['id'];
}
// Обновляем контрагента у покупателя
if (isset($_SESSION['cart']['id_contragent'])) {
$array['id_contragent'] = $_SESSION['cart']['id_contragent'];
if ($_SESSION['member']['gid'] == _ACL_CUSTOMER_) {
$_SESSION['member']['contragent']['id_user'] = $_SESSION['cart']['id_contragent'];
$array['id_user'] = $_SESSION['member']['id_user'];
} elseif ($_SESSION['member']['gid'] == _ACL_CONTRAGENT_ && !empty($_SESSION['cart']['id_customer'])) {
$array['id_user'] = $_SESSION['cart']['id_customer'];
}
} elseif ($_SESSION['member']['gid'] == _ACL_CONTRAGENT_ && !empty($_SESSION['cart']['id_customer'])) {
$array['id_contragent'] = $_SESSION['member']['id_user'];
$array['id_user'] = $_SESSION['cart']['id_customer'];
}
if (isset($array['id_user'])) {
$Customers->updateCustomer($array);
}
// Определяем контрагента
if (isset($_SESSION['cart']['id_contragent'])) {
$id_contragent = $_SESSION['cart']['id_contragent'];
} else {
if ($_SESSION['member']['gid'] == _ACL_CONTRAGENT_) {
$id_contragent = $_SESSION['member']['id_user'];
} else {
//Определяем выходной или рабочий день у контрагента
$date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")));
$sql = "SELECT work_day FROM " . _DB_PREFIX_ . "calendar_contragent\r\n\t\t\t\t\tWHERE id_contragent = " . $customer['id_contragent'] . " AND date = '" . $date . "'";
//.........这里部分代码省略.........
示例3: Customers
$err = 1;
$errm['email'] = 'Пользователь с таким email уже зарегистрирован!';
}
}
if ($unique_phone !== true) {
$err = 1;
$errm['phone'] = 'Пользователь с таким номером телефона уже зарегистрирован!';
}
if (!$err) {
$Customers = new Customers();
$_POST['cont_person'] = (isset($_POST['first_name']) ? trim($_POST['first_name']) : null) . ' ' . (isset($_POST['middle_name']) ? trim($_POST['middle_name']) : null) . ' ' . (isset($_POST['last_name']) ? trim($_POST['last_name']) : null);
//Перезаписываем данные в сессии
$_SESSION['member']['name'] = $_POST['cont_person'];
$_SESSION['member']['email'] = $_POST['email'];
$_SESSION['member']['phone'] = $_POST['phone'];
if ($Customers->updateCustomer($_POST) && $Users->UpdateUser($_POST)) {
echo json_encode('true');
}
if (isset($_POST['avatar'])) {
$old_path = $GLOBALS['PATH_global_root'] . $_POST['avatar'];
$new_path = $GLOBALS['PATH_global_root'] . 'images/avatars/' . $_SESSION['member']['id_user'] . '.jpeg';
if (copy($old_path, $new_path)) {
unlink($old_path);
}
}
} else {
echo json_encode($errm);
}
break;
case 'AccessCode':
$Users = new Users();