// Context part 18
This commit is contained in:
@@ -39,13 +39,13 @@ class AuthControllerCore extends FrontController
|
||||
{
|
||||
parent::preProcess();
|
||||
|
||||
if (self::$cookie->isLogged() AND !Tools::isSubmit('ajax'))
|
||||
if ($this->context->customer->isLogged() AND !Tools::isSubmit('ajax'))
|
||||
Tools::redirect('index.php?controller=my-account');
|
||||
|
||||
if (Tools::getValue('create_account'))
|
||||
{
|
||||
$create_account = 1;
|
||||
self::$smarty->assign('email_create', 1);
|
||||
$this->context->smarty->assign('email_create', 1);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('SubmitCreate'))
|
||||
@@ -61,7 +61,7 @@ class AuthControllerCore extends FrontController
|
||||
else
|
||||
{
|
||||
$create_account = 1;
|
||||
self::$smarty->assign('email_create', Tools::safeOutput($email));
|
||||
$this->context->smarty->assign('email_create', Tools::safeOutput($email));
|
||||
$_POST['email'] = $email;
|
||||
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class AuthControllerCore extends FrontController
|
||||
{
|
||||
$create_account = 1;
|
||||
if (Tools::isSubmit('submitAccount'))
|
||||
self::$smarty->assign('email_create', 1);
|
||||
$this->context->smarty->assign('email_create', 1);
|
||||
/* New Guest customer */
|
||||
if (!Tools::getValue('is_new_customer', 1) AND !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
|
||||
$this->errors[] = Tools::displayError('You cannot create a guest account.');
|
||||
@@ -166,23 +166,23 @@ class AuthControllerCore extends FrontController
|
||||
{
|
||||
if (!$customer->is_guest)
|
||||
{
|
||||
if (!Mail::Send((int)(self::$cookie->id_lang), 'account', Mail::l('Welcome!'),
|
||||
if (!Mail::Send($this->context->language->id, 'account', Mail::l('Welcome!'),
|
||||
array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname))
|
||||
$this->errors[] = Tools::displayError('Cannot send email');
|
||||
}
|
||||
self::$smarty->assign('confirmation', 1);
|
||||
self::$cookie->id_customer = (int)($customer->id);
|
||||
self::$cookie->customer_lastname = $customer->lastname;
|
||||
self::$cookie->customer_firstname = $customer->firstname;
|
||||
self::$cookie->passwd = $customer->passwd;
|
||||
self::$cookie->logged = 1;
|
||||
self::$cookie->email = $customer->email;
|
||||
self::$cookie->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
$this->context->smarty->assign('confirmation', 1);
|
||||
$this->context->cookie->id_customer = (int)($customer->id);
|
||||
$this->context->cookie->customer_lastname = $customer->lastname;
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->logged = 1;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
$this->context->cookie->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
/* Update cart address */
|
||||
self::$cart->secure_key = $customer->secure_key;
|
||||
self::$cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
self::$cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
self::$cart->update();
|
||||
$this->context->cart->secure_key = $customer->secure_key;
|
||||
$this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->update();
|
||||
Module::hookExec('createAccount', array(
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
@@ -193,9 +193,9 @@ class AuthControllerCore extends FrontController
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'isSaved' => true,
|
||||
'id_customer' => (int)self::$cookie->id_customer,
|
||||
'id_address_delivery' => self::$cart->id_address_delivery,
|
||||
'id_address_invoice' => self::$cart->id_address_invoice,
|
||||
'id_customer' => (int)$this->context->cookie->id_customer,
|
||||
'id_address_delivery' => $this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
die(Tools::jsonEncode($return));
|
||||
@@ -252,20 +252,20 @@ class AuthControllerCore extends FrontController
|
||||
}
|
||||
else
|
||||
{
|
||||
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))
|
||||
self::$cookie->id_cart = (int)Cart::lastNoneOrderedCart((int)$customer->id);
|
||||
$this->context->cookie->id_customer = (int)($customer->id);
|
||||
$this->context->cookie->customer_lastname = $customer->lastname;
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->logged = 1;
|
||||
$this->context->cookie->is_guest = $customer->isGuest();
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
if (Configuration::get('PS_CART_FOLLOWING') AND (empty($this->context->cookie->id_cart) OR Cart::getNbProducts($this->context->cookie->id_cart) == 0))
|
||||
$this->context->cookie->id_cart = (int)Cart::lastNoneOrderedCart($this->context->customer->id);
|
||||
/* Update cart address */
|
||||
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->update();
|
||||
$this->context->cart->id_carrier = 0;
|
||||
$this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->update();
|
||||
Module::hookExec('authentication');
|
||||
if (!Tools::isSubmit('ajax'))
|
||||
{
|
||||
@@ -308,16 +308,16 @@ class AuthControllerCore extends FrontController
|
||||
}*/
|
||||
if (!isset($selectedCountry))
|
||||
$selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$countries = Country::getCountries((int)(self::$cookie->id_lang), true);
|
||||
$countries = Country::getCountries($this->context->language->id, true);
|
||||
|
||||
self::$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'countries' => $countries,
|
||||
'sl_country' => (isset($selectedCountry) ? $selectedCountry : 0),
|
||||
'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')
|
||||
));
|
||||
|
||||
/* Call a hook to display more information on form */
|
||||
self::$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'),
|
||||
'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop')
|
||||
));
|
||||
@@ -335,7 +335,7 @@ class AuthControllerCore extends FrontController
|
||||
$selectedDays = (int)($_POST['days']);
|
||||
$days = Tools::dateDays();
|
||||
|
||||
self::$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'years' => $years,
|
||||
'sl_year' => (isset($selectedYears) ? $selectedYears : 0),
|
||||
'months' => $months,
|
||||
@@ -343,7 +343,7 @@ class AuthControllerCore extends FrontController
|
||||
'days' => $days,
|
||||
'sl_day' => (isset($selectedDays) ? $selectedDays : 0)
|
||||
));
|
||||
self::$smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
@@ -363,11 +363,11 @@ class AuthControllerCore extends FrontController
|
||||
$back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key;
|
||||
if (!empty($back))
|
||||
{
|
||||
self::$smarty->assign('back', Tools::safeOutput($back));
|
||||
$this->context->smarty->assign('back', Tools::safeOutput($back));
|
||||
if (strpos($back, 'order.php') !== false)
|
||||
{
|
||||
$countries = Country::getCountries((int)(self::$cookie->id_lang), true);
|
||||
self::$smarty->assign(array(
|
||||
$countries = Country::getCountries($this->context->language->id, true);
|
||||
$this->context->smarty->assign(array(
|
||||
'inOrderProcess' => true,
|
||||
'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
|
||||
'sl_country' => (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')),
|
||||
@@ -382,7 +382,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->processAddressFormat();
|
||||
|
||||
parent::displayContent();
|
||||
self::$smarty->display(_PS_THEME_DIR_.'authentication.tpl');
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'authentication.tpl');
|
||||
}
|
||||
|
||||
protected function processAddressFormat()
|
||||
@@ -401,7 +401,7 @@ class AuthControllerCore extends FrontController
|
||||
$addressItems[] = trim($fieldName);
|
||||
|
||||
foreach (array('inv', 'dlv') as $addressType)
|
||||
self::$smarty->assign(array($addressType.'_adr_fields' => $addressFormat, $addressType.'_all_fields' => $addressItems));
|
||||
$this->context->smarty->assign(array($addressType.'_adr_fields' => $addressFormat, $addressType.'_all_fields' => $addressItems));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user