CRE Loaded Community

Banner


Board index » Web Design and Development » Development Discussions

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Customer forms: how to edit, disable 'post code' field
PostPosted: Wed Nov 17, 2010 12:00 am 
Offline
CRE Newbie

Joined: Mon Oct 18, 2010 11:14 am
Posts: 17
Hi.

I am using 6.4.1 B2B.

I live in a part of the world that does not use post codes or zip codes. Neither are they required for shipping.

Currently when a customer creates an account, or when a new customer goes directly to 'check-out' without registering, they are presented with a form to fill. They must fill in the post-code field because it is 'required'.

Questions:
1. How can I delete (or comment out) this field?
2. How can I stop the script validating this field and reporting an error when it is not filled in?
3. Will this cause any damage to the database?

I have turned off other fields (e.g. state) in admin but there is no option for the post code.
I have reduced the number of characters required to '0', but it still returns the error "must enter at least '0' characters".

Thanks a lot.

Paul (in Dubai)


Top
 Profile  
 
 Post subject: Re: Customer forms: how to edit, disable 'post code' field
PostPosted: Wed Nov 17, 2010 2:14 pm 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2394
Location: New Zealand
Hi Paul,

Yeah, a bit of editing to do this. There could be other files too that check postcode. Off the top, I think these would be ones to start with:

eg /catalog/address_book_process.php, /catalog/create_account.php

Code:
if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
      $error = true;

      $messageStack->add('addressbook', ENTRY_POST_CODE_ERROR);
    }

comment out with:

Code:
/*  if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
      $error = true;

      $messageStack->add('addressbook', ENTRY_POST_CODE_ERROR);
    } */

And then the 'display' in others:
eg /catalog/templates/content/create_account.tpl.php

Code:
<tr>
                <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
                <td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
              </tr>

Comment out with:
Code:
<!--// <tr>
                <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
                <td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
              </tr> //-->

(Probably also a field in /catalog/templates/content/contact_us.tpl.php although that one would be optional to complete)

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: Customer forms: how to edit, disable 'post code' field
PostPosted: Thu Nov 18, 2010 12:33 am 
Offline
CRE Newbie

Joined: Mon Oct 18, 2010 11:14 am
Posts: 17
Hi again Simon,

Thanks a lot for your help.

I edited all 4 files that you mention and 'post code' has disappeared and no error reports on the 'log-in' and 'contact us' pages! Marvellous!

However, it still appears in one screen - when a new customer decides not to register with the site, adds something to cart and then chooses the option to "proceed directly to checkout without creating account" they get the usual form but with the 'postcode' back in.

I have rummaged through some of the PHP files but I can't identify which one controls this particular page. Any ideas?

Thanks.

Paul (in Dubai)


Top
 Profile  
 
 Post subject: Re: Customer forms: how to edit, disable 'post code' field
PostPosted: Thu Nov 18, 2010 1:04 am 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2394
Location: New Zealand
Man I should be charging eh ...

/includes/modules/Order_info_check.php

Code:
<!-//       <tr>
            <td class="main">&nbsp;<?php echo ENTRY_POST_CODE; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only) {
    echo $account['entry_postcode'];
  } elseif ($error) {
    if ($entry_post_code_error) {
      echo tep_draw_input_field('postcode','','maxlength="10"') . '&nbsp;' . ENTRY_POST_CODE_ERROR;
    } else {
      echo $postcode . tep_draw_hidden_field('postcode');
    }
  } else {
    echo tep_draw_input_field('postcode', (isset($account['entry_postcode']) ? $account['entry_postcode'] : ''),'maxlength="10"') . '&nbsp;' . ENTRY_POST_CODE_TEXT;
  }
?></td>
          </tr> //-->


Depending on your template being used, you may need to check any /templates/default/modules/ files as well for this and all the other above files.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: Customer forms: how to edit, disable 'post code' field
PostPosted: Fri Nov 19, 2010 9:18 am 
Offline
CRE Newbie

Joined: Mon Oct 18, 2010 11:14 am
Posts: 17
Thank you Simon. Everything is now working fine and 'postcode' has gone.

I also edited templates/default/modules/Order_info_check.php just for good measure.

Yes you should charge! This requires a great amount of knowledge and experience, and when this is combined with an ability to explain clearly you are onto a winner!

Thanks again.

Paul (in Dubai)


Top
 Profile  
 
 Post subject: Re: Customer forms: how to edit, disable 'post code' field
PostPosted: Fri Nov 19, 2010 2:45 pm 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2394
Location: New Zealand
Heheh .. just kidding. Good result Paul!
Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

Board index » Web Design and Development » Development Discussions

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Thu May 17, 2012 8:27 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy