Jump to content

Error Create your account: You must register at least one phone number on ver. 1.5.2.0


sabin

Recommended Posts

Hi guys,

you can try this: open AuthController, find about line 380 that code and delete or comment out

if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile') &&
(Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_GUEST_CHECKOUT_ENABLED')))
  $this->errors[] = Tools::displayError('You must register at least one phone number');

 

then find about line 445

else // if registration type is in one step, we save the address
 {

 

and add inside

if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile'))
$this->errors[] = Tools::displayError('You must register at least one phone number');

 

Let me know if it works.

  • Like 1
Link to comment
Share on other sites

i solve this by coping the AuthController.php protected function processSubmitAccount() from preshtashop 1.5.1 and in 1.5.2 overide the function in overide folder -> controllers/front/AuthController.php

 

Hope it helps .

 

P.S.

for those who don`t have the function in hand , here it is

protected function processSubmitAccount()
{
 Hook::exec('actionBeforeSubmitAccount');
 $this->create_account = true;
 if (Tools::isSubmit('submitAccount'))
  $this->context->smarty->assign('email_create', 1);
 // New Guest customer
 if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
  $this->errors[] = Tools::displayError('You cannot create a guest account.');
 if (!Tools::getValue('is_new_customer', 1))
  $_POST['passwd'] = md5(time()._COOKIE_KEY_);
 if (isset($_POST['guest_email']) && $_POST['guest_email'])
  $_POST['email'] = $_POST['guest_email'];
 // Checked the user address in case he changed his email address
 if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email))
  if (Customer::customerExists($email))
   $this->errors[] = Tools::displayError('An account is already registered with this e-mail.', false);
 // Preparing customer
 $customer = new Customer();
 $_POST['lastname'] = Tools::getValue('customer_lastname');
 $_POST['firstname'] = Tools::getValue('customer_firstname');

 if (Configuration::get('PS_ONE_PHONE_AT_LEAST')
  && !Tools::getValue('phone')
  && !Tools::getValue('phone_mobile')
  && (Configuration::get('PS_ORDER_PROCESS_TYPE') //check if is in OPC mode
  || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !Configuration::get('PS_ORDER_PROCESS_TYPE')) //check if is simple registration mode and not in OPC mode)
  ))
  $this->errors[] = Tools::displayError('You must register at least one phone number');

 $this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
 // Check the requires fields which are settings in the BO
 $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());
 if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
 {

  if (!count($this->errors))
  {
   if (Tools::isSubmit('newsletter'))
 $this->processCustomerNewsletter($customer);
   $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
   $customer->active = 1;
   // New Guest customer
   if (Tools::isSubmit('is_new_customer'))
 $customer->is_guest = !Tools::getValue('is_new_customer', 1);
   else
 $customer->is_guest = 0;
   if (!count($this->errors))
 if (!$customer->add())
  $this->errors[] = Tools::displayError('An error occurred while creating your account.');
 else
 {
  if (!$customer->is_guest)
   if (!$this->sendConfirmationMail($customer))
    $this->errors[] = Tools::displayError('Cannot send e-mail');
  $this->updateContext($customer);
  $this->context->cart->update();
  Hook::exec('actionCustomerAccountAdd', array(
    '_POST' => $_POST,
    'newCustomer' => $customer
   ));
  if ($this->ajax)
  {
   $return = array(
    'hasError' => !empty($this->errors),
    'errors' => $this->errors,
    'isSaved' => true,
    '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));
  }
  // redirection: if cart is not empty : redirection to the cart
  if (count($this->context->cart->getProducts(true)) > 0)
   Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
  // else : redirection to the account
  else
   Tools::redirect('index.php?controller=my-account');
 }
  }
 }
 else // if registration type is in one step, we save the address
 {
  $lastnameAddress = $_POST['lastname'];
  $firstnameAddress = $_POST['firstname'];
  // Preparing address
  $address = new Address();
  $_POST['lastname'] = $lastnameAddress;
  $_POST['firstname'] = $firstnameAddress;
  $address->id_customer = 1;
  $this->errors = array_unique(array_merge($this->errors, $address->validateController()));
  // US customer: normalize the address
  if ($address->id_country == Country::getByIso('US'))
  {
   include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
   $normalize = new AddressStandardizationSolution;
   $address->address1 = $normalize->AddressLineStandardization($address->address1);
   $address->address2 = $normalize->AddressLineStandardization($address->address2);
  }
  $country = new Country((int)Tools::getValue('id_country'));
  if ($country->need_zip_code)
  {
   if (($postcode = Tools::getValue('postcode')) && $country->zip_code_format)
   {
 if (!$country->checkZipCode($postcode))
  $this->errors[] = sprintf(
   Tools::displayError('Zip/Postal code is invalid. Must be typed as follows: %s'),
   str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))
  );
   }
   elseif ($country->zip_code_format)
 $this->errors[] = Tools::displayError('Zip/Postal code is required.');
   elseif ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
 $this->errors[] = Tools::displayError('Zip/Postal code is invalid.');
  }
  if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
   $this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
  elseif (!$country->need_identification_number)
   $address->dni = null;
 }
 if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
  $this->errors[] = Tools::displayError('Invalid date of birth');
 if (!count($this->errors))
 {
  if (Customer::customerExists(Tools::getValue('email')))
   $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please enter your password or request a new one.', false);
  if (Tools::isSubmit('newsletter'))
   $this->processCustomerNewsletter($customer);
  $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);

  if (!count($this->errors))
  {
   // if registration type is in one step, we save the address
   if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE'))
 if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country))
  die(Tools::displayError());
   $contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
   $id_state = isset($address) && is_object($address) ? (int)$address->id_state: 0;
   if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && $contains_state && !$id_state)
 $this->errors[] = Tools::displayError('This country requires a state selection.');
   else
   {
 $customer->active = 1;
 // New Guest customer
 if (Tools::isSubmit('is_new_customer'))
  $customer->is_guest = !Tools::getValue('is_new_customer', 1);
 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;
  $this->errors = array_unique(array_merge($this->errors, $address->validateController()));
  if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$address->add())
   $this->errors[] = Tools::displayError('An error occurred while creating your address.');
  else
  {
   if (!$customer->is_guest)
   {
    $this->context->customer = $customer;
    $customer->cleanGroups();
    // we add the guest customer in the default customer group
    $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
    if (!$this->sendConfirmationMail($customer))
	 $this->errors[] = Tools::displayError('Cannot send e-mail');
   }
   else
   {
    $customer->cleanGroups();
    // we add the guest customer in the guest customer group
    $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
   }
   $this->updateContext($customer);
   $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)$customer->id);
   $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)$customer->id);
   // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
   $this->context->cart->update();
   // Avoid articles without delivery address on the cart
   $this->context->cart->autosetProductAddress();
   Hook::exec('actionCustomerAccountAdd', array(
	 '_POST' => $_POST,
	 'newCustomer' => $customer
    ));
   if ($this->ajax)
   {
    $return = array(
	 'hasError' => !empty($this->errors),
	 'errors' => $this->errors,
	 'isSaved' => true,
	 '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));
   }
   // if registration type is in two steps, we redirect to register address
   if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
    Tools::redirect('index.php?controller=address');
   if ($back = Tools::getValue('back'))
    Tools::redirect('index.php?controller='.$back);
   Tools::redirect('index.php?controller=my-account');
   // redirection: if cart is not empty : redirection to the cart
   if (count($this->context->cart->getProducts(true)) > 0)
    Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
   // else : redirection to the account
   else
    Tools::redirect('index.php?controller=my-account');
  }
 }
   }
  }
 }
 if (count($this->errors))
 {
  //for retro compatibility to display guest account creation form on authentication page
  if (Tools::getValue('submitGuestAccount'))
   $_GET['display_guest_checkout'] = 1;

  if (!Tools::getValue('is_new_customer'))
   unset($_POST['passwd']);
  if ($this->ajax)
  {
   $return = array(
 'hasError' => !empty($this->errors),
 'errors' => $this->errors,
 'isSaved' => false,
 'id_customer' => 0
   );
   die(Tools::jsonEncode($return));
  }
  $this->context->smarty->assign('account_error', $this->errors);
 }
}

Link to comment
Share on other sites

Hi guys,

you can try this: open AuthController, find about line 380 that code and delete or comment out

if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile') &&
(Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_GUEST_CHECKOUT_ENABLED')))
  $this->errors[] = Tools::displayError('You must register at least one phone number');

 

then find about line 445

else // if registration type is in one step, we save the address
 {

 

and add inside

if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile'))
$this->errors[] = Tools::displayError('You must register at least one phone number');

 

Let me know if it works.

 

Hi sebkos,

 

Thank you for sharing this fix. It worked for me. :)

Link to comment
Share on other sites

  • 2 months later...

Hi Guys,

 

Similar issue, i want to disable some field validation, i have the B2B checkout, and have some tax fields, but i want to disable validation on these fields, can you advise how since i think you know exactly in authcontroller.php

Link to comment
Share on other sites

i solve this by coping the AuthController.php protected function processSubmitAccount() from preshtashop 1.5.1 and in 1.5.2 overide the function in overide folder -> controllers/front/AuthController.php

 

Hope it helps .

 

P.S.

for those who don`t have the function in hand , here it is

protected function processSubmitAccount()
{
 Hook::exec('actionBeforeSubmitAccount');
 $this->create_account = true;
 if (Tools::isSubmit('submitAccount'))
  $this->context->smarty->assign('email_create', 1);
 // New Guest customer
 if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
  $this->errors[] = Tools::displayError('You cannot create a guest account.');
 if (!Tools::getValue('is_new_customer', 1))
  $_POST['passwd'] = md5(time()._COOKIE_KEY_);
 if (isset($_POST['guest_email']) && $_POST['guest_email'])
  $_POST['email'] = $_POST['guest_email'];
 // Checked the user address in case he changed his email address
 if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email))
  if (Customer::customerExists($email))
$this->errors[] = Tools::displayError('An account is already registered with this e-mail.', false);
 // Preparing customer
 $customer = new Customer();
 $_POST['lastname'] = Tools::getValue('customer_lastname');
 $_POST['firstname'] = Tools::getValue('customer_firstname');

 if (Configuration::get('PS_ONE_PHONE_AT_LEAST')
  && !Tools::getValue('phone')
  && !Tools::getValue('phone_mobile')
  && (Configuration::get('PS_ORDER_PROCESS_TYPE') //check if is in OPC mode
  || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !Configuration::get('PS_ORDER_PROCESS_TYPE')) //check if is simple registration mode and not in OPC mode)
  ))
  $this->errors[] = Tools::displayError('You must register at least one phone number');

 $this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
 // Check the requires fields which are settings in the BO
 $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());
 if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
 {

  if (!count($this->errors))
  {
if (Tools::isSubmit('newsletter'))
 $this->processCustomerNewsletter($customer);
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
$customer->active = 1;
// New Guest customer
if (Tools::isSubmit('is_new_customer'))
 $customer->is_guest = !Tools::getValue('is_new_customer', 1);
else
 $customer->is_guest = 0;
if (!count($this->errors))
 if (!$customer->add())
  $this->errors[] = Tools::displayError('An error occurred while creating your account.');
 else
 {
  if (!$customer->is_guest)
   if (!$this->sendConfirmationMail($customer))
	$this->errors[] = Tools::displayError('Cannot send e-mail');
  $this->updateContext($customer);
  $this->context->cart->update();
  Hook::exec('actionCustomerAccountAdd', array(
	'_POST' => $_POST,
	'newCustomer' => $customer
   ));
  if ($this->ajax)
  {
   $return = array(
	'hasError' => !empty($this->errors),
	'errors' => $this->errors,
	'isSaved' => true,
	'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));
  }
  // redirection: if cart is not empty : redirection to the cart
  if (count($this->context->cart->getProducts(true)) > 0)
   Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
  // else : redirection to the account
  else
   Tools::redirect('index.php?controller=my-account');
 }
  }
 }
 else // if registration type is in one step, we save the address
 {
  $lastnameAddress = $_POST['lastname'];
  $firstnameAddress = $_POST['firstname'];
  // Preparing address
  $address = new Address();
  $_POST['lastname'] = $lastnameAddress;
  $_POST['firstname'] = $firstnameAddress;
  $address->id_customer = 1;
  $this->errors = array_unique(array_merge($this->errors, $address->validateController()));
  // US customer: normalize the address
  if ($address->id_country == Country::getByIso('US'))
  {
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
$address->address1 = $normalize->AddressLineStandardization($address->address1);
$address->address2 = $normalize->AddressLineStandardization($address->address2);
  }
  $country = new Country((int)Tools::getValue('id_country'));
  if ($country->need_zip_code)
  {
if (($postcode = Tools::getValue('postcode')) && $country->zip_code_format)
{
 if (!$country->checkZipCode($postcode))
  $this->errors[] = sprintf(
   Tools::displayError('Zip/Postal code is invalid. Must be typed as follows: %s'),
   str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))
  );
}
elseif ($country->zip_code_format)
 $this->errors[] = Tools::displayError('Zip/Postal code is required.');
elseif ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
 $this->errors[] = Tools::displayError('Zip/Postal code is invalid.');
  }
  if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
  elseif (!$country->need_identification_number)
$address->dni = null;
 }
 if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
  $this->errors[] = Tools::displayError('Invalid date of birth');
 if (!count($this->errors))
 {
  if (Customer::customerExists(Tools::getValue('email')))
$this->errors[] = Tools::displayError('An account is already registered with this e-mail, please enter your password or request a new one.', false);
  if (Tools::isSubmit('newsletter'))
$this->processCustomerNewsletter($customer);
  $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);

  if (!count($this->errors))
  {
// if registration type is in one step, we save the address
if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE'))
 if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country))
  die(Tools::displayError());
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
$id_state = isset($address) && is_object($address) ? (int)$address->id_state: 0;
if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && $contains_state && !$id_state)
 $this->errors[] = Tools::displayError('This country requires a state selection.');
else
{
 $customer->active = 1;
 // New Guest customer
 if (Tools::isSubmit('is_new_customer'))
  $customer->is_guest = !Tools::getValue('is_new_customer', 1);
 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;
  $this->errors = array_unique(array_merge($this->errors, $address->validateController()));
  if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$address->add())
   $this->errors[] = Tools::displayError('An error occurred while creating your address.');
  else
  {
   if (!$customer->is_guest)
   {
	$this->context->customer = $customer;
	$customer->cleanGroups();
	// we add the guest customer in the default customer group
	$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
	if (!$this->sendConfirmationMail($customer))
	 $this->errors[] = Tools::displayError('Cannot send e-mail');
   }
   else
   {
	$customer->cleanGroups();
	// we add the guest customer in the guest customer group
	$customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
   }
   $this->updateContext($customer);
   $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)$customer->id);
   $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)$customer->id);
   // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
   $this->context->cart->update();
   // Avoid articles without delivery address on the cart
   $this->context->cart->autosetProductAddress();
   Hook::exec('actionCustomerAccountAdd', array(
	 '_POST' => $_POST,
	 'newCustomer' => $customer
	));
   if ($this->ajax)
   {
	$return = array(
	 'hasError' => !empty($this->errors),
	 'errors' => $this->errors,
	 'isSaved' => true,
	 '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));
   }
   // if registration type is in two steps, we redirect to register address
   if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
	Tools::redirect('index.php?controller=address');
   if ($back = Tools::getValue('back'))
	Tools::redirect('index.php?controller='.$back);
   Tools::redirect('index.php?controller=my-account');
   // redirection: if cart is not empty : redirection to the cart
   if (count($this->context->cart->getProducts(true)) > 0)
	Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
   // else : redirection to the account
   else
	Tools::redirect('index.php?controller=my-account');
  }
 }
}
  }
 }
 if (count($this->errors))
 {
  //for retro compatibility to display guest account creation form on authentication page
  if (Tools::getValue('submitGuestAccount'))
$_GET['display_guest_checkout'] = 1;

  if (!Tools::getValue('is_new_customer'))
unset($_POST['passwd']);
  if ($this->ajax)
  {
$return = array(
 'hasError' => !empty($this->errors),
 'errors' => $this->errors,
 'isSaved' => false,
 'id_customer' => 0
);
die(Tools::jsonEncode($return));
  }
  $this->context->smarty->assign('account_error', $this->errors);
 }
}

 

hi!

 

I am in 1.5.3 and when i click submit nothing happening so i cannot even get to the part where you have the phone number, does anyone know if this is the file causing the problem?

 

Thanks

Link to comment
Share on other sites

I have meet the same error.But after I set the Registration process type via Standard(account creation and address creation),the issue is solve.And when I set back "only account creation" the error is appear again.I don't know why it is this,and when I test in local,it is never meet this issue.

I use 1.5.3.1

Link to comment
Share on other sites

I have meet the same error.But after I set the Registration process type via Standard(account creation and address creation),the issue is solve.And when I set back "only account creation" the error is appear again.I don't know why it is this,and when I test in local,it is never meet this issue.

I use 1.5.3.1

 

hi,

 

thanks for your reply, i just tried that again but it did change anything. I have been playing with my local site this morning and i created a new database and uploaded a older version of the sql file and it is working locally. I am going to try and upload the same file to my DB on the server and see what happens.

 

Not sure why that would corrupt and stop this part working (me and myphpAdmin are not really very friendly!) Any ideas?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

To fix the error you could edit file authentication.tpl around line # 439 add the html shown below

 

 {if $one_phone_at_least}
 <p class="inline-infos">{l s='You must register at least one phone number'}</p>
 <p class="text">
  <label for="phone">{l s='Home phone'}</label>
  <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
 </p>
 <p class="text">
  <label for="phone_mobile">{l s='Mobile phone'} <sup>*</sup></label>
  <input type="text" class="text" name="phone_mobile" id="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{/if}" />
 </p>
 {/if}

 

If you want you could get the latest AuthController.php from here

http://scm.prestashop.com/browse/PrestaShop_v.1.5/controllers/front/AuthController.php?hb=true

 

Click Raw to downlode the file

Link to comment
Share on other sites

  • 2 weeks later...

Hi @ all!

 

i had the same problem. After many attempts i thought logically and placed following code in authentication.tpl:

insert after this block on line 261-265:

 <p class="checkbox">
  <input type="checkbox" name="optin" id="optin" value="1" {if isset($smarty.post.optin) && $smarty.post.optin == '1'}checked="checked"{/if}>
  <label for="optin">{l s='Receive special offers from our partners'}</label>
 </p>
{/if}

at line 266 the following:

{if $onr_phone_at_least}
  <p align="middle"><strong>{l s='You must register at least one phone number'} !</strong></p>
 <p class="required text">
  <label for="phone">{l s='Home phone'}</label>
  <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
 </p>
 <p class="required text">
  <label for="phone_mobile">{l s='Mobile phone'} <sup>*</sup></label>
  <input type="text" class="text" name="phone_mobile" id="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{/if}" />
 </p>
{/if}

 

Now the input fields for phone numbers are shown in both registration forms registration costumer and guest costumer.

In admin backend Options->Costumers set the phone number required option to yes and

in Options -> Orders set the guest checkout also to yes.

 

It worked perfectly in my PrestaShop™ 1.5.2.0.

I hope at your shop too!

 

GrEeTz, KASA

Edited by KASA (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Kasa, my copy of the tpl has lots of whitespace in it - every line has an empty one after it. I don't know if that's what yours is like, so I can't compare line numbers!

 

But it *seems* (see above!) you have inserted the code at the wrong place. In order for it to appear on the account creation page, it needs to be just above the line that reads "b2b_enable". That string appears only in one place so it's easy to find.

 

Actually, since instant checkout has a place for the phone anyway, in the address area, I don't think you need to apply the code there?

Link to comment
Share on other sites

  • 5 weeks later...
  • 3 years later...

Hi friends,

   While users try to create an account there is an error code "There is 1 error 1.optin is required." that get them stuck and i have tried all areas to troubleshoot and it seems effortless.

 

Kindly help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...