Forums / Addon Shipping Modules / PO Box Ban [support thread]

PO Box Ban [support thread]

Results 1 to 20 of 35
06 Jun 2008, 20:10
#1
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

PO Box Ban [support thread]

This is the support thread for the PO Box Ban contribution.

This mod effectively bans PO Box addresses from being used on your store.

It works by comparing the customer's address at sign-up with a range of words/letters often used with these addresses. Errors are displayed via the messageStack. The 'add shipping address' at checkout is also validated.

Installation is simple with only 3 files.

This mod can be found in the Downloads section:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=1031
08 Jun 2008, 00:39
#2
direwolf avatar

direwolf

New Zenner

Join Date:
Mar 2008
Posts:
25
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Steven300,

Will this mod work with version 1.3.7?

Thanks,

Doc
08 Jun 2008, 09:23
#3
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

direwolf:

Will this mod work with version 1.3.7?


It was written specifically for 1.3.8 but adapting it for 1.3.7 should be quite easy. Make a copy of your includes/modules/create_account.php file and override it in its corresponding override folder. Do the same for includes/modules/checkout_new_address.php. Then follow the instructions in the Merging section of the readme file. The third file, po_box_ban_defines.php, should be fine.
09 Jun 2008, 02:49
#4
direwolf avatar

direwolf

New Zenner

Join Date:
Mar 2008
Posts:
25
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Thanks, Steven! Works like a charm!
26 Jun 2008, 00:36
#5
jordana avatar

jordana

New Zenner

Join Date:
Apr 2007
Posts:
72
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Just installed this. When the user enters a PO Box from the checkout page it blocks it. However, if the user logs into his account, adds a new entry in the address book that is a PO Box and then places the order it doesn't block it. Also, on the "estimate shipping" page it shows no shipping options when the PO Box address is selected rather than showing an error message. Does someone know how I would fix these problems? Thanks.
26 Jun 2008, 10:05
#6
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Hi Jordana. Currently the contribution only validates the sign-up page and the 'add shipping address' at checkout. I did consider also validating the My Account area though I chose against this mainly because no overrides are available, and also because I felt that the majority of customers would be stopped either at sign-up or checkout and would consequently get the idea that PO Box addresses aren't welcome.

If you still want to validate the My Account area, you need to do the following. (This will validate both the Add Address and the Edit Address function).

Find this file:
includes/modules/pages/address_book_process/header_php.php

Just below this:
[PHP]if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
$error = true;
$messageStack->add('addressbook', ENTRY_STREET_ADDRESS_ERROR);
}[/PHP]

Add this:
[PHP]// BEGIN PO Box Ban 1/1
if (eregi('PO BOX', $street_address)) {
$error = true;
$messageStack->add('addressbook', PO_BOX_ERROR);
} else if (eregi('POBOX', $street_address)) {
$error = true;
$messageStack->add('addressbook', PO_BOX_ERROR);
} else if (eregi('P.O.', $street_address)) {
$error = true;
$messageStack->add('addressbook', PO_BOX_ERROR);
} else if (eregi('P.O', $street_address)) {
$error = true;
$messageStack->add('addressbook', PO_BOX_ERROR);
} else if (eregi('PO.', $street_address)) {
$error = true;
$messageStack->add('addressbook', PO_BOX_ERROR);
}
// END PO Box Ban 1/1[/PHP]

As previously mentioned, you will have to overwrite this file.

I will add these instructions to the mod in case anyone else wants to do the same.
26 Jun 2008, 19:59
#7
jordana avatar

jordana

New Zenner

Join Date:
Apr 2007
Posts:
72
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Thanks so much. I'll give it a try.
01 Dec 2008, 17:23
#8
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Hi. Request from shop owner: allow P.O. boxes on billing addresses, not on shipping addresses. We're getting a lot of complaints. possible?
02 Dec 2008, 11:52
#9
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

hzp:

Hi. Request from shop owner: allow P.O. boxes on billing addresses, not on shipping addresses. We're getting a lot of complaints. possible?


I think the easiest way would be to not upload the following file from the mod:
includes/modules/YOUR_TEMPLATE/create_account.php

This file controls the page where customers are to enter their billing information.

If already uploaded, delete or unmerge the file.
04 Dec 2008, 15:12
#10
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

I think the easiest way would be to not upload the following file from the mod:
includes/modules/YOUR_TEMPLATE/create_account.php

This file controls the page where customers are to enter their billing information.

If already uploaded, delete or unmerge the file.


unfortunately, merely deleting it seems to just result in it allowing ALL PO boxes... shipping and billing.
06 Jan 2009, 16:19
#11
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

ok. new problem. we are occasionally getting false PO box denies on addresses that are neither PO boxes or resemble PO boxes. hrrrrrm?

for instance, today one came in that was 568 Wagon Circle
06 Jan 2009, 19:13
#12
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Are you saying that "568 Wagon Circle" gets denied because I can't replicate that. Looking at the code, I can't see how a normal address could be caught by the mod. Have you customised the code at all?

[PHP]// BEGIN PO Box Ban 1/1
if (eregi('PO BOX', $street_address)) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if (eregi('POBOX', $street_address)) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if (eregi('P.O.', $street_address)) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if (eregi('P.O', $street_address)) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if (eregi('PO.', $street_address)) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
}
// END PO Box Ban 1/1[/PHP]

If you do know of an address that gets caught when it shouldn't, either now or sometime in the future, let me know what it is (or a slight varient of it) and I will modify the mod for you. But until then there's not much I can do.
06 Jan 2009, 20:59
#13
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

haven't modded the code at all. suddenly today, they've gotten 3 calls from people who can't register because of the PO box ban.
06 Jan 2009, 21:58
#14
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Strange. Well as I say, if you can replicate it just let me know the details. In the meantime, you might advise them to take down the mod if they don't want the problem repeated.
06 Jan 2009, 22:53
#15
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

I was able to replicate it in three cases. All of which had the letters P and O in the street name. If I changed one or the other, they went through.

Now, in one case its Pioneer. So its not as if they have to be right next to eachother, either. And there's no period, etc.

Any ideas? the cart is prettybabynaturals.com
07 Jan 2009, 12:02
#16
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

You're right, "Pioneer" does get denied. I believe it's because the .(dot) character has special meaning. I have been testing with the following code and it seems to be more accurate..

[PHP]// BEGIN PO Box Ban 1/1
if ( preg_match('/PO BOX/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/POBOX/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/P\.O\./si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/P\.O/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/PO\./si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
}
// END PO Box Ban 1/1[/PHP]

This is for includes/modules/your_template/create_account.php
07 Jan 2009, 21:21
#17
hzp avatar

hzp

New Zenner

Join Date:
Sep 2007
Posts:
35
Plugin Contributions:
0

Re: PO Box Ban [support thread]

THANK you. i think that worked..... I can't tell you how much I appreciate you taking the time to examine this for me, and follow up.
07 Jan 2009, 21:32
#18
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

No problem, thanks for confirming it worked :smile:
23 Jan 2009, 23:04
#19
girdy74 avatar

girdy74

New Zenner

Join Date:
Jul 2008
Posts:
26
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Hello! Using Zen Cart v 1.3.8. I want to make sure that I am correct before installing PO BOX BAN. We would like the PO BOX BAN on the shipping address and not on the billing address. Therefore, we install everything but the one part quoted above? (includes/modules/YOUR_TEMPLATE/create_account.php) and changing the code to tis:

// BEGIN PO Box Ban 1/1
if ( preg_match('/PO BOX/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/POBOX/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/P\.O\./si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/P\.O/si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
} else if ( preg_match('/PO\./si', $street_address) ) {
$error = true;
$messageStack->add('create_account', PO_BOX_ERROR);
}
// END PO Box Ban 1/1

for the includes/modules/your_template/create_account.php

Just making sure! I've already made a backup of course too!
23 Jan 2009, 23:34
#20
steven300 avatar

steven300

Totally Zenned

Join Date:
Jan 2008
Posts:
1,564
Plugin Contributions:
0

Re: PO Box Ban [support thread]

Hi, installing everything except the code you mentioned would prevent customers from entering PO Box addresses for shipping, whilst allowing PO Box addresses being entered for billing. However, this mod only validates form submissions so with the approach you are thinking of taking, it's conceivable that a customer could enter their PO Box address for billing, then let that address also be the shipping address, effectively avoiding any validated forms. Ideally the mod should check for this, but until then, I think applying the mod to all address forms is the only guaranteed way of 'banning' them.