За проверку "гостевой заказ или нет" отвечает переменная is_new_customer
Если она = 1 то оформление происходит как гостевое... Так же есть проверка стоит ли в настройках гостевой заказ - я ее убрал.
Но все ровно выдает "Ошибка создания учетной записи."...
Вот нашел еще кусок кода который тоже имеет к этому отношение
Код:
/* New Guest customer */
if (Tools::isSubmit('is_new_customer'))
$customer->is_guest = !Tools::getValue('is_new_customer', 0);
else
$customer->is_guest = 0;
if (!$customer->add())
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
else
{
$address->id_customer = (int)($customer->id);
if (!$address->add())
$this->errors[] = Tools::displayError('An error occurred while creating your address.');
else
{
if (!$customer->is_guest)
{
if (!Mail::Send((int)(self::$cookie->id_lang), '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);
/* 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();
Module::hookExec('createAccount', array(
'_POST' => $_POST,
'newCustomer' => $customer
));
if (Tools::isSubmit('ajax'))
{
$return = array(
'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,
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
if ($back = Tools::getValue('back'))
Tools::redirect($back);
Tools::redirect('my-account.php');
}
}