Inherited (?) shipping rules
Using CS3/PS2/eCart5/PHP: I have 4 categories, all with flat rate shipping.
CategoryID 1 : rules works fine
CategoryID 2 : this is the problem child!
CategoryID 3 : not live
CategoryID 4 : rules works fine
CategoryID 2 is parts. PartsShipping should be flat rate $9.50/box. Each box = 1 to 4 parts/box. Carrying on from: showthread.php?t=507, I created a column (PartsShipping) and added a calculation PartsShipping=abs([CategoryID] == 2) * [Quantity]. That didn't work, so I went to what you see below. PartsShipping is now $9.50 no matter what the quantity. For testing, I changed the amount to $5.00, but the grand total still calculated $9.50. So I removed (deleted) the rule and the PartsShipping column all together, and parts still showed up in the cart at $9.50. I can't see where the $9.50 is coming from?
Calculations column:
//start node
function ResetCalculations($itmObj) {
$itmObj->TotalWeight = $itmObj->Weight * $itmObj->Quantity;//w
$itmObj->TotalPrice = $itmObj->Price * $itmObj->Quantity;//c
$itmObj->FullDetails = $itmObj->Quantity . ' ' . $itmObj->Name . ' (' . $itmObj->ID . ')';//t
$itmObj->PaperShipping = abs($itmObj->CategoryID == 4) * $itmObj->Quantity;//n
$itmObj->TargetShipping = abs($itmObj->CategoryID == 1) * $itmObj->Quantity;//n
$itmObj->PartsShipping = abs($itmObj->CategoryID == 2) * $itmObj->Quantity;//n
return $itmObj;
}
//end node
Shipping column:
//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("SportsmanShipping"), true, "WAEC_WA_Store_Cart_SportsmanShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("ProShipping"), true, "WAEC_WA_Store_Cart_ProShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("QualifierShipping"), true, "WAEC_WA_Store_Cart_QualifierShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("TacticalShipping"), true, "WAEC_WA_Store_Cart_FlatRate_Tactical");
$this->Shipping[] = new WA_eCart_Rule(urldecode("UPS%20Shipping"), false, "WAEC_WA_Store_Cart_UPSShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Paper30"), true, "WAEC_WA_Store_Cart_Paper30");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Paper20"), true, "WAEC_WA_Store_Cart_Paper20");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Paper10"), true, "WAEC_WA_Store_Cart_Paper2");
$this->Shipping[] = new WA_eCart_Rule(urldecode("FreePaper"), true, "WAEC_WA_Store_Cart_FreePaper");
$this->Shipping[] = new WA_eCart_Rule(urldecode("PartsShipping"), true, "WAEC_WA_Store_Cart_PartsShipping");
}
//end node
The rules:
//eCart Rule
function WAEC_WA_Store_Cart_SportsmanShipping() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "ID", "1") > 0))) {
$totalShipping += ($this->ConditionalTotal("Quantity", "ID", "1") * 17.50);//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_ProShipping() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "ID", "2") > 0))) {
$totalShipping += ($this->ConditionalTotal("Quantity", "ID", "2") * 21.50);//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_QualifierShipping() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "ID", "3") > 0))) {
$totalShipping += ($this->ConditionalTotal("Quantity", "ID", "3") * 25.50);//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_FlatRate_Tactical() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "ID", "4") > 0))) {
$totalShipping += ($this->ConditionalTotal("Quantity", "ID", "4") * 29.50);//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_UPSShipping() {
$totalShipping = 0;
if (false && (("UPS"=="UPS")&&(isset($_SESSION["WA_Store_Cart_UPS_Quote"]))&&(floatval($_SESSION["WA_Store_Cart_UPS_Quote"]) != 0))) {
$totalShipping += floatval($_SESSION["WA_Store_Cart_UPS_Quote"]) + 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_Paper30() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "CategoryID", "4") > 20) && ($this->ConditionalTotal("Quantity", "CategoryID", "4") <= 30) && ($this->ConditionalTotal("Quantity", "CategoryID", "1") == 0))) {
$totalShipping += 28.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_Paper20() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "CategoryID", "4") > 10) && ($this->ConditionalTotal("Quantity", "CategoryID", "4") <= 20) && ($this->ConditionalTotal("Quantity", "CategoryID", "1") == 0))) {
$totalShipping += 19.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_Paper2() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "CategoryID", "4") <= 10) && ($this->ConditionalTotal("Quantity", "CategoryID", "1") == 0))) {
$totalShipping += 9.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_FreePaper() {
$totalShipping = 0;
if (true && (($this->InCart("TargetShipping") == true) && ($this->TotalColumn("PaperShipping") <= 10))) {
$totalShipping += ($this->TotalColumn("PaperShipping") * 0);//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_PartsShipping() {
$totalShipping = 0;
if (true && (($this->InCart("PartsShipping") == true) && ($this->TotalColumn("PartsShipping") > 0) && ($this->TotalColumn("PartsShipping") <= 4))) {
$totalShipping += 5.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
Thanks...