I would agree that you should move the check into the USPS module itself ... the less you touch the core the better ...
Something like:
Code:
if (IS_ADMIN_FLAG) {
if (defined('MODULE_SHIPPING_USPS_STATUS')) {
//Check USPS Package Dimensions config
$dimensions=zen_get_configuration_key_value('MODULE_SHIPPING_USPS_DIMENSIONS');
$dimensions=preg_replace(array('/^[\s,:]*/','/[\s,:]*$/'),'',$dimensions); //Strip leading and trailing whitespace + separators
$dim_array=preg_split('/[\s,:]+/',$dimensions);
foreach ($dim_array as $k=>$dparam) {
if (!preg_match('/^(?P<dimensions>(?:\d{1,3}(?:\.\d{1,5})?x\d{1,3}(?:\.\d{1,5})?x\d{1,3}(?:\.\d{1,5})?)|regular);(?P<weight>\d{1,2}(?:\.\d{1,5})?|\+)(?:;(?P<container>[NRV]))?$/', $dparam)) {
$dimerr.='<br /><br />The parameters set in Package Dimensions Config #'.($k+1).' are invalid'.($dimerr?'.':(', please enter valid shipping parameters. Current setting will be overridden with default: \'regular;+\''));
}
}
if (preg_match('/^\s*$/',$dimensions)) {
$shipping_errors.='<br />You must enter valid dimension values. Current setting will be overridden with default: \'regular;+\'';
}
$shipping_errors.=$dimerr;
$this->title .= ($shipping_errors ? '<span class="alert">' . ' Dimension Values Errors ' . '</span>' : '');
$this->description .= '<span class="alert">' . $shipping_errors . '</span>';
}
}
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
I would also suggest moving the sent/recieved files to the /cache so that it is not using the root of the shop ...
Code:
file_put_contents(DIR_FS_SQL_CACHE . '/uspsRecieve.xml', $body);
file_put_contents(DIR_FS_SQL_CACHE . '/uspsSend.xml', $output);
Bookmarks