close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


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

Thread began 9/04/2012 2:27 pm by troyd | Last modified 9/05/2012 2:29 pm by troyd | 351 views | 3 replies |


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']

From there I have 2 shipping rules.
Rule #1
UPS shipping quote > 0
AND SubTotal of Quantity == 1

Based on UPS shipping Quote value plus 0

Rule #2
Subtotal of Quantity > 1

Flat Rate of ($_SESSION["eCart1_UPS_Quote"] - $_SESSION['UPS_MaxRate']) * 0.5 + $_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?
Cart Contains 3 items
2 x Item#4
1 x Item#1
Neither Item#4s shipping should be discounted but Item#1 should be.

Thanks in advance,

Sign in to reply to this post


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).

Would this be the right direction? Any thoughts on this?


Sign in to reply to this post

Jason ByrnesWebAssist

your code to set the $_SESSION['UPS_MaxRate'] session would need to look at the quantity being used, and divide by that items quantity.

In reality this sort of custom coding is beyond the scope of what we can help you with in this forum, I would suggest signing up for a premiere support appointment to get assistance with this.

Sign in to reply to this post


Thanks Jason.

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.


Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...