本文整理汇总了PHP中Guest::getFromCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Guest::getFromCustomer方法的具体用法?PHP Guest::getFromCustomer怎么用?PHP Guest::getFromCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guest
的用法示例。
在下文中一共展示了Guest::getFromCustomer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNewGuest
public static function setNewGuest($cookie)
{
$guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int) $cookie->id_customer) : null);
$guest->userAgent();
if ($guest->id_operating_system or $guest->id_web_browser) {
$guest->save();
$cookie->id_guest = (int) $guest->id;
}
}
示例2: setNewGuest
public static function setNewGuest($cookie)
{
$guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int) $cookie->id_customer) : null);
$guest->userAgent();
$guest->save();
$cookie->id_guest = (int) $guest->id;
}
示例3: preProcess
//.........这里部分代码省略.........
$this->errors[] = Tools::displayError('E-mail address required');
} elseif (!Validate::isEmail($email)) {
$this->errors[] = Tools::displayError('Invalid e-mail address');
} elseif (empty($passwd)) {
$this->errors[] = Tools::displayError('Password is required');
} elseif (Tools::strlen($passwd) > 32) {
$this->errors[] = Tools::displayError('Password is too long');
} elseif (!Validate::isPasswd($passwd)) {
$this->errors[] = Tools::displayError('Invalid password');
} else {
$customer = new Customer();
$authentication = $customer->getByEmail(trim($email), trim($passwd));
if (!$authentication or !$customer->id) {
$this->errors[] = Tools::displayError('Authentication failed');
} else {
self::$cookie->id_compare = isset(self::$cookie->id_compare) ? self::$cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
self::$cookie->id_customer = (int) $customer->id;
self::$cookie->customer_lastname = $customer->lastname;
self::$cookie->customer_firstname = $customer->firstname;
self::$cookie->logged = 1;
self::$cookie->is_guest = $customer->isGuest();
self::$cookie->passwd = $customer->passwd;
self::$cookie->email = $customer->email;
if (Configuration::get('PS_CART_FOLLOWING') and (empty(self::$cookie->id_cart) or Cart::getNbProducts(self::$cookie->id_cart) == 0) and $id_cart = (int) Cart::lastNoneOrderedCart((int) $customer->id)) {
self::$cart = new Cart($id_cart);
} else {
self::$cart->id_carrier = 0;
self::$cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
self::$cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
}
self::$cart->id_customer = (int) $customer->id;
// If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
self::$cart->secure_key = $customer->secure_key;
if ($id_guest = (int) Guest::getFromCustomer(self::$cart->id_customer)) {
self::$cart->id_guest = $id_guest;
}
self::$cart->save();
self::$cookie->id_cart = (int) self::$cart->id;
self::$cookie->update();
Module::hookExec('authentication');
if (!Tools::isSubmit('ajax')) {
if ($back = Tools::getValue('back')) {
Tools::redirect($back);
}
Tools::redirect('my-account.php');
}
}
}
if (Tools::isSubmit('ajax')) {
$return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'token' => Tools::getToken(false));
die(Tools::jsonEncode($return));
}
}
if (isset($create_account)) {
/* Select the most appropriate country */
if (isset($_POST['id_country']) and is_numeric($_POST['id_country'])) {
$selectedCountry = (int) $_POST['id_country'];
}
/* FIXME : language iso and country iso are not similar,
* maybe an associative table with country an language can resolve it,
* But for now it's a bug !
* @see : bug #6968
* @link:http://www.prestashop.com/bug_tracker/view/6968/
elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$array = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);