close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Inherited (?) shipping rules

Thread began 7/14/2010 10:35 am by whit368229 | Last modified 7/19/2010 3:37 pm by whit368229 | 1791 views | 5 replies

whit368229

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:

php:
//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:

php:
//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:

php:
//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...

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