Post by agCamper » Fri Mar 02, 2012 10:27 am

Hi

Is there a way I can do that?

I'm not an expert in php but if some files need any modification I'm willing to learn the language. Just point me where to start.

Thanks. :)

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by agCamper » Wed Mar 07, 2012 4:01 am

No one?

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by Qphoria » Wed Mar 07, 2012 4:29 am

(1.5.x)

1. EDIT:
catalog/controller/account/register.php

2. FIND:

Code: Select all

if ($this->request->post['country_id'] == '') {
3. BEFORE, ADD:

Code: Select all

if ($country_info && $country_info['postcode_required'] && isset($this->request->post['postcode']) {

    $denied_zips = array(
        '10001',
        '10002',
        '10003',
    );
 
    if (in_array($this->request->post['postcode'], $denied_zips)) {
        $this->error['postcode'] = $this->language->get('error_postcode');
    }
} 

Add more zips to list above as needed.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by agCamper » Thu Mar 08, 2012 6:59 am

Thanks for your help.

The number of denied zips is bigger than the accepted zips. Is there a way insert the accepted zips instead ?

Thanks a lot!

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by straightlight » Thu Mar 08, 2012 7:12 am

Set the accepted zips in the array and change this line:

Code: Select all

if (in_array($this->request->post['postcode'], $denied_zips)) {
to read:

Code: Select all

if (!in_array($this->request->post['postcode'], $denied_zips)) {

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com contractor officials representative


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by agCamper » Thu Mar 08, 2012 7:21 am

I will test it right away.

Thanks a lot !

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by agCamper » Thu Mar 08, 2012 7:37 am

I added this before the line Qphoria sugested:

Code: Select all

if ($country_info && $country_info['postcode_required'] && isset($this->request->post['postcode']) { 
    		$denied_zips = array(
        	'10001',
        	'10002',
        	'10003',
    	);
 
    	if (!in_array($this->request->post['postcode'], $denied_zips)) {
        	$this->error['postcode'] = $this->language->get('error_postcode');
    	}
	} 
I saved it and when I tried to create a new account to test it I got this:

Parse error: syntax error, unexpected '{' in /home/oeconomi/public_html/catalog/controller/account/register.php on line 318

The line 318 is:

Code: Select all

if ($country_info && $country_info['postcode_required'] && isset($this->request->post['postcode']) {
Whats wrong with the code?

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by straightlight » Thu Mar 08, 2012 7:43 am

Replace:

Code: Select all

if ($country_info && $country_info['postcode_required'] && isset($this->request->post['postcode']) {
with:

Code: Select all

if (isset($country_info) && !empty($country_info['postcode_required']) && !empty($this->request->post['postcode'])) {

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com contractor officials representative


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by agCamper » Thu Mar 08, 2012 8:45 am

Thanks

No error this time but unfortunatly I was able to register a new account using any zip code.

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am

Post by straightlight » Thu Mar 08, 2012 8:52 am

From your Countries settings under the admin, did you set the postcode to be required ?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com contractor officials representative


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by agCamper » Thu Mar 08, 2012 9:19 am

straightlight wrote:From your Countries settings under the admin, did you set the postcode to be required ?
No, I set it to be required and it's working now, thanks ! :)

Newbie

Posts

Joined
Fri Mar 02, 2012 10:21 am
Who is online

Users browsing this forum: No registered users and 13 guests