Reply to comment

Thanks for this post! It really should be a lot simpler to things like this in Magento.

In my case, I also added a pattern check against a 2nd line of street address:

if( preg_match("/p\.* *o\.* *box/i", $this->getStreet(1))
|| preg_match("/p\.* *o\.* *box/i", $this->getStreet(2)) )
{
$errors[] = $helper->__('We cannot ship to PO boxes.');
}

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <apache>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <perl>, <php>, <python>, <ruby>, <xml>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.