43 users online (1 members and 42 guests)  


  Results 1 to 6 of 6

Related

  1. From 2 digits to 3 digits    Forum: HTML Forum
    Replies: 7
  2. Replies: 9
  3. Zone Alarm 3    Forum: Introduce Yourself
    Replies: 0
  1. #1
    knightjt02's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    22

    Question How to make a 3 digits zip codes freight zone in php?

    I m wanting to know if there is any way to set up the freight, buy the first 3 digits of the zip codes, buy using the corect zone area?

    What i mean is in a shopping cart i like to put in a zip code shipping rate by looking up a zip code and seeing what the price is for that zip code zone is.
    See Freight costs are charted by "zones" as a percentage of order size. To determine your Freight charges.

  2. #2
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    Just do a simple check like this:

    if eregi("123", $freight) {

    $money = "3.89";

    }

    What eregi will do is check whether that area code has the numbers "123" in them, but you can look up the function in the PHP documentation at www.php.net/ if you need to cut it to look for just the first 3 numbers of the area code instead of searching the entire area code if just looking for three numbers in the area code won't work or certain area codes will conflict with one another. Being able to look it up yourself is a good skill to have

    ...on second thought you might not know what to look for, so just research the function preg_match() if my above code won't work for you.
    Last edited by Derek; 08-04-2003 at 01:54 PM.

  3. #3
    knightjt02's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    22

    How to make a 3 digits zip codes freight zone in php?

    It was to my understanding, that I have to give them there total price before they check out, so therefore, I do not understand how to get the right price without seeing the zip code first.
    But it is still to my knowledge, that you do not recieve the order, until the customer has already paid for it. And how will they know how much to pay, if I can not put a rate on the site? All areas have different percantage rates, and I am trying to figure out how to put that on my web site, so that it does not send the customers on a man hunt looking for their total cost. For an example-----
    zones 2-8 all have different percantages---
    2---13%
    3--- 15%
    4--- 17%
    and that is only for UPS, but all the others have different percantages. Do you undersand what I am trying to explain?

  4. #4
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    I think so. But what I guess I was assuming what you had was when they're making their purchase... why not just ask them their area code, use the code I gave you, then configure that into the price? Say zone 1 had the area code 98765. Say they ordered something and thus your code would be this:

    <form method=POST action="sale.php">
    Name<input....>
    Whatever<input....>
    Area Code<input type="text" name="areacode">
    Whatever<input....>
    </form>

    if eregi("987", $areacode) {

    $money = "5.00";
    $zone1 = "20%";
    $final_sale = $money * $zone1;

    }

    Then just echo out $final_sale with the correct amount. Am I getting you right? But in your code all the zones ($zone1, $zone 2, etc, and $money) should all be put in an include file and included at the top of the page so you don't have to keep repeating them thus you wouldn't need them in the eregi if statement.

  5. #5
    knightjt02's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    22

    Question How to make a 3 digits zip codes freight zone in php?

    See what i'am looking for is win the person buy something they put it in the shopping cart it take you to the cart view page ok? See in there i like to have a in put for there zip code to show the price for shipping. Is there anyway a code can be set up to do this what am looking for?
    If so what wood i look for fining it on the web for the Script to do this? Do you know how to set it up or to make a script for the person to put in the zip code it look for there zone it put there price for shipping on the form.

  6. #6
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    Ok I've got to go but I'll give one more try and understanding why you're still having a problem. You're going to have to ask for their zip code somewhere, anywhere. You could ask for it before they purchase and then store it with their session, then on the final price page you wouldn't need to ask them anything and their final price would already be inputed. Beyond that I don't see how you couldn't take code similiar to what i put and use it for your needs. But if you don't get it, then Dean... you can take over lol. I gotta go.



Tags for this Thread