Discount UPS Quoted rates on 2nd, 3rd items but not the 1st or Oversized items.

Discount UPS Quoted rates on 2nd, 3rd items but not the 1st or Oversized items.

I am trying to apply the same sort of shipping discount that was outlined here in this thread showthread.php?t=25004 but with some differences.

In that previous thread, I was using Flat Rate shipping amounts stored in the db and then discounting the 2nd, 3rd, 4th and so on at 50% off the shipping but maintaing the full shipping rate of the first (highest rate) item's shipping.

This new cart is using UPS to calculate the shipping with the "One package per item purchased" as the method because the items must be shipped separately. Great, all works well.But now the client wants to discount each item's shipping by 50% after the 1st item. AND not discount certain oversized items at all. But the oversized items can count as the 1st item so that all other non oversized items get the 50% discount.

Basically they have 4 items. (All weights and box dimensions are obtained through the db).

Item#1- (1lb and ships in a small box)Item#2- (3lbs and ships in a medium box)Item#3- (8lbs and ships in a large box)Item#4- (Oversized, 40lbs and ships in a giant box)

At this point I have things working just like my previous post above.I did this by way of the following method to query the returned rates on each item. (May be a better way).

-First by using xpath, I queried the <TotalCharges> for each item returned from UPS's xml.-Then I find the highest of those rates and write to a session called $_SESSION['UPS_MaxRate']

This all works fine. So if there are two or more items in the cart it ignores Rule#1 and goes to Rule#2. This rule first gets the number from the eCart1_UPS_Quote session, then subtracts the UPS_MaxRate session, cuts it in half and adds the UPS_MaxRate session back it so that it isn't discounted.

[color=red]Problem Point[/color]Here's the problem. If there are 2 or more of the "Oversized Item" (Item#4), it's going to discount the rate of the second one. How do I prevent this?Scenario:

By the way. One thought I had was to add a 3rd rule that somehow added the amount that had been discounted back in. But I can't figure out how to apply that rule to trigger only on the Oversized item that has been discounted and not anything else. And of course, the 1st oversized item, which was not discounted, should not have anything added back in.

Basically it would be like this:

Rule #2 first discounts all shipping per item after the 1st highest item.

Rule #3 finds all "Oversized" items, (ignores the 1st one since it's always going to be the highest, non-discounted item), and then adds the amount(s) of the discounted shipping back in for the 2nd "Oversized" item(s).

I knew that querying specific nodes of the xml from UPS was out of the scope of eCart's support.Since I have that part done I thought maybe it would now come down to a special use of the eCart Shipping rules. However I've been unsuccessful setting the Trigger and Calculations of a 3rd rule here so I think you are right, I need to go back to the xpath query for some tweaking.

I have been studying the count() function of xpath. I will see if I make any progress. If not, I will do as you suggest and sign up for that ticket.

Either way, I will report back with my solution in case others come across this.