# How to add additional costs to a product and add it as a sum charge in the cart

Thread began 9/02/2013 5:21 am by info4753 | Last modified 9/17/2013 9:45 am by Jason Byrnes | 2210 views | 10 replies |

## 9/02/2013 5:21 am  |  #1 info4753

### How to add additional costs to a product and add it as a sum charge in the cart

I've got shop that sells different kinds of bottles (wine, whisky, vodka,etc). Some of the bottle have a recycling fee. The amount of the fee differs from product to product.

What I need to achive is adding the recyling fee multiplied with the amount of each of the products added to the cart. All the recycling fees of all products should be shown as a sum in a charge row in the cart (just like a shipping tax):

product1 5x 5 cents
product2 3x 10 cents
product1 8x 0 cents
...
recyling tax: 55 cents
...

I can't find a way to achieve this. Can anyone please give me a hint how to solve this problem?

## 9/03/2013 7:25 am  |  #2 Jason ByrnesWebAssist

create a new cart column to hold the recycle fee. for the sake of example, call the column "RecycleFee"

then in the cart object, add a new calculation as:
Name: RecycleTotal
[RecycleFee] * [Quantity]

On the charges tab, add a new charge.

set the trigger to Total number of items in cart greater than 0

for the calculation use:
"Based on column Subtotal"
Subtotal of Column "RecycleTotal" "Plus" "0"

## 9/08/2013 11:41 pm  |  #3 info4753

Works perfectly. Thanks Jason!

## 9/16/2013 9:00 am  |  #4 Nathon Jones Web Design

### RecycleTotal not appearing in sub-total of column drop-down?

ASP / VBScript / DW8 / eCart 4.5.2

We are looking for a similar solution but for a flat rate gift wrap option for products. We've copied the example above, as it sounded exactly like what we're after, but RecycleTotal isn't appearing in the sub-total of column drop-down menu?

Including the GiftWrapFee cart column we've created we have 8 other custom columns - is there a limit? If so, might this be causing the problem?

Are we approaching this correctly? There is a flat fee of £3.95, per item, for gift wrapping so we were trying to add the checkbox as a currency value but were having problems with it when users don't select gift wrapping and, therefore, no numerical value was being applied.

Would appreciate some guidance on how best to add a gift wrap option.
Thank you.
NJ

## 9/16/2013 9:51 am  |  #5 Jason ByrnesWebAssist

This is no limit to the number of cart columns you can add.

You should have a cart column named giftwrap, set the checked value for this column to 1

on the charges tab, create a new charge as:

Trigger:
"Number Of Items With A Specific Column Value"
If the Total Number of items where "giftwrap" has a value of "1" is ">" a value of "0"

calculation:
"Based on items with a specific value"
Total of "Quantity" where "giftwrap" has a value of "1" "times" "3.95"

## 9/16/2013 2:13 pm  |  #6 Nathon Jones Web Design

Hi Jason,

Thank you for getting back in touch on this.
We're getting as far as this...

Originally Said By: Jason Byrnes
calculation:
"Based on items with a specific value"
Total of "Quantity" where "giftwrap" has a value of "1" "times" "3.95"

...but there is no "giftwrap" in the drop down menu at the "Total of "Quantity" where "giftwrap" has a value of "1" "times" "3.95".
Our other 8 custom columns are in the drop-down though.

Delete WinFileCache (or whatever it's called! :o) ) and try again?

Thank you.
NJ

## 9/16/2013 2:16 pm  |  #7 Jason ByrnesWebAssist

You need to add a column named giftwrap on the columns section.

in the add to cart buttons, make that column editable as a checkbox.

set the checked value to 1.

then you will be able to make the Charges rule work.

## 9/17/2013 1:01 am  |  #8 Nathon Jones Web Design

### no checkbox option?

Hi Jason. Something must have gone astray in our thinking / operating here...

We added a new column called "AddGiftWrap" in the eCart Object columns section. We selected type "number" for this as nothing else seemed appropriate.

In the Add to Cart behaviour, in the Bindings section, our new column AddGiftWrap is there but the only "Updateable" options are "hidden field", "text field" and "select list". There is no option for checkbox. :o(

So...we proceeded with adding it as an updateable text field and then we manually changed it to a checkbox...

This, as you suggested, allows us to create the Charges rule but now, when we click the Add to Cart button we get this error, similar to an error we were previously getting:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'cDbl'
/babyfish2013/WA_eCart/BFcart_VB.asp, line 34

Line 34 is:

We believe that when the checkbox isn't checked (when a customer doesn't require gift wrapping) then no value is being passed and, therefore, we are thrown the type mismatch error because it is looking for a numerical value.

Perhaps you can see a glaring error in all of this? Really appreciate your help. Thank you.
NJ

## 9/17/2013 8:33 am  |  #9 Jason ByrnesWebAssist

Instead of using the Number data type, use text.

In actual fact, it doesn't matter if the checked value is "Y" or "1" or anything else.

The calculation rule wont necessarily treat it as a number, it is just used as a flag, so the data type is not really important. By using text for the data type it will allow for a blank valuer (when giftware is not needed).

## 9/17/2013 9:43 am  |  #10 Nathon Jones Web Design

### checkbox still not available?

I have recreated a column called AddGiftWrap in the eCart Object and have selected "text" as its data type.
When we go back into the Add to Cart behaviour though there is still no option for a checkbox; just "hidden field", "text field" and "select list".

Whichever one I choose it doesn't add a checkbox to the page it adds either a hidden field, a text field or a select list. Was I right in assuming that I'd need to manually change this to a checkbox?

I feel like I'm not grasping this at all. Hope you can help.
Thank you.
NJ

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