close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Probably Covered Prevously

Thread began 2/09/2012 12:18 pm by tom92909 | Last modified 2/15/2012 11:33 am by Jason Byrnes | 1565 views | 21 replies |

tom92909Beta Tester

Probably Covered Prevously

Howdy Folks!
I'm sure that this has been covered previously and I'd love to see the original thread (I did try and locate it).

I have a client that sells (2) types of widgets. My client wants to sell them online and wants to apply a flat rate shipping fee to all sales related to the total number or quantity purchased...

Widget 1 Example:

QTY sold = 1 to 5 (flat rate shipping would be $6.95)
for each unit of (5) the rate would be increased by this shipping rate.


Widget 2 Example:

QTY sold = 1 to 5 (flat rate shipping would be $16.95)
for each unit of (5) the rate would be increased by this shipping rate.


How would this be accomplished best?

Sign in to reply to this post

Jason ByrnesWebAssist

add a new column to the cart called shipRate.

in the Add to cart behavior for widget 1, set the shipRate column to 6.95

in the add to cart behavior for widget 2, set the shipRate column to 16.95.

on the calculations tab, create a new calculation called itemShipping as:

((ceil([Quantity] / 5)) * [shipRate])

on the shipping tab, create a new shipping rule, use the trigger:
"Subtotal For Any Column"
if the subtotal of column "itemShipping" is > a value of 0


set the calculation to:
"Based on multiple of column subtotal"
Subtotal of column "itemShipping" "times" "1" "plus" "0"

Sign in to reply to this post

tom92909Beta Tester

Thanks Jason, I'll give that a try. WOW! 26,000 posts. You are the man!

Sign in to reply to this post

tom92909Beta Tester

Jason,

The solution works if customers purchase units of the same Widget, but I failed to provide you with 100% of the details.

Omitted details...

(Widget A) has (3) different flavors w/ a shipRate of $6.95 per/each 5 units.

WidgetA-1
WidgetA-2
WidgetA-3


(Widget B) has (6) different flavors w/ a shipRate of $11.95 per/each 5 units.

WidgetB-1
WidgetB-2
WidgetB-3
WidgetB-4
WidgetB-5
WidgetB-6

So if you add (1) WidgetA-1 and (1)WidgetA-3 to the cart the customer pays double the desired shipping rate. And same is true if you add a WidgetB-1 and a WidgetB-2. The current solution provides a shipping total of $37.80 which is double what it should be. (6.95+6.95+11.95.11.95)

The total for (5) WidgetA-1 and (5) WidgetB-1 is $18.90. (6.95+11.95)
If I change it to (6) WidgetA-1 and (5) WidgetB-1 the shipping total is $25.85. (6.95+6.95+11.95)
I think this is accurate too.

What would you recommend correct this? Thanks again for your continued support.

Tom

Sign in to reply to this post

Jason ByrnesWebAssist

yeah, the devil is in the details...

the problem with this is that calculations are done on a line item basis, so since you have product options it is causing the calculation to trigger on each option, and not the ID.

the work around would be to create a separate shipping rule for each product.

so for widget A which has a product of of 1, create a shipping rule using:

trigger:
"Presence of item in cart"
If item ID "1" "exists" in the cart

calculation:
"Flat Rate"
(ceil($this->GetInfo("1", "Quantity") / 5)) * $this->GetInfo("1", "shipRate")


and for widget 2 which has an ID of 2, create another shipping rule as:
trigger:
"Presence of item in cart"
If item ID "21" "exists" in the cart

calcualtion:
"Flat Rate"
(ceil($this->GetInfo("2", "Quantity") / 5)) * $this->GetInfo("2", "shipRate")

for additional widgets, you would need to create additional shipping rules using the appropriate ID value.

Sign in to reply to this post

tom92909Beta Tester

Hmmm,

I think I'm not quite getting it...

php:
//eCart Rule
function WAEC_eCart1_ShipBook()  {
  $totalShipping = 0;
  if (true && (($this->TotalColumn("itemShipping") > 0) && ($this->InCart("1") == true) && ($this->InCart("2") == true) && ($this->InCart("3") == true))) {
    $totalShipping += (ceil($this->GetInfo("3", "Quantity") / 5)) * $this->GetInfo("3", "shipRate");//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule



Sign in to reply to this post

Jason ByrnesWebAssist

you are using one shipping rule and just adding additional triggers


you need to create a separate shipping rule for each product, each rule will have only one trigger and one calculation using the corresponding ID for that product.

Sign in to reply to this post

tom92909Beta Tester

Good Morning Jason :-)

I created my (11) different shipping rules as you advised. It works well as long as the customer only purchases (1) Item. The issue occurs when the customer adds multiple Items to the cart.

Widget1-a in cart at QTY 2 --- Shipping rate = $6.95.
If Widget1-b is added to the cart with a QTY of 1 the shipping rate is doubled.

Widget1 has (3) flavors. The shipping charges change by $6.95 per/each (5) units of Widget1-X to the cart.

Widget2 has (8) flavors. The shipping charges change by $11.95 per/each (5) units of Widget2-X to the cart.

I can add a field to the products table to indicate groupings. Widget1 = 1, Widget2 = 2
If Widget1 then apply $6.95... If Widget2 then apply $11.95...

I'm just not sure how to make this work.

Thanks in advance for your continued support.

Sign in to reply to this post

Jason ByrnesWebAssist

did you leave the original shipping rule in place? The shipping rule I gave in my first reply should not be used anymore, only the shipping rules for the products.

if you continue to have a problem, send a copy of the eCart object file in the WA_eCart folder.

Sign in to reply to this post

tom92909Beta Tester

Yes. I had removed the original calculation and I created the (11) separate calculations. After reading your last post, I went ahead and killed all of the shipping calculations and created them again from scratch.

I get the same result.

I have attached the eCart object as requested.

Attached Files
eCart1_PHP.zip
Sign in to reply to this post
loading

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