Post by phaques » Fri Apr 22, 2011 8:24 am

Does anybody have any insight into a method of restricting customers from entering a PO Box into the shipping address?

User avatar
Newbie

Posts

Joined
Wed Sep 29, 2010 8:45 am

Post by grgr » Fri Apr 22, 2011 4:22 pm

On the guest checkout:

edit: ...\catalog\controller\checkout\guest_step_1.php

Line 480'ish add

Code: Select all

		$filestring = $this->request->post['address_1'];
		$findme  = 'po box';
		if (strlen(stristr($filestring,$findme))>0) {
			$this->error['address_1'] = $this->language->get('error_address_1_pobox');
     	}
Edit: ...\catalog\language\english\checkout\guest_step_1.php

Add:

Code: Select all

$_['error_address_1_pobox']   	= 'We can\'t ship to PO Boxes!';
You'll need to repeat this anywhere the address is entered.

Not entirely tested but should be ok.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by phaques » Sat Apr 23, 2011 8:41 am

That's fairly functional. One caveat, this also restricts those that have a PO Box for their payment address but not their shipping.

Also is there a way to add other spellings to the '$findme' string? Such as 'p.o. box' or 'p o box', etc.?

Thanks for the start!

User avatar
Newbie

Posts

Joined
Wed Sep 29, 2010 8:45 am

Post by grgr » Sat Apr 23, 2011 3:46 pm

Try:

Code: Select all

		$filestring = $this->request->post['address_1'];
 		$keywords = array("po box","pobox","p.o. box");
  			foreach ( $keywords as $keyword ) {
    		if ( stripos( $filestring, $keyword ) !== FALSE ) {
				$this->error['address_1'] = $this->language->get('error_address_1_pobox');
    		}
  		}
The only way I can think of sorting the other problem is by forcing seperate billing and shipping addresses.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by mberlant » Sat Apr 23, 2011 8:09 pm

There are so many variations possible in what a customer might put into the address field that it is not practical to test for all of them. You may test for "po box", but should you also test for "post office box", "p o box", "box", etc.? If you do, what do you do for a customer who lives in a house on Box Road?

About the only thing you can do is to to post prominently in your Terms and Conditions that you cannot ship to post office boxes, and that orders will be significantly delayed and will be subject to a surcharge for correcting the error if a customer inputs such a shipping address. Make acceptance of the terms a requirement of the checkout page.

It's not much of a help, but here is a link to Amazon's policy page to help you get an idea of how the "big boys" handle the problem.

Please use proper English at all times, so that all members may understand you.


User avatar
Active Member

Posts

Joined
Sun Mar 13, 2011 8:33 pm

Post by phaques » Sat Apr 23, 2011 11:34 pm

Thank you both!

I have already put that information into the Terms and also modified the template page to display a notice too. Just trying to make it as prominent as possible since people don't tend to read anything!

User avatar
Newbie

Posts

Joined
Wed Sep 29, 2010 8:45 am

Post by mberlant » Sun Apr 24, 2011 8:14 pm

phaques wrote:... Just trying to make it as prominent as possible since people don't tend to read anything!
Indeed, that's true. If you make something more idiot-proof you will only attract a stronger breed of idiot.

Please use proper English at all times, so that all members may understand you.


User avatar
Active Member

Posts

Joined
Sun Mar 13, 2011 8:33 pm

Post by phaques » Sun Apr 24, 2011 10:19 pm

Yes, survival of the dumbest.

User avatar
Newbie

Posts

Joined
Wed Sep 29, 2010 8:45 am

Post by phaques » Mon Jul 18, 2011 1:39 pm

Can anybody update this for v1.5?

I tried adding this to guest.php and the english file as done with the previous version, but I don't get the errors like I should. The cart just advances on.

Thanks in advance!

User avatar
Newbie

Posts

Joined
Wed Sep 29, 2010 8:45 am
Who is online

Users browsing this forum: No registered users and 319 guests