Page 4 of 5

Re: How can I make the "postcode" required when registering?

Posted: Sun Apr 03, 2011 7:34 am
by InfiniteDezigns
InfiniteDezigns wrote:QPhoria:

Although it's added, there still doesn't show a red asterix next to the zipcode at all and the customers aren't filling it out. I need to change the word from post code to Zip code and also need the Asterix next to it. Any suggestions?


http://www.dyelyfe.com/Store

I just ended up hacking it with the red Astrix. And changed the word post code to zip code. It looks perfect. But I hope this will be fixed in the upcoming 1.5 v of Opencart.

Re: How can I make the "postcode" required when registering?

Posted: Mon Apr 04, 2011 12:04 am
by i2Paq
InfiniteDezigns wrote:
Qphoria wrote:YOU DO NOT NEED TO APPLY THIS MOD IN 1.4.9 OR LATER AS IT HAS ALREADY BEEN ADDED AND AUTOMATICALLY REQUIRES BASED ON THE COUNTRY!

QPhoria:

Although it's added, there still doesn't show a red asterix next to the zipcode at all and the customers aren't filling it out. I need to change the word from post code to Zip code and also need the Asterix next to it. Any suggestions?


http://www.dyelyfe.com/Store

I just ended up hacking it with the red Astrix. And changed the word post code to zip code. It looks perfect. But I hope this will be fixed in the upcoming 1.5 v of Opencart.

That has nothing to do with Opencart but with the custom template your using!

Re: How can I make the "postcode" required when registering?

Posted: Mon Apr 04, 2011 12:08 am
by i2Paq
YOU DO NOT NEED TO APPLY THIS MOD IN 1.4.9 OR LATER AS IT HAS ALREADY BEEN ADDED AND AUTOMATICALLY REQUIRES BASED ON THE COUNTRY!

IF YOU USE A CUSTOM THEME YOU MAY HAVE TO MODIFY SOME OF THE THEME FILES!!!

Re: How can I make the "postcode" required when registering?

Posted: Tue Apr 05, 2011 1:28 am
by InfiniteDezigns
i2Paq wrote:YOU DO NOT NEED TO APPLY THIS MOD IN 1.4.9 OR LATER AS IT HAS ALREADY BEEN ADDED AND AUTOMATICALLY REQUIRES BASED ON THE COUNTRY!

IF YOU USE A CUSTOM THEME YOU MAY HAVE TO MODIFY SOME OF THE THEME FILES!!!
Then post once again what has to change in the Theme files?

Re: How can I make the "postcode" required when registering?

Posted: Thu Aug 11, 2011 10:45 am
by ImogenLockhart123
Thanks for the help, I have had the same problem, your solution worked perfectly (1.4.7). O0

Re: How can I make the "postcode" required when registering?

Posted: Mon Aug 15, 2011 4:37 am
by jimquim
ok how would i get rid of the Your Address field altogether and have them not required is this possible?

Your Address
Company:
* Address 1:
Address 2:
* City:
* Post Code:
* Country:
* Region / State:

Re: How can I make the "postcode" required when registering?

Posted: Mon Aug 22, 2011 9:34 pm
by webfeetdesign
Hi, ages ago I did this process for a client but only did it for new account register. I forgot to do it for the guest checkout. Is there a way of doing this? What are the files I would need to change?

The version of my opencart got removed (Don't ask me how!) is there a way of finding out? This will help me decide which code to use.

Cheers

It's sorted now, backtracked. Still not sure how to find the version though.

Re: How can I make the "postcode" required when registering?

Posted: Tue Mar 13, 2012 2:32 pm
by netpaydays
This works on the "initial" customer setup BUT If you add extra or multiple locations to that users account the zip code field is "not" a required field in that situation. Can you revise this post to make the zip code a required field when adding multiple locations to a user account as well?

Re: How can I make the "postcode" required when registering?

Posted: Fri Sep 07, 2012 1:10 pm
by javabean
i'm currently running 1.5.4.1 and it postcode isn't a requirement for USA and Canada but in real operations this is definitely needed. it does apply the requirement if the country is united kingdom. any ideas on how to fix this so it is required for USA and Canada? Thanks

Re: How can I make the "postcode" required when registering?

Posted: Fri Sep 07, 2012 10:33 pm
by JohnOC
@javabean: Select YES in your Admin -> System -> Localization -> Country -> United States -> Zip Code Required.

Do the same for Canada.

Re: How can I make the "postcode" required when registering?

Posted: Fri Sep 07, 2012 10:48 pm
by javabean
AWESOME! fixed it. thanks for the heads up. i should've looked closer. :)

Re: How can I make the "postcode" required when registering?

Posted: Sat Nov 24, 2012 1:24 pm
by robzcuy
Hi i have a question about "postal code" or something about it.. right now i'm developed an online shop using open cart, and when i try to use menu register, the register step is success but i cant login with my account that i previously made.. its on : http://www.netoneshop.com/index.php?rou ... t/register

And theres something strange, when my browser ask me to remember my password, it didnt remember my email, instead its remember my POSTAL CODE.. :-\
Image

and when i try to logging in...... :(
Image

i cant logging in even i input my correct email address and password, looks like the browser remember my postal code, not my email, or theres something broken on my open cart controller?? :-[ :-[ :-[ :-[ :-[

anybody can help me? please im a dead man walking now -____________-

Re: How can I make the "postcode" required when registering?

Posted: Mon Jan 07, 2013 9:31 am
by vntgeclassified
I recently purchased the Shoppa Theme and the Post codd shows as mandatory for the UK but not for the US, I'm using version 1.5.4, can you tell me how to correct this.

Re: How can I make the "postcode" required when registering?

Posted: Fri Jan 18, 2013 3:48 am
by sunster
@vntgeclassified Not sure if you are still looking for an answer, but it's a few posts above yours.

Thanks @JohnOC I came here looking for that answer

Re: How can I make the "postcode" required when registering?

Posted: Wed Jan 30, 2013 7:34 am
by vntgeclassified
SOLVED Thank You, Overlooked option in System/Localization/Countries in the Admin Panel.

Re: How can I make the "postcode" required when registering?

Posted: Mon Mar 11, 2013 2:04 pm
by admin0902
This is the fast way:

Just add <font color="red">*</font>, in the php!

Re: How can I make the "postcode" required when registering?

Posted: Tue May 07, 2013 4:56 am
by innocrea
All you guys are doing so difficult with editing source files etc. You don't have to do ANYTHING of this.

If you want to set postcode required the only thing you have to do is run the following SQL command:

Code: Select all

UPDATE oc_country SET `postcode_required` =1;
That's it!

Re: How can I make the "postcode" required when registering?

Posted: Tue Sep 17, 2013 10:59 am
by rangerfans
Qphoria wrote:Going to write this one and sticky it:

YOU DO NOT NEED TO APPLY THIS MOD IN 1.4.9 OR LATER AS IT HAS ALREADY BEEN ADDED AND AUTOMATICALLY REQUIRES BASED ON THE COUNTRY!

1. EDIT: catalog/controller/account/create.php
(If using v1.3.2 or newer)
FIND:

Code: Select all

if (isset($this->error['city'])) {
	$this->data['error_city'] = $this->error['city'];
} else {
	$this->data['error_city'] = '';
}
(If using v1.3.0 or older)
FIND:

Code: Select all

$this->data['error_city'] = @$this->error['city'];
AFTER, ADD: (ALL VERSIONS)

Code: Select all

if (isset($this->error['postcode'])) {
	$this->data['error_postcode'] = $this->error['postcode'];
} else {
	$this->data['error_postcode'] = '';
}

2. In that same file
FIND:

Code: Select all

if ((strlen(utf8_decode($this->request->post['city'])) < 3) || (strlen(utf8_decode($this->request->post['city'])) > 128)) {
      	$this->error['city'] = $this->language->get('error_city');
}
AFTER, ADD:

Code: Select all

if ((strlen(utf8_decode($this->request->post['postcode'])) < 1) || (strlen(utf8_decode($this->request->post['postcode'])) > 10)) {
      	$this->error['postcode'] = $this->language->get('error_postcode');
}
3. EDIT: catalog/language/english/account/create.php
FIND:

Code: Select all

$_['error_city']           = 'City must be greater than 3 and less than 128 characters!';
AFTER, ADD:

Code: Select all

$_['error_postcode']       = 'Postcode must be greater than 1 and less than 10 characters!';
4. EDIT: catalog/view/theme/default/template/account/create.tpl
FIND:

Code: Select all

<tr>
  <td><?php echo $entry_postcode; ?></td>
  <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" /></td>
</tr>
REPLACE WITH:

Code: Select all

<tr>
  <td><span class="required">*</span> <?php echo $entry_postcode; ?></td>
  <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" />
  <?php if ($error_postcode) { ?>
  <span class="error"><?php echo $error_postcode; ?></span>
  <?php } ?></td>
</tr>
thanks for share. this is usefull. many customers on my online shop do not to fill the postcode. so there is a big problem for us to shipping.we must to email customer,but some customers do not reply us with their postcode. we have to search their postcode in google.but this is very inaccurate. i have updated my code with this post, i think i will never meet this problem now. thanks very much

Re: How can I make the "postcode" required when registering?

Posted: Tue Nov 12, 2013 3:28 am
by ahmad.alattar
Qphoria wrote:Going to write this one and sticky it:

YOU DO NOT NEED TO APPLY THIS MOD IN 1.4.9 OR LATER AS IT HAS ALREADY BEEN ADDED AND AUTOMATICALLY REQUIRES BASED ON THE COUNTRY!

1. EDIT: catalog/controller/account/create.php
(If using v1.3.2 or newer)
FIND:

Code: Select all

if (isset($this->error['city'])) {
	$this->data['error_city'] = $this->error['city'];
} else {
	$this->data['error_city'] = '';
}
(If using v1.3.0 or older)
FIND:

Code: Select all

$this->data['error_city'] = @$this->error['city'];
AFTER, ADD: (ALL VERSIONS)

Code: Select all

if (isset($this->error['postcode'])) {
	$this->data['error_postcode'] = $this->error['postcode'];
} else {
	$this->data['error_postcode'] = '';
}

2. In that same file
FIND:

Code: Select all

if ((strlen(utf8_decode($this->request->post['city'])) < 3) || (strlen(utf8_decode($this->request->post['city'])) > 128)) {
      	$this->error['city'] = $this->language->get('error_city');
}
AFTER, ADD:

Code: Select all

if ((strlen(utf8_decode($this->request->post['postcode'])) < 1) || (strlen(utf8_decode($this->request->post['postcode'])) > 10)) {
      	$this->error['postcode'] = $this->language->get('error_postcode');
}
3. EDIT: catalog/language/english/account/create.php
FIND:

Code: Select all

$_['error_city']           = 'City must be greater than 3 and less than 128 characters!';
AFTER, ADD:

Code: Select all

$_['error_postcode']       = 'Postcode must be greater than 1 and less than 10 characters!';
4. EDIT: catalog/view/theme/default/template/account/create.tpl
FIND:

Code: Select all

<tr>
  <td><?php echo $entry_postcode; ?></td>
  <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" /></td>
</tr>
REPLACE WITH:

Code: Select all

<tr>
  <td><span class="required">*</span> <?php echo $entry_postcode; ?></td>
  <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" />
  <?php if ($error_postcode) { ?>
  <span class="error"><?php echo $error_postcode; ?></span>
  <?php } ?></td>
</tr>
hi,
I made postcode required for my country, it works, i now cant submit the form unless i enter a postcode, but it doesnt dhow any text telling uts required, its only showing the standard red star. any help on this?

Addition: im using OC 1.5.5.1

Re: How can I make the "postcode" required when registering?

Posted: Mon May 19, 2014 1:11 pm
by dakhoco2
Has anyone tried this on OC 1.4.8b??

Thanks