View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

shipping of each unique item separately?

Thread began 12/22/2009 5:58 pm by sam308940 | Last modified 1/05/2010 10:58 am by sam308940 | 965 views | 5 replies

Ray BorduinWebAssist

OK, here is your shipping charges expressed in a php function:

<?php
function getShipCharge($cartQuantity) {
$shipZone = isset($_SESSION['ship_stg'])?$_SESSION['ship_stg']:1;
$shipMethod = isset($_SESSION['ship_method'])?$_SESSION['ship_method']:1;
if ($cartQuantity < 100) { // 1-99 cards purchased
switch ($shipZone) {
case 1: // CT, DE, MA, ME, NH, NJ, NY, PA, RI, VT
switch ($shipMethod) {
case 1: // UPS Ground
return 10;
break;
}
break;
case 2: // DC, MD, NC, OH, SC, VA, WV
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 3: // USPS Express
return 30;
break;
}
break;
case 3: // AL, FL, GA, IA, IL, IN, KY, MI, MN, MO,TN, WI
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 18;
break;
case 3: // USPS Express
return 35;
break;
}
break;
case 4: // AK, AR, AZ, CA, CO, HI, ID, KS, LA, MS, MT, ND, NE, NM, NV, OK, OR, SD, TX, UT, WA, WY
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 18;
break;
case 3: // USPS Express
return 42;
break;
}
break;
case 5: // United Kingdom & Ireland
switch ($shipMethod) {
case 2: // USPS Priority
return 35;
break;
case 3: // USPS Express
return 45;
break;
}
break;
case 6: // Canada
switch ($shipMethod) {
case 2: // USPS Priority
return 28;
break;
case 3: // USPS Express
return 42;
break;
}
break;
}
} else if ($cartQuantity < 150) { // 100 - 149 cards purchased
switch ($shipZone) {
case 1: // CT, DE, MA, ME, NH, NJ, NY, PA, RI, VT
switch ($shipMethod) {
case 1: // UPS Ground
return 10;
break;
}
break;
case 2: // DC, MD, NC, OH, SC, VA, WV
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 3: // USPS Express
return 42;
break;
}
break;
case 3: // AL, FL, GA, IA, IL, IN, KY, MI, MN, MO,TN, WI
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 18;
break;
case 3: // USPS Express
return 45;
break;
}
break;
case 4: // AK, AR, AZ, CA, CO, HI, ID, KS, LA, MS, MT, ND, NE, NM, NV, OK, OR, SD, TX, UT, WA, WY
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 22;
break;
case 3: // USPS Express
return 48;
break;
}
break;
case 5: // United Kingdom & Ireland
switch ($shipMethod) {
case 2: // USPS Priority
return 45;
break;
case 3: // USPS Express
return 55;
break;
}
break;
case 6: // Canada
switch ($shipMethod) {
case 2: // USPS Priority
return 30;
break;
case 3: // USPS Express
return 45;
break;
}
break;
}
} else { // 150 or more cards purchased
switch ($shipZone) {
case 1: // CT, DE, MA, ME, NH, NJ, NY, PA, RI, VT
switch ($shipMethod) {
case 1: // UPS Ground
return 12.5;
break;
}
break;
case 2: // DC, MD, NC, OH, SC, VA, WV
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 3: // USPS Express
return 45;
break;
}
break;
case 3: // AL, FL, GA, IA, IL, IN, KY, MI, MN, MO,TN, WI
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 20;
break;
case 3: // USPS Express
return 52;
break;
}
break;
case 4: // AK, AR, AZ, CA, CO, HI, ID, KS, LA, MS, MT, ND, NE, NM, NV, OK, OR, SD, TX, UT, WA, WY
switch ($shipMethod) {
case 1: // UPS Ground
return 15;
break;
case 2: // USPS Priority
return 25;
break;
case 3: // USPS Express
return 52;
break;
}
break;
case 5: // United Kingdom & Ireland
switch ($shipMethod) {
case 2: // USPS Priority
return 55;
break;
case 3: // USPS Express
return 65;
break;
}
break;
case 6: // Canada
switch ($shipMethod) {
case 2: // USPS Priority
return 35;
break;
case 3: // USPS Express
return 55;
break;
}
break;
}
}
return 0;
}
?>



If you either add that code to an include file, or add the code itself, and put in on every page that has an ecart object on it.

Then go to the cart object definition Calculations tab and add a calculation that uses this function like:

RowShipping = getShipCharge([Quantity]);

Then you can create a single shipping rule to charge the total column value of the RowShipping calculation created.

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