BTW, though I hadn't seen that Ajeh had provided the solution (was reading emails from the thread rather than the thread itself) I had come up with something a little less "intrusive" though haven't tested it, just a "thought" experiment, but was something I was thinking could work for others in the future... Involves creating 2 files and using the observer/notifier systems. To be ever more elaborate could add some configuration items into the USPS script for install/remove to provide a field on the admin panel to replace the hard coded 8.00 that is below. Was written with consideration of the "standard" update function possibly going away (I doubt) so yes the same code is listed twice, but with the redesign in ZC 1.5.3, there are a few more "options".
First file (suggest uploading "last")
includes/auto_loaders/config.shipping_usps_quotes.php:
Code:
<?php
// loading of the class
$autoLoadConfig[10][] = array('autoType'=>'class',
'loadFile'=>'observers/class.shipping_usps_quotes.php');
$autoLoadConfig[199][] = array('autoType'=>'classInstantiate',
'className'=>'shipping_usps_quotes',
'objectName'=>'shipping_usps_quotes_obj');
?>
Second file (suggest loading "first")
includes/classes/observers/class.shipping_usps_quotes.php:
Code:
<?php
class shipping_usps_quotes extends base {
function shipping_usps_quotes () {
global $zco_notifier;
$this->attach($this, array('NOTIFY_SHIPPING_USPS_QUOTES_READY_TO_RETURN'));
} // end initialization of class
//Below is applicable to ZC version 1.5.3 and above, will be run instead of the update function.
function updateNotifyShippingUspsQuotesReadyToReturn(&$callingClass, $notifier, $paramsArray = array()) {
foreach ($callingClass->quotes['methods'] as $method) {
$method['cost'] = max($method['cost'], 8.00);
} // end loop on all methods
} // end observer update listener
//Below is applicable to all ZC versions with notify system associated.
function update(&$callingClass, $notifier, $paramsArray = array()) {
if ($notifier == 'NOTIFY_SHIPPING_USPS_QUOTES_READY_TO_RETURN') {
foreach ($callingClass->quotes['methods'] as $method) {
$method['cost'] = max($method['cost'], 8.00);
} // end loop on all methods
} // not a NOTIFY_SHIPPING_USPS_QUOTES_READY_TO_RETURN notifier
} // end update
} // end class
Bookmarks