AbanteCart Community

Shopping Cart Operations => Support => Template Support => Topic started by: tosalet on October 20, 2012, 10:32:54 AM

Title: Customer Registration
Post by: tosalet on October 20, 2012, 10:32:54 AM
Many people object to revealing a telephone number when registering for an online account.  Unfortunately, it is a required field during the registration process.  How can I remove that requirement and leave it optional?

Many thanks.
Title: Re: Customer Registration
Post by: abantecart on October 20, 2012, 11:35:09 AM
There is no in admin setting to manage this yet. In the future we will have ability to build custom forms.

What you can do now is to do following simple edits in the code:

1. Open file storefront/controller/pages/account/create.php

Locate line: 119
Code: [Select]
$this->data['form'][ 'telephone' ] = $form->getFieldHtml( array(
                                                                       'type' => 'input',
                                                               'name' => 'telephone',
                                                               'value' => $this->request->post['telephone'],
                                                               'required' => true ));
Change : 'required' => true to  'required' => false

2. Open file /storefront/model/account/customer.php

Locate line : 87
Code: [Select]
    if ((strlen(utf8_decode($data['telephone'])) < 3) || (strlen(utf8_decode($data['telephone'])) > 32)) {
      $error['telephone'] = $this->language->get('error_telephone');
    }
Comment or remove line:
Code: [Select]
//$error['telephone'] = $this->language->get('error_telephone');

Done

Title: Re: Customer Registration
Post by: tosalet on October 21, 2012, 02:15:37 AM
Many thanks. Great product and great support!
Title: Re: Customer Registration
Post by: tosalet on October 26, 2012, 04:07:44 AM
Following on from this, I need to do the same for the guest checkout form. I have removed the 'required' field for telephone in 'guest_step_1 'but cannot find the correct .tpl to remove the error message. Could you please give me the location. Thanks.
Title: Re: Customer Registration
Post by: abolabo on October 26, 2012, 04:30:34 AM
storefront/view/default/template/pages/checkout/guest_step_1.tpl

storefront/controller/pages/checkout/guest_step_1.php line 527
Title: Re: Customer Registration
Post by: tosalet on October 26, 2012, 06:28:56 AM
Many thanks
Title: Re: Customer Registration
Post by: yujindeviant on January 05, 2017, 12:07:19 AM
I'm trying to make this mandatory. This is removing the requirement. I can't seem to find any of the lines above. Anyone able to assist?
Title: Re: Customer Registration
Post by: srajput on July 15, 2017, 12:40:38 AM
Hi, I also need to make telephone number a required field in both Guest and Customer registration forms. How can i do that?

Thank you in advance for your support.
Title: Re: Customer Registration
Post by: llegrand on July 16, 2017, 09:47:34 AM
This extension in the MarketPlace should solve your issue easily.

http://marketplace.abantecart.com/telephone_option (http://marketplace.abantecart.com/telephone_option)



Title: Re: Customer Registration
Post by: srajput on July 17, 2017, 08:27:17 PM
I made the changes below, now the telephone field in both forms is showing asterisk to indicate it is a required field. But when i submit form with telephone field being empty, it is submitted, and doesn't show error that telephone is empty. What do i need to enable that? like it shows error "Email Address does not appear to be valid!" if email field is left empty.

Quote
1. Open file storefront/controller/pages/account/create.php

Locate line: 119
Code: [Select]
      $this->data['form'][ 'telephone' ] = $form->getFieldHtml( array(
                                                                       'type' => 'input',
                                                                     'name' => 'telephone',
                                                                     'value' => $this->request->post['telephone'],
                                                                     'required' => true ));
Change : 'required' => true to  'required' => false

2. Open file /storefront/model/account/customer.php

Locate line : 87
Code: [Select]
       if ((strlen(utf8_decode($data['telephone'])) < 3) || (strlen(utf8_decode($data['telephone'])) > 32)) {
            $error['telephone'] = $this->language->get('error_telephone');
       }
Comment or remove line:
Code: [Select]
//$error['telephone'] = $this->language->get('error_telephone');

and

Quote
storefront/view/default/template/pages/checkout/guest_step_1.tpl

storefront/controller/pages/checkout/guest_step_1.php line 527
Title: Re: Customer Registration
Post by: Sam_78 on July 18, 2017, 11:05:56 AM
Hi srajput
Have you tried going into Design->Forms manager and goto phone number and make that field required..
Title: Re: Customer Registration
Post by: HADY on February 05, 2020, 06:53:40 AM
Hello!

I have the same issue and I would like to make the telephone number to be required. I changed the false to true but that's only showing the red star. How to make it active please?
Title: Re: Customer Registration
Post by: Basara on December 22, 2022, 05:18:54 AM
Hello!

I have the same issue and I would like to make the telephone number to be required. I changed the false to true but that's only showing the red star. How to make it active please?

Hello.
Check this 3rd party extension https://marketplace.abantecart.com/telephone_option