Estimate Shipping from View Cart Page
I have a simple form on the View Cart page to get the UPSP shipping estimate. The Form submits to getshipquote.php page that takes the entered zipcode and looks up the cost. The problem is that the quote page does not return back to the $Shipping_SuccessURL once it retrieves the estimate. It does however get the correct estimate and if something other than a zipcode is entered it does redirect to the $Shipping_FailureURL.
Is there something I'm missing here? Thanks!
View_cart.php form:
<form action="getshipquote.php" method="post" name="GetShipping">
<label>Destination Zip code: </label><input name="shipping_postcode" type="text" id="shipping_postcode" size="15" />
<input type="submit" name="button" id="button" value="Apply" /></form>
getshipquote.php code:
<?php
//WA eCart Include
require_once("../WA_eCart/ecoCart_PHP.php");
?>
<?php
$ecoCart->GetContent();
?>
<?php
//WA eCart UPS Shipping Include
require_once("../WA_eCart/WA_eCart_USPS_PHP.php");
?>
<?php
if ("" == "") {
//WA eCart (Copyright 2007, WebAssist)
//WA eCart USPS Shipping - USPS
$Shipping_SuccessURL = "view_cart.php";
$Shipping_FailureURL = "shipping_failure.php";
$Shipping_Packaging = 0;
$Shipping_PackageArray = array();
$Shipping_PackageIndex = 0;
$Shipping_Counter = 0;
$Shipping_Parameters = array();
$Shipping_Parameters["ShiptoZip"] = "".((isset($_POST["shipping_postcode"]))?$_POST["shipping_postcode"]:"") ."";
$Shipping_Parameters["ShiptoCountry"] = "United States";
$Shipping_Parameters["UserID"] = "60##########";
$Shipping_Parameters["USPSServer"] = "http://production.shippingapis.com/shippingapi.dll";
$Shipping_Parameters["CarrierCode"] = "FIRST CLASS";
$Shipping_Parameters["DefaultIntl"] = "none";
$Shipping_Parameters["ShipperZip"] = "90069";
while (($Shipping_Packaging == 1 && !$ecoCart->EOF()) || ($Shipping_Packaging == 0 && $Shipping_Counter == 0)) {
if (WA_eCart_USPS_IsTrueValue("true")) {
$Shipping_PackageArray[] = array();
$Shipping_PackageIndex = sizeof($Shipping_PackageArray)-1;
$Shipping_PackageArray[$Shipping_PackageIndex]["eCart_Quantity"] = (($Shipping_Packaging == 1)?$ecoCart->DisplayInfo("Quantity"):1);
$Shipping_PackageArray[$Shipping_PackageIndex]["IsPackage"] = "true";
$Shipping_PackageArray[$Shipping_PackageIndex]["Quantity"] = "1";
$Shipping_PackageArray[$Shipping_PackageIndex]["WeightUnits"] = "oz";
/* Replaced these with above entries
$Shipping_PackageArray[$Shipping_PackageIndex]["Quantity"] = "".WA_eCart_FormatNumber($ecoCart->DisplayInfo('Quantity'), true, 1) ."";
$Shipping_PackageArray[$Shipping_PackageIndex]["WeightUnits"] = "".strtolower($ecoCart->WeightUnits) ."";
*/
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageWeight"] = "".WA_eCart_FormatNumber($ecoCart->TotalColumn('TotalWeight'), true, 1) ."";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageType"] = "YOURPACKAGING";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageSize"] = "REGULAR";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageMachinable"] = "false";
$Shipping_PackageArray[$Shipping_PackageIndex]["IPackageType"] = "none";
//Special Services
}
$Shipping_Counter++;
if ($Shipping_Packaging == 1) $ecoCart->MoveNext();
}
if ($Shipping_Packaging == 1) $ecoCart->MoveFirst();
$Shipping_Result = WA_eCart_USPS_GetRateQuote($ecoCart, $Shipping_Parameters, $Shipping_PackageArray);
if ($Shipping_Result && $Shipping_SuccessURL != "")
$ecoCart->redirStr = $Shipping_SuccessURL;
else if (!$Shipping_Result && $Shipping_FailureURL != "") {
Header("Location: " . $Shipping_FailureURL); exit;
}
}
else if (!isset($_SESSION["ecoCart_USPS_Success"])) {
WA_eCart_USPS_SetSessionDefaults($ecoCart);
}
?>