eCart / UPS Shipping
An eCart that was built with an older version of the software is not responding to shipping changes. Everything seems to be working properly except that the only thing the cart will do is add a flat shipping charge to each item-so if a person orders 13 of an item the shipping charge becomes 13 X $13. We have all the information to access the UPS API on confirm.php. The goal is to have the cart add a shipping charge based on weight of the total order rather than a flat charge per item. It does not appear to be registering changes made to shipping.
Code from confirm.php is below:
<?php
//WA eCart Include
require_once("WA_eCart/eCart1_PHP.php");
?><?php
$eCart1->GetContent();
//**** CODE
$tax=$_SESSION['tax'];
$charges=$_SESSION['charges'];
$discounts=$_SESSION['discounts'];
$totalPrice=$_SESSION['totalPrice'];
$totalShipping=$_SESSION['totalShipping'];
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_state_province"] = "".((isset($_POST["state_province"]))?$_POST["state_province"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["eCartCheckoutForm_country"] = "".((isset($_POST["country"]))?$_POST["country"]:"") ."";
}
?>
<?php
//WA eCart UPS Shipping Include
require_once("WA_eCart/WA_eCart_UPS_PHP.php");
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//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();
$Shipping_Parameters["ShiptoCity"] = "".((isset($_POST["shipping_city"]))?$_POST["shipping_city"]:"") ."";
$Shipping_Parameters["ShiptoState"] = "".((isset($_POST["shipping_state_province"]))?$_POST["shipping_state_province"]:"") ."";
$Shipping_Parameters["ShiptoZip"] = "".((isset($_POST["shipping_postcode"]))?$_POST["shipping_postcode"]:"") ."";
$Shipping_Parameters["ShiptoCountry"] = "".((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:"") ."";
$Shipping_Parameters["UserID"] = "xxxxxxxxx";
$Shipping_Parameters["Password"] = "xxxxxxxx";
$Shipping_Parameters["AccessKey"] = "xxxxxxxxxxxxxxxx";
$Shipping_Parameters["CarrierCode"] = "03";
$Shipping_Parameters["PickupType"] = "01";
$Shipping_Parameters["CustomerClass"] = "none";
$Shipping_Parameters["ShipperNumber"] = "";
$Shipping_Parameters["ShipperCity"] = "xxxxxx";
$Shipping_Parameters["ShipperState"] = "WA";
$Shipping_Parameters["ShipperZip"] = "xxxxxx";
$Shipping_Parameters["ShipperCountry"] = "US";
while (($Shipping_Packaging == 1 && !$eCart1->EOF()) || ($Shipping_Packaging == 0 && $Shipping_Counter == 0)) {
if (WA_eCart_UPS_IsTrueValue("true")) {
$Shipping_PackageArray[] = array();
$Shipping_PackageIndex = sizeof($Shipping_PackageArray)-1;
$Shipping_PackageArray[$Shipping_PackageIndex]["eCart_Quantity"] = (($Shipping_Packaging == 1)?$eCart1->DisplayInfo("Quantity"):1);
$Shipping_PackageArray[$Shipping_PackageIndex]["IsPackage"] = "true";
$Shipping_PackageArray[$Shipping_PackageIndex]["Quantity"] = "1";
$Shipping_PackageArray[$Shipping_PackageIndex]["WeightUnits"] = "LBS";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageWeight"] = "1";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageType"] = "03";
$Shipping_PackageArray[$Shipping_PackageIndex]["SizeUnits"] = "IN";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageLength"] = "6";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageWidth"] = "6";
$Shipping_PackageArray[$Shipping_PackageIndex]["PackageHeight"] = "14";
//Special Services
}
$Shipping_Counter++;
if ($Shipping_Packaging == 1) $eCart1->MoveNext();
}
if ($Shipping_Packaging == 1) $eCart1->MoveFirst();
$Shipping_Result = WA_eCart_UPS_GetRateQuote($eCart1, $Shipping_Parameters, $Shipping_PackageArray);
if ($Shipping_Result && $Shipping_SuccessURL != "")
$eCart1->redirStr = $Shipping_SuccessURL;
else if (!$Shipping_Result && $Shipping_FailureURL != "")
Header("Location: " . $Shipping_FailureURL);
}
else if (!isset($_SESSION["eCart1_UPS_Success"])) {
WA_eCart_UPS_SetSessionDefaults($eCart1);
}
?>
<?php
if ($eCart1->IsEmpty()) {
$eCart1->redirStr = "cart.php";
$eCart1->cartAction = "RedirectIfEmpty";
}
?><?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>
<?php
require_once("WA_eCart/checkoutScripts/WA_simlib.php");
?>