View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Add a flat-rate shipping option to UPS list

Thread began 9/23/2009 4:32 pm by christy342106 | Last modified 9/30/2009 8:49 pm by christy342106 | 4240 views | 11 replies

christy342106

I just wanted to run this code by you one more time to make sure I've set everything up correctly. If it looks okay and there seems to be an issue somewhere else, then we can set up a support ticket and go from there. I really appreciate your help with this.

I set up a test page to check the shipping charges in the cart display, and it does show the same result, which is no charge (or label) for shipping at all.


Flat rate set session:
<?php
if (!session_id()) session_start();
if((((isset($_POST["UPS_Service"]))?$_POST["UPS_Service"]:"") != "")) {
$_SESSION["flat_shipping"] = "".((isset($_POST["UPS_Service"]))?$_POST["UPS_Service"]:"") ."";
}
if(($_POST["UPS_Service"] != "") && (($_POST["UPS_Service"] == '50') || ($_POST["UPS_Service"] == '100')) ) { // I used 50 for US and 100 for internationsl
$_SESSION["flat_shipping"] = $_POST["UPS_Service"];
}
?>

UPS set session:
<?php
if (!session_id()) session_start();
if((((isset($_POST["UPS_Service"]))?$_POST["UPS_Service"]:"") != "")) {
$_SESSION["UPS_Service"] = "".((isset($_POST["UPS_Service"]))?$_POST["UPS_Service"]:"") ."";
}
?>

The beginning and end code of my UPS server behavior:
<?php if( !(isset($_SESSION["flat_shipping"])) ) { ?>
<?php
if ((((isset($_POST["Checkout_x"]))?$_POST["Checkout_x"]:"") != "")) {
//WA eCart (Copyright 2007, WebAssist)
//WA eCart UPS Shipping - UPS
$Shipping_SuccessURL = "";
$Shipping_FailureURL = "shipping_failure.php";
$Shipping_Packaging = 0;
$Shipping_PackageArray = array();
$Shipping_PackageIndex = 0;
$Shipping_Counter = 0;
$Shipping_Parameters = array();

etc., etc. ...
$Shipping_Result = WA_eCart_UPS_GetRateQuote($TJCart, $Shipping_Parameters, $Shipping_PackageArray);
if ($Shipping_Result && $Shipping_SuccessURL != "")
$TJCart->redirStr = $Shipping_SuccessURL;
else if (!$Shipping_Result && $Shipping_FailureURL != "") {
Header("Location: " . $Shipping_FailureURL); exit;
}
}
else if (!isset($_SESSION["TJCart_UPS_Success"])) {
WA_eCart_UPS_SetSessionDefaults($TJCart);
}
?>
<?php } ?>

Shipping Rules from cart object:
UPS Shipping Rule:
function WAEC_TJCart_UPSShipping() {
$totalShipping = 0;
if (true && (("UPS"=="UPS")&&(isset($_SESSION["TJCart_UPS_Quote"]))&&(floatval($_SESSION["TJCart_UPS_Quote"]) != 0) && ((isset($_SESSION['flat_rate'])?$_SESSION['flat_rate']:"") != "0") && ((isset($_SESSION['flat_rate'])?$_SESSION['flat_rate']:"") != "0"))) {
$totalShipping += floatval($_SESSION["TJCart_UPS_Quote"]) + 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

Flat-Rate Rules:
//eCart Rule
function WAEC_TJCart_FlatRateUSA() {
$totalShipping = 0;
if (true && ((isset($_SESSION['flat_shipping'])) && ((isset($_SESSION['flat_rate'])?$_SESSION['flat_rate']:"") == "50"))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_TJCart_FlatRateInternational() {
$totalShipping = 0;
if (true && ((isset($_SESSION['flat_rate'])) && ((isset($_SESSION['flat_rate'])?$_SESSION['flat_rate']:"") == "100"))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

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