Post by barnesnet » Fri Oct 22, 2010 10:58 pm

Hi there,
I’m trying / wanting to change two fields in the guest checkout page step 1.

First:
Completely remove the ‘Fax:’ field so that it is not there at all.
I know you can simply remove these lines from

Code: Select all

catalog/view/theme/?theme/template/checkout/guest_step_1.tpl

Code: Select all

<tr>
            <td><?php echo $entry_fax; ?></td>
            <td><input type="text" name="fax" value="<?php echo $fax; ?>" /></td>
          </tr>
But what else needs to be edited to make all related coding happy that is missing?

Second:
I “simply” would like to make the telephone field non-required (optional)
I guess the span class on the 1st line here would remove the red asterisk:

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>
But what file and coding actually makes that filed required? I’m guessing its in the controller/checkout/guest_step_1.php somewhere but I don’t understand what it all says.

I have searched and only found links to other posts that refer to making postcode required when creating account.
Any specific details for my venture would be greatly appreciated.



Many thanks

Simon

New member

Posts

Joined
Sat Oct 02, 2010 6:18 am


Post by kedgetech » Sat Oct 23, 2010 8:05 am

Hi Simon,

You might need to remove the controller - logic and error handling. May be check the model and database if these are mandatory in db

Hope that helps.

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by Johnathan » Sat Oct 23, 2010 10:57 am

To remove the required status of the telephone field, perform the following edit:

IN:

Code: Select all

/catalog/controller/checkout/guest_step_1.php
DELETE:

Code: Select all

if ((strlen(utf8_decode($this->request->post['telephone'])) < 3) || (strlen(utf8_decode($this->request->post['telephone'])) > 32)) {
    $this->error['telephone'] = $this->language->get('error_telephone');
} 
If you want to be completionist, you can also remove (from the same file) the now useless code:

Code: Select all

if (isset($this->error['telephone'])) {
    $this->data['error_telephone'] = $this->error['telephone'];
} else {
    $this->data['error_telephone'] = '';
} 
You can then delete the "required" span that you noted in the template file. I haven't tested this edit, but it should work. Also, always remember to back up before editing any core files.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by barnesnet » Sun Oct 24, 2010 3:20 am

Thanks folks,
Thanks Johnathan, that worked a treat on my test site, I actually left in the now useless code as it did stop an error appearing saying about undefined this that and the other.
I guess that could be dealt if you really want to but I am happy to leave the bit of code in as it could help if I ever need to revert to standard.
Going to apply it to by real site now.

How about the fax issue?

Help really appreciated

Simon

New member

Posts

Joined
Sat Oct 02, 2010 6:18 am


Post by Johnathan » Sun Oct 24, 2010 4:22 am

The easiest way is to just to hide the fax field by adding

Code: Select all

style="display: none" 
to the <tr> tag that encloses it. So it would end up looking like this:

Code: Select all

<tr style="display: none">
    <td><?php echo $entry_fax; ?></td>
    <td><input type="text" name="fax" value="<?php echo $fax; ?>" /></td>
</tr>
That will hide it from view, but still retain the code in case you want to use it in the future.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by barnesnet » Sun Oct 24, 2010 6:31 am

Excellent will give it a try tomorrow. Didn’t know you could do that.

Many thanks for all your help, really appreciated.

Simon

New member

Posts

Joined
Sat Oct 02, 2010 6:18 am

Who is online

Users browsing this forum: No registered users and 10 guests