The same code is used int he USPS plugin:
if(empty($order->shipping_address->address_post_code)){
$zoneClass=hikashop_get('class.zone');
$zones = $zoneClass->getOrderZones($order);
$db =& JFactory::getDBO();
$db->setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db->Quote('USA'));
$usa_zone = $db->loadResult();
if(in_array($us_zone,$zones)){
$messages['post_code_missing'] = 'The USPS shipping plugin requires the user to enter a postal code when goods are shipped within the United States. Please go to "Display->Custom fields" and set the post code field to required.';
continue;
}
}
So you can do the same modification:
$check = false;
if(empty($order->shipping_address->address_post_code)){
$check = true;
$message = 'The USPS shipping plugin requires the user to enter a postal code when goods are shipped within the United States. Please go to "Display->Custom fields" and set the post code field to required.';
}elseif(!preg_match('#^[0-9]{5}(-?[0-9]{4})?$#',$order->shipping_address->address_post_code)){
$check = true;
$message = 'The post code entered is not valid';
}
if($check){
$zoneClass=hikashop_get('class.zone');
$zones = $zoneClass->getOrderZones($order);
$db =& JFactory::getDBO();
$db->setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db->Quote('USA'));
$usa_zone = $db->loadResult();
if(in_array($usa_zone,$zones)){
$messages['post_code_missing'] = $message;
continue;
}
}
The aupost being included in HikaShop, the modification will be in next version of HikaShop.
It won't be added until then, but you can just reapply it after upgrading if you want to upgrade before the next version.