How to prevent a

Discussion in 'PHP' started by 123GoToAndPlay, Jan 11, 2010.

  1. #1
    Hi there,

    I am developing a webshop and now i need to block foreign shipping addresses.

    What would be the best way to do this???

    I was thinking about a dropdown box and when the user select a country != my_country all form input fields would be disabled.
    Any other thoughts?
     
    123GoToAndPlay, Jan 11, 2010 IP
  2. cocodude

    cocodude Active Member

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Don't just disable the other fields, but report a message to the user (either as a message box or on the web page itself) saying that you only ship to people in country X.

    I think your idea to base it on the dropdown box value (presumably using Javascript) is a good one as the user should know as early as possible in the ordering process that you will not ship to him.

    I would additionally ensure that this dropdown box is one of the first on the page so the user doesn't waste time entering address lines etc. before finding out he can't progress with the order.
     
    cocodude, Jan 11, 2010 IP
  3. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Better still put an information box on the site either in the order process or globally that says "Shipping to country name only"
     
    JAY6390, Jan 11, 2010 IP
  4. itdmacar

    itdmacar Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I agree, better let your client know first as Jay6390 says a little information will warned them right away . . .
     
    itdmacar, Jan 11, 2010 IP
  5. einsteinsboi

    einsteinsboi Well-Known Member

    Messages:
    1,122
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    140
    #5
    You could also write a script to detect region by IP address and immediately have a large message stating we do not ship outside of x country. That way the user can still browse the site but they know beforehand that you won't ship to their country.
    This is better than letting them get all the way to the shopping cart only to find they can't buy the product.
     
    einsteinsboi, Jan 11, 2010 IP
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That is a very good idea (and for reference to the OP it's known as Geo IP). There are a few classes out there that are pre-built to see this and also a few packages that you can use (I think there's a couple in the PEAR distribution anyway)
     
    JAY6390, Jan 11, 2010 IP
  7. einsteinsboi

    einsteinsboi Well-Known Member

    Messages:
    1,122
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    140
    #7
    einsteinsboi, Jan 11, 2010 IP
  8. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #8
    haha no worries we all get them :D
     
    JAY6390, Jan 11, 2010 IP