Jump to content
  • 0

Customizing the signup.pdt to remove unnecessary registration fields.


Incog

Question

I have modified signup.pdt ( /plugins/order/views/templates/wizard ) to display as below. I have removed the un-needed fields from view as they're not needed for our business. The trouble I am having is that removing fields, even those that are NOT "required" results in the inability to proceed with the registration process. The page simply does not progress to the next step, and I can not determine why, as I do not believe any relevant code has been snipped. I only want to display the absolute minimum amount of forms required to process an order.

Screenshot_2021-01-31_04-30-10.thumb.png.a3feb860c73f4c1a5b05c8242c8f02c5.png

 

 

I have CHANGED this ORIGINAL section:

 

                <div class="col-md-12">
                    <h4><?php $this->_('Signup.index.heading_contact');?></h4>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_firstname', true), 'first_name');
                        $this->Form->fieldText('first_name', $this->Html->ifSet($vars->first_name), ['id' => 'first_name', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_firstname', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_lastname', true), 'last_name');
                        $this->Form->fieldText('last_name', $this->Html->ifSet($vars->last_name), ['id' => 'last_name', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_lastname', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_company', true), 'company');
                        $this->Form->fieldText('company', $this->Html->ifSet($vars->company), ['id' => 'company', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_company', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_title', true), 'title');
                        $this->Form->fieldText('title', $this->Html->ifSet($vars->title), ['id' => 'title', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_title', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_address1', true), 'address1');
                        $this->Form->fieldText('address1', $this->Html->ifSet($vars->address1), ['id' => 'address1', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_address1', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_address2', true), 'address2');
                        $this->Form->fieldText('address2', $this->Html->ifSet($vars->address2), ['id' => 'address2', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_address2', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_city', true), 'city');
                        $this->Form->fieldText('city', $this->Html->ifSet($vars->city), ['id' => 'city', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_city', true)]);
                        ?>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_country', true), 'country');
                        $this->Form->fieldSelect('country', $this->Html->ifSet($countries), $this->Html->ifSet($vars->country), ['id' => 'country', 'class' => 'form-control']);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_state', true), 'state');
                        $this->Form->fieldSelect('state', $this->Html->ifSet($states), $this->Html->ifSet($vars->state), ['id' => 'state', 'class' => 'form-control']);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_zip', true), 'zip');
                        $this->Form->fieldText('zip', $this->Html->ifSet($vars->zip), ['id' => 'zip', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_zip', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_phone', true), 'phone');
                        $this->Form->fieldHidden('numbers[type][0]', 'phone');
                        $this->Form->fieldHidden('numbers[location][0]', 'work');
                        $this->Form->fieldText('numbers[number][0]', $this->Html->ifSet($vars->numbers['number'][0]), ['id' => 'phone', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_phone', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_fax', true), 'fax');
                        $this->Form->fieldHidden('numbers[type][1]', 'fax');
                        $this->Form->fieldHidden('numbers[location][1]', 'work');
                        $this->Form->fieldText('numbers[number][1]', $this->Html->ifSet($vars->numbers['number'][1]), ['id' => 'fax', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_fax', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_email', true), 'email');
                        $this->Form->fieldText('email', $this->Html->ifSet($vars->email), ['id' => 'email', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_email', true)]);
                        ?>
                    </div>
                </div>


                <?php
                if ($this->Html->ifSet($show_client_tax_id)) {
                ?>
                <hr>
                <div class="col-md-12">
                    <h4><?php $this->_('Signup.index.heading_billing');?></h4>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_taxid', true), 'tax_id');
                        $this->Form->fieldText('tax_id', $this->Html->ifSet($vars->tax_id), ['id' => 'tax_id', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_taxid', true)]);
                        ?>
                    </div>
                </div>
                <?php
                }

                if ($this->Html->ifSet($custom_fields) && !empty($custom_fields)) {
                ?>
                    <hr>

                    <div class="col-md-12">
                        <h4><?php $this->_('Signup.index.heading_settings');?></h4>
                        <?php
                        // Display custom client fields
                        foreach ($custom_fields as $field) {
                        ?>
                        <div class="form-group">
                            <?php
                            // Set a unique field ID
                            $field_id = $this->Html->ifSet($custom_field_prefix) . $this->Html->ifSet($field->id);

                            // Show each custom field
                            $disabled = ($this->Html->ifSet($field->read_only) == '1' ? ['disabled' => 'disabled'] : []);
                            switch($field->type) {
                                case 'text':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldText($field_id, $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'select':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldSelect($field_id, $this->Html->ifSet($field->values, []), $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'textarea':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldTextarea($field_id, $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'checkbox':
                                    ?>
                                    <div class="checkbox">
                                        <label>
                                            <?php $this->Form->fieldCheckbox($field_id, $this->Html->ifSet($field->values), $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id], $disabled));?>
                                            <?php $this->Html->_($field->real_name);?>
                                        </label>
                                    </div>
                                    <?php
                                    break;
                            }
                            ?>
                        </div>
                        <?php
                        }
                        ?>
                    </div>

                <?php
                }
                ?>

                <hr>

                <div class="col-md-12">
                    <h4><?php $this->_('Signup.index.heading_authentication');?></h4>
                    <?php
                    if ($this->Html->ifSet($force_email_usernames, 'false') == 'true') {
                        $this->Form->fieldHidden('username_type', 'email');
                        $this->Form->fieldHidden('username', '');
                    ?>
                    <div class="alert alert-info">
                        <p><?php $this->_('Signup.!notice.force_email_usernames');?></p>
                    </div>
                    <?php
                    } else {
                    ?>
                    <div class="radio">
                        <label>
                            <?php
                            $this->Form->fieldRadio('username_type', 'email', ($this->Html->ifSet($vars->username_type, 'email') == 'email'), ['id'=>'username_type_email']);
                            $this->_('Signup.index.field_username_type_email');
                            ?>
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <?php
                            $this->Form->fieldRadio('username_type', 'username', ($this->Html->ifSet($vars->username_type) == 'username'), ['id'=>'username_type_username']);
                            $this->_('Signup.index.field_username_type_username');
                            ?>
                        </label>
                    </div>
                    <div class="form-group username">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_username', true), 'signup_username');
                        $this->Form->fieldText('username', $this->Html->ifSet($vars->username), ['id'=>'signup_username', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_username', true)]);
                        ?>
                    </div>
                    <?php
                    }
                    ?>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_newpassword', true), 'new_password');
                        $this->Form->fieldPassword('new_password', ['id'=>'new_password', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_newpassword', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_confirmpassword', true), 'confirm_password');
                        $this->Form->fieldPassword('confirm_password', ['id'=>'confirm_password', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_confirmpassword', true)]);
                        ?>
                    </div>
                    <?php
                    if ($this->Html->ifSet($show_receive_email_marketing) == 'true') {
                    ?>
                    <div class="form-group well">
                        <?php $this->Form->fieldCheckbox('receive_email_marketing', 'true', $this->Html->ifSet($vars->receive_email_marketing, 'false') == 'true', ['id' => 'receive_email_marketing']); ?>
                        <?php $this->Form->label($this->_('Signup.index.field_receive_email_marketing', true), 'receive_email_marketing', ['class' => 'inline']);?>
                    </div>
                    <?php
                    }
                    ?>
                </div>

 

The above is the ORIGINAL code, below is the modified code:

 

               <div class="col-md-12">
                    <h4><?php $this->_('Signup.index.heading_contact');?></h4>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_firstname', true), 'first_name');
                        $this->Form->fieldText('first_name', $this->Html->ifSet($vars->first_name), ['id' => 'first_name', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_firstname', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_lastname', true), 'last_name');
                        $this->Form->fieldText('last_name', $this->Html->ifSet($vars->last_name), ['id' => 'last_name', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_lastname', true)]);
                        ?>
                    </div>
                      <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_email', true), 'email');
                        $this->Form->fieldText('email', $this->Html->ifSet($vars->email), ['id' => 'email', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_email', true)]);
                        ?>
                    </div>
                </div>

                <div class="col-md-6">
				<strong>NOTICE!</strong><br />
				<ul>
					<li>If paying with <i>crypto</i>, you may choose an alias with no ID verification.<br />( <a href="https://incog.host/tworandomwords" target="_blank">Here is our random two-word generator</a> )</li>
					<li>If paying with PayPal or Credit Card we will need to verify your identify before setting up your account. This protects us from fraudulent orders. We will not store your personal identifying information about you (First/Last name, location information, etc) after verification.</li>				
				</ul>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_country', true), 'country');
                        $this->Form->fieldSelect('country', $this->Html->ifSet($countries), $this->Html->ifSet($vars->country), ['id' => 'country', 'class' => 'form-control']);
                        ?>
                        <ul>
                        <li>We are an American based company and must request your country of origin as we are forbidden from providing services to residents of: <i>Iran, Lebanon, Syria, Cuba, North Korea, Libya, Sudan, and Somalia.</i></li>
                        </ul>
                    </div>
                </div>
         
				<?php
                if ($this->Html->ifSet($custom_fields) && !empty($custom_fields)) {
                ?>
                    <hr>

                    <div class="col-md-12">
                        <h4><?php $this->_('Signup.index.heading_settings');?></h4>
                        <?php
                        // Display custom client fields
                        foreach ($custom_fields as $field) {
                        ?>
                        <div class="form-group">
                            <?php
                            // Set a unique field ID
                            $field_id = $this->Html->ifSet($custom_field_prefix) . $this->Html->ifSet($field->id);

                            // Show each custom field
                            $disabled = ($this->Html->ifSet($field->read_only) == '1' ? ['disabled' => 'disabled'] : []);
                            switch($field->type) {
                                case 'text':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldText($field_id, $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'select':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldSelect($field_id, $this->Html->ifSet($field->values, []), $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'textarea':
                                    $this->Form->label($this->Html->ifSet($field->real_name), $field_id);
                                    $this->Form->fieldTextarea($field_id, $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id, 'class' => 'form-control'], $disabled));
                                    break;
                                case 'checkbox':
                                    ?>
                                    <div class="checkbox">
                                        <label>
                                            <?php $this->Form->fieldCheckbox($field_id, $this->Html->ifSet($field->values), $this->Html->ifSet($vars->{$field_id}, $this->Html->ifSet($field->default)), array_merge(['id'=>$field_id], $disabled));?>
                                            <?php $this->Html->_($field->real_name);?>
                                        </label>
                                    </div>
                                    <?php
                                    break;
                            }
                            ?>
                        </div>
                        <?php
                        }
                        ?>
                    </div>

                <?php
                }
                ?>

                <hr>

                <div class="col-md-6">
                    <h4><?php $this->_('Signup.index.heading_authentication');?></h4>
                    <?php
                    if ($this->Html->ifSet($force_email_usernames, 'false') == 'true') {
                        $this->Form->fieldHidden('username_type', 'email');
                        $this->Form->fieldHidden('username', '');
                    ?>
                    <div class="alert alert-info">
                        <p><?php $this->_('Signup.!notice.force_email_usernames');?></p>
                    </div>
                    <?php
                    } else {
                    ?>
                    <div class="radio">
                        <label>
                            <?php
                            $this->Form->fieldRadio('username_type', 'email', ($this->Html->ifSet($vars->username_type, 'email') == 'email'), ['id'=>'username_type_email']);
                            $this->_('Signup.index.field_username_type_email');
                            ?>
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <?php
                            $this->Form->fieldRadio('username_type', 'username', ($this->Html->ifSet($vars->username_type) == 'username'), ['id'=>'username_type_username']);
                            $this->_('Signup.index.field_username_type_username');
                            ?>
                        </label>
                    </div>
                    <div class="form-group username">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_username', true), 'signup_username');
                        $this->Form->fieldText('username', $this->Html->ifSet($vars->username), ['id'=>'signup_username', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_username', true)]);
                        ?>
                    </div>
                    <?php
                    }
                    ?>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_newpassword', true), 'new_password');
                        $this->Form->fieldPassword('new_password', ['id'=>'new_password', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_newpassword', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_confirmpassword', true), 'confirm_password');
                        $this->Form->fieldPassword('confirm_password', ['id'=>'confirm_password', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_confirmpassword', true)]);
                        ?>
                    </div>
                    <?php
                    if ($this->Html->ifSet($show_receive_email_marketing) == 'true') {
                    ?>
                </div>
                <div class="col-md-12">
                    <div class="form-group well">
                        <?php $this->Form->fieldCheckbox('receive_email_marketing', 'true', $this->Html->ifSet($vars->receive_email_marketing, 'false') == 'true', ['id' => 'receive_email_marketing']); ?>
                        <?php $this->Form->label($this->_('Signup.index.field_receive_email_marketing', true), 'receive_email_marketing', ['class' => 'inline']);?>
                    </div>
                    <?php
                    }
                    ?>
                </div>

 

Is there any particular forms that have to be displayed in order for the information in the others to get processed?

 

For example, if I wanted to remove the company, title, and address 1 and address 2 forms I'd snip this, but doing so means that clicking "Create Account" does nothing but verify the CAPTCHA (if incorrect, you get warning. If correct, the page reloads and the button to "Create Account" is no longer clickable.

 

                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_company', true), 'company');
                        $this->Form->fieldText('company', $this->Html->ifSet($vars->company), ['id' => 'company', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_company', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_title', true), 'title');
                        $this->Form->fieldText('title', $this->Html->ifSet($vars->title), ['id' => 'title', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_title', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_address1', true), 'address1');
                        $this->Form->fieldText('address1', $this->Html->ifSet($vars->address1), ['id' => 'address1', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_address1', true)]);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_address2', true), 'address2');
                        $this->Form->fieldText('address2', $this->Html->ifSet($vars->address2), ['id' => 'address2', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_address2', true)]);
                        ?>
                    </div>

 

I know this may beyond the traditional support given here but I don't want to display registration fields that I don't need. First, Last, and Email are the only hard-coded required fields and those forms have not changed.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Upon further review, it appears that removing the Phone Number field causes the registration process to break... Even if the phone number is NOT a required option.

 

                    <div class="form-group">
                        <?php
                        $this->Form->label($this->_('Signup.index.field_phone', true), 'phone');
                        $this->Form->fieldHidden('numbers[type][0]', 'phone');
                        $this->Form->fieldHidden('numbers[location][0]', 'work');
                        $this->Form->fieldText('numbers[number][0]', $this->Html->ifSet($vars->numbers['number'][0]), ['id' => 'phone', 'class' => 'form-control', 'placeholder' => $this->_('Signup.index.field_phone', true)]);
                        ?>
                    </div>

 

I'm still going through and removing things form by form until I can figure out the minimum amount required to get the page to still function properly.... Though I'd prefer that the ones that aren't required not be visible.

 

I'm not planning on calling my customers to tell them happy birthday or mailing them Christmas cards. =]

Link to comment
Share on other sites

  • 0
17 hours ago, Jono said:

I'd have to look more to see why removing breaks it.  But for now you could add the 'hidden' class to the div containing them.

Ah, hadn't really considered that.

 

For quick reference, it seems that removing the: Phone and the Country fields breaks the order process. I tested with CAPTCHA on, and if you fail the captcha, you get the normal message/warning. If you complete it properly the page just reloads and the "Create Account" button becomes non-clickable.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...