close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple shipping costs not working properly

Thread began 10/26/2020 1:35 am by info4753 | Last modified 10/27/2020 7:06 am by Ray Borduin | 206 views | 2 replies |

info4753

Multiple shipping costs not working properly

On https://www.ilgrappolo.ch/de/shop/weine/index.php

I've added the following rules for calculationg the shipping costs (Lieferkosten):

1-8 total items AND grand total < 800 -> Flat rate 12
9-12 total items AND grand total < 800 -> Flat rate 17
13-24 total items AND grand total < 800 -> Flat rate 34
25-36 total items AND grand total < 800 -> Flat rate 148
>37 total items OR grand total >= 800 -> Flat rate 0


//start node
function DefineRules() {
$this->Discounts = array();
$this->Charges = array();
$this->Tax = array();
$this->Shipping = array();
$this->ShippingIsTaxed = false;
//Discounts
//Charges
//Tax
//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("1-8%20Flaschen"), true, "WAEC_eCart_ilGrappolo_18Flaschen");
$this->Shipping[] = new WA_eCart_Rule(urldecode("9-12%20Flaschen"), true, "WAEC_eCart_ilGrappolo_912Flaschen");
$this->Shipping[] = new WA_eCart_Rule(urldecode("13-14%20Flaschen"), true, "WAEC_eCart_ilGrappolo_1314Flaschen");
$this->Shipping[] = new WA_eCart_Rule(urldecode("25-36%20Flaschen"), true, "WAEC_eCart_ilGrappolo_2536Flaschen");
$this->Shipping[] = new WA_eCart_Rule(urldecode("ab%2037%20Flaschen"), true, "WAEC_eCart_ilGrappolo_ab37Flaschen");
}
//end node
//start node
//eCart Rule
function WAEC_eCart_ilGrappolo_18Flaschen() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) <= 8) && ($this->TotalColumn("TotalPrice") < 800))) {
$totalShipping += floatVal("12");//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart_ilGrappolo_912Flaschen() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 8) && (sizeof($this->Items) <= 12) && ($this->TotalColumn("TotalPrice") < 800))) {
$totalShipping += floatVal("17");//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart_ilGrappolo_1314Flaschen() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 12) && (sizeof($this->Items) <= 24) && ($this->TotalColumn("TotalPrice") < 800))) {
$totalShipping += floatVal("34");//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart_ilGrappolo_2536Flaschen() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 24) && (sizeof($this->Items) <= 36) && ($this->TotalColumn("TotalPrice") < 800))) {
$totalShipping += floatVal("48");//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart_ilGrappolo_ab37Flaschen() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 36) || ($this->TotalColumn("TotalPrice") >= 800))) {
$totalShipping += floatVal("0");//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//end node

It looks like only the first rule works or if the grand total is bigger the 800. What am I doing wrong? Thanks for any help

Sign in to reply to this post

Ray BorduinWebAssist

I think instead of "number of items in the cart" you want to use subtotal of cart column "quantity".

Your current rule is based on the number of rows in the shopping cart, not the number of items purchased based on quantities.

Sign in to reply to this post
Did this help? Tips are appreciated...

info4753

Thanks Ray, works now :-)

Sign in to reply to this post

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