Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35
  1. #21
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: PO Box Ban [support thread]

    Hi Steven300

    Thanks for a great mod.

    Could you please explain the use of "/", "\" and "si" in your code, so that others might add their own additions without bothering you.

    I am thinking of adding the following

    GPO Box (is this already covered by your code?)
    Private Box
    Private Bag
    Locked Bag

    Best Regards

  2. #22
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: PO Box Ban [support thread]

    Sure.

    Well this is the most basic example of preg_match:

    PHP Code:
    if (preg_match("/choice/""PHP is the web scripting language of choice.")) {
        echo 
    "A match was found.";
    } else {
        echo 
    "A match was not found.";

    As you can see, the forward slash "/" indicates the start and end of the pattern.

    An "i" afterwards makes it case-insensitive.

    I can't remember exactly what the "s" means. It's something to do with matching a pattern when there's a new line.

    The period (dot) symbol is normally a wildcard (meaning it can stand for any single character). So if you actually want to match a period symbol itself, you need to escape it with a backslash "\" before it.

    Yes, "GPO Box" is already covered by the mod. The others will need adding.

    Further reference:
    http://php.net/manual/en/function.preg-match.php

  3. #23
    Join Date
    Oct 2009
    Posts
    26
    Plugin Contributions
    0

    Default Re: PO Box Ban [support thread]

    Also my web provider (Quadrahosting) says for their unix accounts there is not mods required for uCRL proxies.....

  4. #24
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: PO Box Ban [support thread]

    What does cURL have to do with the PO Box Ban mod?

    Are you in the right thread?

  5. #25
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: PO Box Ban [support thread]

    The following post by JayWilliams dated 6 December 2013 was imported from the now closed thread Re: PO Box Ban 1.4 [support thread].

    https://www.zen-cart.com/showthread....support-thread

    I cannot vouch for the post, but thought it worth preserving since the other thread has been closed.

    Apologies for any transgressions of forum rules.

    Cheers

    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)(??\.?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)(??\.?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.

  6. #26
    Join Date
    Jun 2015
    Location
    New England
    Posts
    29
    Plugin Contributions
    0

    Default Re: PO Box Ban [support thread]

    Howdy, I installed the 1.5a version of the mod on ZC 1.5.5b a couple of weeks ago. I copied the four files to the server and didn't modify code.

    Got an order today to a PO box in Canada from an existing customer. Customer had been registered since 2015. Am I correct in assuming this shouldn't happen or are there still use cases where it might slip through?

  7. #27
    Join Date
    Jun 2015
    Location
    New England
    Posts
    29
    Plugin Contributions
    0

    Default Re: PO Box Ban [support thread]

    By 'didn't modify code' I meant other than replacing files the directions stated I should.

    Any ideas why I received an order from an existing customer with a shipping and billing address as a PO box?

  8. #28
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: PO Box Ban [support thread]

    Quote Originally Posted by Patrick Vincent View Post
    By 'didn't modify code' I meant other than replacing files the directions stated I should.

    Any ideas why I received an order from an existing customer with a shipping and billing address as a PO box?
    Apologies for not responding earlier, but I have only just had a useless piece of my anatomy removed.

    While the trick to this mod is to add as many variant terms as possible to the list of possible post office addresses to defeat, it could be that some new php or regular expression function code has impacted part or all of this mod.

    However I have not looked at this mod or done any zen-cart upgrading or any coding for several years now for me to know whether any more recent code may have affected this mod.

    Nevertheless can you tell me what was the exact address line used? (please cut and paste here if possible)

    Also what Db character set are you using (eg utf8_general_ci may be faster than utf8_unicode_ci, but is often less correct)?

    cheers

  9. #29
    Join Date
    Jun 2015
    Location
    New England
    Posts
    29
    Plugin Contributions
    0

    Default Re: PO Box Ban [support thread]

    First - sorry to hear about the surgery, and no worries on the delay. Hope you heal up well.

    Address, specific with case sensitivity for the order that went through was "Po box 9140".

    DB... all tables show utf8_general_ci for collation.

    Thanks for the attention. Much appreciated.

  10. #30
    Join Date
    Jun 2015
    Location
    New England
    Posts
    29
    Plugin Contributions
    0

    Default Re: PO Box Ban [support thread]

    Copied and pasted from order confirmation email: Po box 9140

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 19
    Last Post: 23 Jan 2023, 08:04 AM
  2. 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
  3. v138a PO Box Ban 1.4 [support thread]
    By mvstudio in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 1 Feb 2018, 07:07 PM
  4. Commentics [Support Thread]
    By Commentics in forum All Other Contributions/Addons
    Replies: 11
    Last Post: 30 Jan 2013, 10:11 PM
  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