Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default PO Box Ban 1.4 [support thread]

    This is the support thread for the PO Box Ban 1.4

    We've made some much needed changes to the PO Box Ban 1.3 mod, and I've packed the module hoping it would be useful to someone else.

    Basically the problem was clients couldn't add a PO box to their billing address because the mod would launch an error message, so we started having complaints. The module was supposed to block the PO boxes from being added to shipping, not billing, but that wasn't working, so we made it work the way it should. Now customers can add PO boxes as their billing address, while the system will launch an error if a PO box is added as a shipping address.

    Another problem we were facing, because our store was already active when we installed this module, was that customers with existing PO box addresses in the database were able to checkout without the system launching any error. We were able to fix that issue and added an extra piece of code (thanks to a piece of code by DrByte) to the shipping module (ours is USPS but same code applies to any other module), so when a customer tries to checkout with a previously entered PO box address as a shipping address it will launch an error message, preventing checkout until a new address is entered.

    I've already uploaded the addon, so it's a matter of time until it's approved. This module is supper simple to install. Only 2 new files and modification to 4 files.

    Hope someone else can find it useful!
    M.Valenti
    Contemporary Artist - Entrepreneur
    http://www.manuelavalenti.com - http://www.byvalenti.com

  2. #2
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: PO Box Ban 1.4 [support thread]

    Addon was approved and is available for download http://www.zen-cart.com/index.php?ma...oducts_id=1031
    M.Valenti
    Contemporary Artist - Entrepreneur
    http://www.manuelavalenti.com - http://www.byvalenti.com

  3. #3
    Join Date
    Aug 2009
    Posts
    6
    Plugin Contributions
    1

    Default Re: PO Box Ban 1.4 [support thread]

    Thank you for updating this mod, however I do have a few improvements I'd like to pass along for inclusion in possible future versions.

    First, rather than running multiple preg_match() calls, you can combine all of them into one regular expression, this provides a performance boost, as well as less duplicate code. Second, I've extended the regular expression to avoid false positives (e.g. Boxer Dr, Polk St, Box Cir, etc.).

    Here is the primary snippet, which you can modify the message stack name for each instance:
    PHP Code:
    // BEGIN PO Box Ban 1/1
    if (preg_match('/(?:^|\W)(?:(?:P\.?O\.?\s*)?BOX|P\.?O\.?)\s*\d+/i'$street_address)) {
        
    $error true;
        
    $messageStack->add('addressbook'PO_BOX_ERROR);
    }
    // END PO Box Ban 1/1 
    Here is the shipping module snippet:
    PHP Code:
    // BEGIN PO Box Ban 1/1
    if (preg_match('/(?:^|\W)(?:(?:P\.?O\.?\s*)?BOX|P\.?O\.?)\s*\d+/i'$order->delivery['street_address'])) {
        
    $this->quotes = array(
            
    'module' => $this->title,
            
    'error'  => '<span class="alert messageStackError">Sorry, we do not ship to PO Boxes. Please change your shipping address.</span>');
        return 
    $this->quotes;
    }
    // END PO Box Ban 1/1 
    This regular expression is case-insensitive, and will match cases such as:
    • P.O. Box 123
    • POBOX 123
    • PO 123
    • BOX 123
    • BOX123
    • POBOX123
    • Etc.


    Hopefully this will help others trying to block PO Box addresses.

  4. #4
    Join Date
    Jan 2018
    Posts
    165
    Plugin Contributions
    4

    Default Re: PO Box Ban 1.4 [support thread]

    Updated for 1.5.5f what I was told is that you don't need to add this code to your shipping module. I will upload it shortly.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: PO Box Ban 1.4 [support thread]

    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. PO Box Ban [support thread]
    By Steven300 in forum Addon Shipping Modules
    Replies: 34
    Last Post: 21 Sep 2023, 05:47 AM
  2. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 19
    Last Post: 23 Jan 2023, 08:04 AM
  3. v154 News Box Manager v2.0.0 [Support Thread]
    By lat9 in forum All Other Contributions/Addons
    Replies: 84
    Last Post: 19 Jan 2021, 04:17 PM
  4. goMobile Support Thread
    By steveyork136 in forum Addon Templates
    Replies: 29
    Last Post: 26 Aug 2015, 11:56 AM
  5. Contact Us IP Ban [Support Thread]
    By 1100101 in forum All Other Contributions/Addons
    Replies: 13
    Last Post: 9 Nov 2010, 01:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR