# Shipping based on column value

Thread began 12/14/2013 4:06 pm by bill173836 | Last modified 12/16/2013 5:15 pm by Jason Byrnes | 1441 views | 7 replies |

## 12/14/2013 4:06 pm  |  #1 bill173836

### Shipping based on column value

I have a store that only ships priority mail. The price is determined by which flat rate box is used. Each product table has a database field called shipping and in it I put the price of the box used. I want to use the shipping column in the product table to base my shipping on.

Example:
Item 1000 uses the small flat rate box which is \$5.80
Item 1001 uses the medium flat rate box which is \$12.35
My patron buys 2 Item 1000s and 1 Item 1001 so the total shipping should be \$23.95

I also want to set the max shipping price to \$50 so no matter now many they buy they never pay over \$50 total

How would I set up this rule?

## 12/16/2013 11:25 am  |  #2 Jason ByrnesWebAssist

since you already have a column that is storing the shipping rate, this is fairly strait forward:

on the calculation tab, create a totalShipping calcualtion similar to the totalPrice calcualtion, but use the shippping column:

[ShippingRate] * [Quantity]

this example uses a column named ShippingRate, if you use a different name, adjust the code accordingly

Then create the shipping rule as:
triggers:
"Subtotal for any column"
if the subtotal for column "totalShipping" is ">" a value of "0"

AND
"Subtotal for any column"
if the subtotal for column "totalShipping" is "<" a value of "50"

calculation:
"Based on Multiple of Column subtotal"
subtotal of column "totalShipping" times "1" "plus" "0"

## 12/16/2013 4:09 pm  |  #3 bill173836

I guess I need to cross one bridge at a time. I followed the instructions for the first rule and tested and I just got error messages. Just so I'm clear here is what I have and what I need for the first part.
My Products database is pretty basic productid, productname, productprice, etc and I added a field called shipping. Each product will have it's shipping determined by that product database field.

Example:
Product1 cost \$5 to ship
Product2 cost \$10 to ship
A client buys 2 Product1 and 1 Product2

On checkout the calculation is:

Total shipping would be (\$5+\$5)+(\$10)=\$20

## 12/16/2013 4:11 pm  |  #4 Jason ByrnesWebAssist

I followed the instructions for the first rule and tested and I just got error messages.

what where the errors

i understand how you want the shipping to calculate, the above instructions will accomplish that.

## 12/16/2013 4:31 pm  |  #5 bill173836

Error: Parse error: syntax error, unexpected '[' in /home/content/06/7238106/html/loungedoctorlegrest/WA_eCart/siteCart_PHP.php on line 14
Line 14: \$itmObj->totalShipping = [ProductShipping] * \$itmObj->Quantity;//n

The database field name is ProductShipping

## 12/16/2013 4:43 pm  |  #6 Jason ByrnesWebAssist

but what is the name of the column in the cart object?

the cart object name for that column is what should be used in the calculation.

## 12/16/2013 5:03 pm  |  #7 bill173836

The database field is ProductShipping and the Column is Shipping

I tried to do it again and got rid of the message but now it doesn't show anything.

You can see the store at http://www.loungedoctorlegrest.com/products-detail.php?ProductID=1000

Here are the 2 files.

Attached Files
eCart.zip

## 12/16/2013 5:15 pm  |  #8 Jason ByrnesWebAssist

in the add to cart buttons behaviors, make sure the shipping column is bound to the ProductShipping column of the recordset

also, the shipping rule is not defined as I described earlier. th shipping rule should be set up as:

triggers:
"Subtotal for any column"
if the subtotal for column "totalShipping" is ">" a value of "0"

AND
"Subtotal for any column"
if the subtotal for column "totalShipping" is "<" a value of "50"

calculation:
"Based on Multiple of Column subtotal"
subtotal of column "totalShipping" times "1" "plus" "0"

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