close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
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 | 268 views | 3 replies

troyd

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
Triggers:
UPS shipping quote > 0
AND SubTotal of Quantity == 1

Calculation:
Based on UPS shipping Quote value plus 0


Rule #2
Triggers:
Subtotal of Quantity > 1

Calculation:
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?
Scenario:
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,
TroyD

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

Content

rating

Layout

rating

Ease of use

rating

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