Results 1 to 10 of 10

Thread: How to do shipping calculations

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    49

    How to do shipping calculations

    Hi everyone,

    This is my first post here so hopefully I do ok!

    I am trying to add shipping to my php/mysql site and was hoping someone could suggest some advice.

    Its not an american site so it doesn't need to link into american tracking companies.... which is what most examples I found did.

    Now I'm not sure what the best way to do it is, but we were thinking rather then weight we would assign a value for size.

    E.g. small items that can fit in a small bag, would have a shipping value of 1.

    Then at the end of the cart process, when the customer was ready to check out it would determine the total shipping cost.

    For example, the first threshold for a small bag would be <= 5, so if 5 small items had been added to the cart the total shipping would be $6 for a small bag.

    Medium items could have a value of 6, with a threshold of <= 13 (allowing two medium items, or 1 medium items and a number of small items to fit).

    Now these values can of course change but its currently what we are thinking about using.

    Then I need to calculate this. I am thinking of doing it when they view the cart, by adding the shipping values to each other during the while loop to display the items.

    I am a little bit unsure of how to calculate a running total. I guess I would have the first items shipping value, assign it as the total, then add the next shipping value to the total?

    I have had some tries of:

    $tempshipping = $shipping;
    $subtotalshipping = $tempshipping + $shipping;

    but this of course is not right!.... do I need an array?

    Need to somehow have the first value, then add the next values in the while loop...

    Please let me know if you want to see any code, at the moment there isn't much besides the while loop to show the product details.

    I have the shipping value in the product table, and want to add the total shipping once found to the orderitem table.

    Thanks for any advice!
    Last edited by buffy; Jan 8th, 2009 at 07:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width