# Shipping based on area and quantity

Thread began 6/08/2015 1:53 pm by ZP | Last modified 6/08/2015 4:42 pm by Ray Borduin | 576 views | 5 replies |

## 6/08/2015 1:53 pm  |  #1 ZP

### Shipping based on area and quantity

Hello,

I am trying to do a calculation in Cart 6.1 in relation to a shipping.

I have a attached a freight pricing sheet based on the following.

1. The freight is charge per ever 5 boxes and or items.

Example

Freight per one 1-5 items is the same
Example
up to 10 boxes (items) = \$6.83
up to 10 boxes (items) = \$13.65
up to 20 boxes (items) = \$20.48

I have a freight in the database that reflect the charge as user_states which has all the charges in it.

as "charge1, charge2, charge3 charge4" etc.

How can I get the cart to reflect this freight price?

## 6/08/2015 4:04 pm  |  #2 Ray BorduinWebAssist

If you wanted to do it from the database, then you would add a recordset to the cart page and have it filter based on the value of \$eCart1->TotalColumn("Quantity"). Once the recordset returns the correct charge, then you can store that as a session variable and use the Shipping tab in the eCart object to add a shipping charge equal to the value stored as that session variable.

Perhaps an easier way to do it is to not use the database and add the rows as individual shipping rules. You would add one shipping rule per price and set them "based on the number of items in the cart" with the flat rate charge based on your spreadsheet.

## 6/08/2015 4:11 pm  |  #3 ZP

There is a session variable set upon login "ship_state" which has a dollar value.

If I could help with adding some code to this line please:

//eCart Rule
function WAEC_eCart1_BigChill() {
\$totalShipping = 0;
if (true && ((sizeof(\$this->Items) > 0))) {
\$totalShipping += (floatval(\$this->GetInfo("5", "Quantity")) + 0.00);//Result
}
return WA_eCart_FormatNumber(\$totalShipping, \$this->ForceDecimalsC, \$this->DecimalPlacesC);
}
//eCart Rule
//end node

## 6/08/2015 4:14 pm  |  #4 Ray BorduinWebAssist

Don't edit the code directly. Use the eCart object to edit the code. If you start hand editing, then you won't be able to use our interfaces to make further edits in the future.

That code is controlled by the Shipping tab in the eCart object. Edit it from that interface.

## 6/08/2015 4:20 pm  |  #5 ZP

Yes I realise that I must use the interface.

I was wondering if you could please assist with the correct formula?

Thanks

## 6/08/2015 4:42 pm  |  #6 Ray BorduinWebAssist

Just set it to charge "if session variable exists"

and set the charge amount the the session variable value like: \$_SESSION['var_name']

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

## Everything else!

Close Window

Account or customer service questions?

Need technical support?

Content

Layout

Ease of use

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 Window

## We were unable to retrieve the attached file

Close Window

### Attach and remove files

• Text Formatting
• Insert Element
• Block Formatting
• Cancel
Close Window

Close Window

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