Assign maximum order weight for UPS
I need to hide UPS in the checkout whenever total order weight exceeds 800 pounds. (I already have customized shipping modules already in place for orders whose total weight exceeds 800, but are hidden when total weight < 800.)
So before I start hacking, I thought I'd ask if anyone else has already customized their UPS module in similar fashion. If it works with ZC 1.3.7 and the price isn't too steep, I would probably purchase the file modifications.
The url is ShedKitStore.com, for those who want to see what I'm talking about. It's a working store, so if you test the shipping methods, please include the word TEST in your name when setting up a customer account.
Thanks,
Sean
Re: Assign maximum order weight for UPS
I've been trying all afternoon to hardwire a conditional statement into ups.php that will trigger the UPS-can't-quote-shipping error if $shipping_weight >= 800 -- but so far no luck.
Can anyone familiar with the UPS module tell me which line you would modify?
Sean
Re: Assign maximum order weight for UPS
I haven't given up yet. In my latest attempt (doesn't work; can anyone tell me why?) I replaced
PHP Code:
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
} else {
$this->quotes = array('module' => $this->title,
'error' => 'UPS cannot quote a shipping cost for this order. Choose another shipping method, or contact the ShedKitStore if no other shipping method is displayed.');
}
with this:
PHP Code:
if ($ups_shipping_weight >= 800) {
$this->quotes = array('module' => $this->title,
'error' => 'UPS cannot quote a shipping cost for this order. Choose another shipping method, or contact the ShedKitStore if no other shipping method is displayed.');
}
elseif ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
} else {
$this->quotes = array('module' => $this->title,
'error' => 'UPS cannot quote a shipping cost for this order. Choose another shipping method, or contact the ShedKitStore if no other shipping method is displayed.');
}
Re: Assign maximum order weight for UPS
Yet another failed attempt. Replaced
PHP Code:
if (empty($returnval)) $returnval = $errorret;
return $returnval;
with
PHP Code:
if ( (empty($returnval)) || ($shipping_weight >= 800) ) $returnval = $errorret;
return $returnval;
I can't afford to waste any more time on this. Does anyone have a clue what I'm missing?
A little desperate,
Sean :lookaroun
Re: Assign maximum order weight for UPS
This is not the most elquent method ... and should be fully tested ...
Find line 185:
PHP Code:
$this->quotes['methods'] = $methods;
Replace with:
PHP Code:
if ($ups_shipping_weight >= 800) {
// no ups
} else {
$this->quotes['methods'] = $methods;
}
Re: Assign maximum order weight for UPS
Thanks Linda. Doesn't work yet though. I still have a UPS quote when total order weight is over 800 lbs. Is $ups_shipping_weight the combined weight of the order (all packages) or just one package?
I have maximum package weight set at 70 lbs in Admin/Shipping -- dunno if that's relevant or not.
Quote:
Originally Posted by
Ajeh
This is not the most elquent method ... and should be fully tested ...
Find line 185:
PHP Code:
$this->quotes['methods'] = $methods;
Replace with:
PHP Code:
if ($ups_shipping_weight >= 800) {
// no ups
} else {
$this->quotes['methods'] = $methods;
}
Re: Assign maximum order weight for UPS
I just triple-checked to make sure the modified file is in place and the modification at 185 is the only deviation from the original. I really need to get better acquainted with PHP so I can answer a few of these questions for myself.
Is it possible there is something missing in the first half of that replacement code?
Sean <--( clueless )
Re: Assign maximum order weight for UPS
Fussy fussy fussy ... :rolleyes:
Add a blank Line a line 90 and put in this code instead:
PHP Code:
if (IS_ADMIN_FLAG === false && $_SESSION['cart']->weight > 800) $this->enabled = false;
Re: Assign maximum order weight for UPS
Thanks Linda -- before I post, did you mean IS_ADMIN_FLAG === false or IS_ADMIN_FLAG == false? I'll assume it's the latter & try == first -- I'll post a reply in a few minutes.
Sean
Re: Assign maximum order weight for UPS
I really mean what I wrote ... :cool: