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 | 4233 views | 11 replies

christy342106

Okay, I'm getting close, but I've made an error somewhere. My UPS shipping is still working fine, but if I select one of the flat-rate options, I get the error message, "invalid service type" on my shipping failure page. I'm thinking my error is in setting my session server behavior, but I also noticed that when I was making the shipping rules for flat-rate shipping, I would add the $5 or $10 cost (using the wizard for shipping rules), and when I would reopen my cart object, it had been reset to 0.

On my checkout page, I have the following select list for shipping:
<select name="UPS_Service" id="UPS_Service">
<option value="01">UPS Next Day Air</option>
<option value="02">UPS 2nd Day Air</option>
<option value="03" selected="selected">UPS Ground</option>
<option value="50">Standard USA</option>
<option value="100">Standard International</option>
</select>

On my confirm page, I have added the following session, selecting "UPS_Service" from my ecart_checkout_form (this is where I think I have made an error):

<?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"];
}
?>

Below are my reconfigured shipping rules:

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);
}


Thanks again for all your help!!

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