Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Assign maximum order weight for UPS

Assign maximum order weight for UPS

Locked

Views: 5,773

Results 1 to 20 of 41
This thread is locked. New replies are disabled.
25 Feb 2007, 5:47 PM
#1
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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

25 Feb 2007, 11:05 PM
#2
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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

26 Feb 2007, 12:26 AM
#3
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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 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
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.');
}
26 Feb 2007, 4:38 AM
#4
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

Yet another failed attempt. Replaced ```php
if (empty($returnval)) $returnval = $errorret;

return $returnval;

withphp
if ( (empty($returnval)) || ($shipping_weight >= 800) ) $returnval = $errorret;

return $returnval;

A little desperate,
Sean :lookaroun
26 Feb 2007, 4:49 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

This is not the most elquent method ... and should be fully tested ...

Find line 185:

      $this->quotes['methods'] = $methods;

Replace with:

    if ($ups_shipping_weight >= 800) {
    // no ups
    } else {
      $this->quotes['methods'] = $methods;
    }
26 Feb 2007, 5:05 AM
#6
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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.> Ajeh:

This is not the most elquent method ... and should be fully tested ...

Find line 185:

  $this->quotes['methods'] = $methods;
> 
> Replace with:
> ```php
    if ($ups_shipping_weight >= 800) {
    // no ups
    } else {
      $this->quotes['methods'] = $methods;
    }
26 Feb 2007, 5:32 AM
#7
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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 )

26 Feb 2007, 5:46 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

Fussy fussy fussy ... :rolleyes:

Add a blank Line a line 90 and put in this code instead:

    if (IS_ADMIN_FLAG === false && $_SESSION['cart']->weight > 800) $this->enabled = false;
26 Feb 2007, 5:55 AM
#9
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

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

26 Feb 2007, 5:56 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

I really mean what I wrote ... :cool:

26 Feb 2007, 6:05 AM
#11
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

Brava! Your insertion at 90 worked like a charm, Linda. And for the record, I went with ```php
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->weight > 800) $this->enabled = false;

Time for me to drop a few dollars in the donation box! :yes:
26 Feb 2007, 6:07 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

It is important for safety to use the triple equal sign ...

Thanks! appreciate the support!

26 Feb 2007, 6:32 AM
#13
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

Thanks for clarifying that, Linda. I changed the == back to your original === and added the triple-equals to my "how do comparison operators work" list. :P

G'nite! :sleepy: > Ajeh:

It is important for safety to use the triple equal sign ...

Thanks! appreciate the support!

3 Mar 2007, 3:16 AM
#14
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

With a slightly-modified ups.php (disabled when order >=800 lbs) and a cloned freeoptions module ("flatoptions" -- flat rate conditioned on order >=800 lbs and shipping address in contiguous U.S.), I am experiencing a checkout glitch where a customer can apply a coupon and have the cost of UPS shipping deducted unintentionally. Don't worry -- I'm convinced this is unique to my Zen-Cart, and I just need to track down my own mistake; this is not something you'll find in standard Zen-Cart 1.3.7 installations.

The explanation is tedious, so please bear with me.

A customer has a coupon code -- if you want to test it, try coupon code ZCZCZC. (I created this coupon code for community testing; it's only $5 off, but it illustrates my problem to anyone who feels like testing it.) Customer puts an allowed-for-coupon product (e.g. shed kit) in the cart and goes to checkout. Customer selects shipping method, e.g. free options AKA pickup at terminal. Customer enters redemption code when prompted, and the success text is displayed. Customer continues shopping and adds product that is denied-for-coupon to cart. Customer then removes allowed-for-coupon product from cart, leaving product that is denied-for-coupon. Customer goes back to checkout and selects new shipping method (e.g. UPS). Are you still with me?

The resulting order total credits the customer on the coupon redemption in the exact amount of the UPS shipping, up to the face value of the coupon, making UPS shipping unintentionally free whenever the coupon's face value >= the shipping fee.

I tried switching to the Classic template to see if the problem is template-related, but I get

Fatal error: Call to a member function on a non-object in ... /shedkitstore.com/includes/classes/category_tree.php on line 135when trying to checkout -- perhaps an overridden file or two eliminating the Classic option.

Something tells me I'll be working on this one all weekend ... :huh:

3 Mar 2007, 3:37 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

Definitely bad, missing, out of date or corrupt files on the server ...

Beyond Compare from scootersoftware.com is your friend ... :smile:

You can use this to do nice FTP compares of files and directories or things like the default files and templates to your template and overrides etc. to see where things are out of date ...

3 Mar 2007, 4:38 PM
#16
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

I have had Dreamweaver botch the synchronization of remote and local files too often. I'll try Beyond Compare and let you know what happens.

Thanks for the suggestion. :smile:> Ajeh:

Definitely bad, missing, out of date or corrupt files on the server ...

Beyond Compare from scootersoftware.com is your friend ... :smile:

You can use this to do nice FTP compares of files and directories or things like the default files and templates to your template and overrides etc. to see where things are out of date ...

4 Mar 2007, 2:50 AM
#17
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

After 10 hours conforming my files to Zen-Cart 1.3.7 core, I know now that I have no missing or corrupted files. But I don't know why a non-allowed discount coupon remains in force after the coupon-allowed product is removed from the cart.

I'm back to wondering whether any of my shipping module customizations would influence the discount coupon behavior in the order total ... :blink:

Is that possible?

4 Mar 2007, 2:52 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Assign maximum order weight for UPS

What are your restrictions settings?

Do you have Category Top deny turned on?

This forces a proper test on other Categories and Products when there are limitations ...

4 Mar 2007, 3:28 AM
#19
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

I didn't have Category Top deny at first, so I tried just now -- no change.

Original restrictions are Category 20 allow and Category 74 allow. That's it.

FYI, I tested this with identical restrictions on another 1.3.7 site (standard shipping modules) and it worked properly -- that is, discount coupon redemption went away when allowed category product was removed from the cart.> Ajeh:

What are your restrictions settings?

Do you have Category Top deny turned on?

This forces a proper test on other Categories and Products when there are limitations ...

4 Mar 2007, 3:30 AM
#20
tvadpro avatar

tvadpro

Zen Follower

Join Date:
Aug 2005
Location:
Cincinnati
Posts:
323
Plugin Contributions:
0

Re: Assign maximum order weight for UPS

Beyond Compare rocks, by the way. Does the job of two aps, and twice as well.