Post by aleksandarpejas » Fri Dec 03, 2021 5:41 am

Hello, I've looked around the forum but can't find an answer. Does anybody know how I can remove the telephone field on the registration form? I don't need people's phones number. Can I do that from my admin page or do I need to change a lot of twig files. And I don't need news latter too I would like to get rid of that too


Posts

Joined
Wed Dec 01, 2021 8:14 am

Post by johnp » Fri Dec 03, 2021 7:09 am

Can you confirm your OC version?

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by aleksandarpejas » Fri Dec 03, 2021 7:42 am

johnp wrote:
Fri Dec 03, 2021 7:09 am
Can you confirm your OC version?
Version 3.0.3.8, I found a solution In the account twig file I put that part of the code as a comment and that is a hide phone number and in the same way, i did with the newsletter. But now there is another problem I can't find a twig file where if I want as a user to change my information Image

Attachments

Screenshot_39.jpg

inf - Screenshot_39.jpg (35.3 KiB) Viewed 780 times



Posts

Joined
Wed Dec 01, 2021 8:14 am

Post by moshair » Fri Dec 03, 2021 6:50 pm

Telephone is a required value in oc, you can't just comment or remove the input fields in templates.

catalog/view/theme/default/template/account/register.twig
Remove

Code: Select all

         <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
            <div class="col-sm-10">
              <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
              {% if error_telephone %}
              <div class="text-danger">{{ error_telephone }}</div>
              {% endif %} </div>
          </div>
and for the newsletter:
remove

Code: Select all

        <fieldset>
          <legend>{{ text_newsletter }}</legend>
          <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_newsletter }}</label>
            <div class="col-sm-10"> {% if newsletter %}
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="1" checked="checked" />
                {{ text_yes }}</label>
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="0" />
                {{ text_no }}</label>
              {% else %}
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="1" />
                {{ text_yes }}</label>
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="0" checked="checked" />
                {{ text_no }}</label>
              {% endif %} </div>
          </div>
        </fieldset>
catalog/view/theme/default/template/account/edit.twig
remove

Code: Select all

          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
            <div class="col-sm-10">
              <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
              {% if error_telephone %}
              <div class="text-danger">{{ error_telephone }}</div>
              {% endif %}
            </div>
          </div>
catalog/view/theme/default/template/checkout/register.twig
remove

Code: Select all

      <div class="form-group required">
        <label class="control-label" for="input-payment-telephone">{{ entry_telephone }}</label>
        <input type="text" name="telephone" value="" placeholder="{{ entry_telephone }}" id="input-payment-telephone" class="form-control" />
      </div>
edit controllers to remove telephone check:
edit
catalog/controller/account/register.php
catalog/controller/account/edit.php
catalog/controller/checkout/register.php
remove

Code: Select all

		
		if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
			$this->error['telephone'] = $this->language->get('error_telephone');
		}

New member

Posts

Joined
Sun Jul 21, 2019 3:27 pm

Post by paulfeakins » Fri Dec 03, 2021 7:56 pm

aleksandarpejas wrote:
Fri Dec 03, 2021 5:41 am
Hello, I've looked around the forum but can't find an answer. Does anybody know how I can remove the telephone field on the registration form?
How did you look because I found these 2 answers in 10 seconds on Google?
viewtopic.php?t=188438
viewtopic.php?t=204732

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by straightlight » Fri Dec 03, 2021 8:54 pm

paulfeakins wrote:
Fri Dec 03, 2021 7:56 pm
aleksandarpejas wrote:
Fri Dec 03, 2021 5:41 am
Hello, I've looked around the forum but can't find an answer. Does anybody know how I can remove the telephone field on the registration form?
How did you look because I found these 2 answers in 10 seconds on Google?
viewtopic.php?t=188438
viewtopic.php?t=204732
That's because he hasn't. It all depends on the keywords being used on those search engines.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by aleksandarpejas » Fri Dec 03, 2021 10:15 pm

moshair wrote:
Fri Dec 03, 2021 6:50 pm
Telephone is a required value in oc, you can't just comment or remove the input fields in templates.

catalog/view/theme/default/template/account/register.twig
Remove

Code: Select all

         <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
            <div class="col-sm-10">
              <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
              {% if error_telephone %}
              <div class="text-danger">{{ error_telephone }}</div>
              {% endif %} </div>
          </div>
and for the newsletter:
remove

Code: Select all

        <fieldset>
          <legend>{{ text_newsletter }}</legend>
          <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_newsletter }}</label>
            <div class="col-sm-10"> {% if newsletter %}
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="1" checked="checked" />
                {{ text_yes }}</label>
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="0" />
                {{ text_no }}</label>
              {% else %}
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="1" />
                {{ text_yes }}</label>
              <label class="radio-inline">
                <input type="radio" name="newsletter" value="0" checked="checked" />
                {{ text_no }}</label>
              {% endif %} </div>
          </div>
        </fieldset>
catalog/view/theme/default/template/account/edit.twig
remove

Code: Select all

          <div class="form-group required">
            <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
            <div class="col-sm-10">
              <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
              {% if error_telephone %}
              <div class="text-danger">{{ error_telephone }}</div>
              {% endif %}
            </div>
          </div>
catalog/view/theme/default/template/checkout/register.twig
remove

Code: Select all

      <div class="form-group required">
        <label class="control-label" for="input-payment-telephone">{{ entry_telephone }}</label>
        <input type="text" name="telephone" value="" placeholder="{{ entry_telephone }}" id="input-payment-telephone" class="form-control" />
      </div>
edit controllers to remove telephone check:
edit
catalog/controller/account/register.php
catalog/controller/account/edit.php
catalog/controller/checkout/register.php
remove

Code: Select all

		
		if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
			$this->error['telephone'] = $this->language->get('error_telephone');
		}

Thank you soo much for the help, and sorry about late answer, problem with time zone :)


Posts

Joined
Wed Dec 01, 2021 8:14 am
Who is online

Users browsing this forum: No registered users and 61 guests