Applying different postage for different types of product?

Thread began 8/05/2011 5:18 am by Nathon Jones Web Design | Last modified 10/11/2011 3:40 pm by Jason Byrnes | 1783 views | 16 replies |

8/05/2011 5:18 am  |  #1 Nathon Jones Web Design

Applying different postage for different types of product?

Hi. We have a cart set up specifically for one type of product and our postage is calculated by sub-total.

The client wants to add a totally different type of product, with different postage charges for that product, and we can foresee problems because our current postage is based on the sub-total.

What's the best approach to resolve this? Categorise products and then calculate postage based on whether a product in a particular category exists in the cart?

We're trying to avoid problems arising when a customer has both types of product in their cart.

Would appreciate any advice that can be offered. Thanks.

Nath.

8/05/2011 10:31 am  |  #2 Jason ByrnesWebAssist

there are a few ways this could be done, the best way depends on how you want it to work.

you could create a shipping cost column and add amount for shipping that product, the shipping would then be the subtotal of shipping cost column

or you could add a category column and create a shipping rule for each category where the subtotal is multiplied by the shipping percentage for that category.

8/05/2011 10:44 am  |  #3 Nathon Jones Web Design

The current products are plants and postage is calculated on the sub-total of the cart, as follows:

For spend up to £10.00 - Postage and packing £7.00
For spend up to £50.00 - Postage and packing £13.00
etc

I don't think your suggestion of a shipping cost column would, therefore, work because the postage isn't calculated on a 'per product' basis.

The other products are stationery (notebooks, calendars, cards etc) and my client has come up with a completely seperate postage scale for those, as follows:

For spend up to £16.00 - Postage and packing £5.50
For spend up to £32.00 - Postage and packing £7.50
etc

At the moment, problems will arise because the cart has no way of distinguishing if a product in the cart is a plant or stationery.

I, therefore, think creating a product category field, in our product database, would be the best way to go but I'm confused by your "subtotal is multiplied by the shipping percentage" suggestion.

Can you clarify?

Really appreciate the help, as ever. Thank you.
Nath.

8/09/2011 6:45 am  |  #4 Nathon Jones Web Design

Any update on this? Just a little confused by "sub-total is multiplied by the shipping percentage".

Thank you.
Nath.

8/09/2011 11:20 am  |  #5 Jason ByrnesWebAssist

but I'm confused by your "subtotal is multiplied by the shipping percentage" suggestion

well, that was a suggestion made when i did not have specific details on how you wanted the shipping to work, i had no way oif knowing that you where using a flat rate shipping fee. the details you provided in your response would have been very helpful in your initial post. It would saved us both from confusion.

anyway: yes, the product category approach will be the best one for your needs.

in the add to cart button for plants, set the category to "plants", in the add to cart behavior for stationary, set the category to "stationary"

you will need to create a shipping rule for each price break / category combination. the shipping rules will use a custom trigger.

here are examples of how to create the 4 examples you have provided (Note: these examples assume that the category column is named "category" and the values you are storing in the category column are "plants" and "stationary". remeber, PHP is case sensitive.) :

Name: plants up to 10

Triggers:
Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "plants") < 10`

Calculation:
Flat Rate: 7

Name: plants 10 - 15

Triggers:
Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "plants") >= 10`

Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "plants") < 15`

Calculation:
Flat Rate: 13

Name: stationary to 16

Triggers:
Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "stationary") < 16`

Calculation:
Flat Rate: 5.50

Name: stationary 16 - 32

Triggers:
Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "stationary") >= 16`

Custom condition:

`\$this->ConditionalTotal("TotalPrice", "category", "stationary") < 32`

Calculation:
Flat Rate: 7.50

8/09/2011 12:30 pm  |  #6 Nathon Jones Web Design

Originally Said By: Jason Byrnes
well, that was a suggestion made when i did not have specific details on how you wanted the shipping to work, i had no way oif knowing that you where using a flat rate shipping fee. the details you provided in your response would have been very helpful in your initial post. It would saved us both from confusion.

As we say in Scotland, Jason, "that is me telt". My apologies for the lack of information.

I feel that it will only infuriate you more to learn that I'm using Classic ASP!

Once I have worked out how to convert those conditional statements into ASP, where would I place them?

Thank you.
Nath.

8/09/2011 1:06 pm  |  #7 Jason ByrnesWebAssist

hopefully it's ASP VB script

In asp vb script the example of code to use would be:
WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "plants") < 10

where yourCartName is the name of your cart object.

you will use this code in the shipping tab of the eCart object.

for the trigger, select the Custom Condition evaluates to true options, and use this code for the custom condition.

8/26/2011 8:27 am  |  #8 Nathon Jones Web Design

Yes, it's ASP VB Script.

Is it possible to have an existing postage charge rule ignore certain products if they're in the cart? For example, if a particular product is in the cart we'd like it to be excluded from the postage calculation which is based on the cart sub-total. Hmm...even describing it out loud like that makes it sound impossible.

We're having a real nightmare trying to implement these two different postage scales, mainly because we don't quite understand how to, and certainly aren't confident about how to, implement the custom shipping rules and how to trigger them.

Would appreciate any advice you could offer.
Thank you.
Nath.

8/26/2011 11:06 am  |  #9 Jason ByrnesWebAssist

no cant exclude on a product by product basis.

the idea is to create a category column in your cart.

in the add to cart button, set the value of the category to be "plants" for items that should be charged based on the plants postage scheme and "stationary" for items that should be based on the postage scheme.

if you have items that not be charged any postage, then leave the category for those items blank.

then configure the rules as such (where yourCartName is the name of your eCart object:
Name: plants up to 10

Triggers:
Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "plants") < 10`

Calculation:
Flat Rate: 7

Name: plants 10 - 15

Triggers:
Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "plants") >= 10`

Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "plants") < 15`

Calculation:
Flat Rate: 13

Name: stationary to 16

Triggers:
Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "stationary")< 16`

Calculation:
Flat Rate: 5.50

Name: stationary 16 - 32

Triggers:
Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "stationary") >= 16`

Custom condition:

`WA_eCart_ConditionalTotal(yourCartName, "TotalPrice", "category", "stationary") < 32`

Calculation:
Flat Rate: 7.50

10/09/2011 1:15 pm  |  #10 Nathon Jones Web Design

not distinguishing between the two

Hi Jason,

Instead of "Plants" and "Stationery", I've set the category to be numerical - 1 for plants, 2 for stationery.

I've added the first of those two custom conditions, one for the plant category (with a flat rate charge of £7.00):
WA_eCart_ConditionalTotal(PPcart, "TotalPrice", "Category", "1") < 10.01

...and one for the stationery category (with a flat rate charge of £5.50):
WA_eCart_ConditionalTotal(PPcart, "TotalPrice", "Category", "2") < 16.01

However, if I only have 1 product in my basket, let's say a plant, the cart is applying a £12.50 postage charge. In other words, it's charging both postage rates even though there's only one product in the basket and that product can only be from one category.

Also, we can have an empty cart, but the grand total is showing as £12.50 (the two postage charges). It seems that the postage charges are being applied regardless of whether anything is actually in the cart which makes me suspect that the custom condition is incorrect.

Hope you can help. Thanks.
Nath.

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