A:
Form fields in OpenCart use php-based error handling. This means that if you remove a field from the template, the php code still looks for that field. If it doesn't find a value for it, it throws an error.
For non-required form fields like fax, company, and address_2, you can simply remove them from the tpl and they won't be missed.
But to properly remove a required form field, you need all the pieces to be removed. At this time, there are 3 spots where people can register. "account/register", "checkout/register", and "checkout/guest". OpenCart needs to work on combining the registration/checkout area to combine all into one step. The account and checkout system needs a bit of an overhaul to be simplified.
Anyway, to make the necessary changes... Determine which field you want to remove.
For this example, I will be removing the "telephone" field.
(v1.5.1)
1. Edit the first template file to remove the actual field from the html:
Code: Select all
catalog/view/theme/YOURTHEME/template/account/register.tpl
Code: Select all
<tr>
<td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
<td><input type="text" name="telephone" value="<?php echo $telephone; ?>" />
<?php if ($error_telephone) { ?>
<span class="error"><?php echo $error_telephone; ?></span>
<?php } ?></td>
</tr>
Code: Select all
catalog\controller\account\register.php
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');
}
5. EDIT the checkout/register template file:
Code: Select all
catalog/view/theme/YOURTHEME/template/checkout/register.tpl
Code: Select all
<span class="required">*</span> <?php echo $entry_telephone; ?><br />
<input type="text" name="telephone" value="" class="large-field" />
<br />
<br />
Code: Select all
<input type="hidden" name="telephone" value="" class="large-field" />
Code: Select all
catalog/controller/checkout/register.php
Code: Select all
if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
$json['error']['telephone'] = $this->language->get('error_telephone');
}
9. EDIT the checkout/guest template file:
Code: Select all
catalog/view/theme/YOURTHEME/template/checkout/guest.tpl
Code: Select all
<span class="required">*</span> <?php echo $entry_telephone; ?><br />
<input type="text" name="telephone" value="<?php echo $telephone; ?>" class="large-field" />
<br />
<br />
Code: Select all
<input type="hidden" name="telephone" value="<?php echo $telephone; ?>" class="large-field" />
Code: Select all
catalog/controller/checkout/guest.php
Code: Select all
if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) {
$json['error']['telephone'] = $this->language->get('error_telephone');
}
Now you should no longer see the telephone entry on any registration/checkout forms.
The process for 1.4.x is similar, but has code differences. If needed I will post that up but as we are working on improving this process, I am trying not to go too far back.