#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    98
    Rep Power
    2

    PHP Sessions and javascript popup


    I have $_SESSION['serviceSelected'] set when somebody has already selected a shipping service and agreement for their shopping cart items. However, after the agree to the shipping I don't want them to leave the cart and add another item, as it will retain the same shipping cost for just the one item, even though it's 2+ now.

    I've got a PHP conditional to check if this occurred, and it works. If a user adds another item to cart while that session is set, it will remove the new item.

    I want a javascript popup to show when they click add to cart after already accepting the shipping cost, that says like "You've already accepted shipping for your cart, to make changes select "Edit Shipment Details".. How is this possible? I'm new to javascript, not to php
    -- Success achieved from tribulation --
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    Umm... Whoa! Hold on.

    You're automatically removing a new item from the shopping cart because you've already shown the customer how much shipping would be for the other items? That sounds user-hostile to me. Wouldn't most customers understand that when they add another item that shipping costs are likely to increase? Why not just tell them what the new shipping cost is or ask them to choose a shipping option again?

    This is definitely one area where it's good to follow conventions. Do what the customer expects and things will work much more smoothly.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    98
    Rep Power
    2
    Thanks. I've been under a crunch.

    Originally Posted by Kravvitz
    Umm... Whoa! Hold on.

    You're automatically removing a new item from the shopping cart because you've already shown the customer how much shipping would be for the other items? That sounds user-hostile to me. Wouldn't most customers understand that when they add another item that shipping costs are likely to increase? Why not just tell them what the new shipping cost is or ask them to choose a shipping option again?

    This is definitely one area where it's good to follow conventions. Do what the customer expects and things will work much more smoothly.
    -- Success achieved from tribulation --
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    98
    Rep Power
    2
    OK all better. If the user selects a shipping service before checkout and adds another item, it simply re-displays the shipping service select menu. Subtle and not too aggravating. I need the user to agree to the shipping cost and prices via a checkbox and submit button every time he is ready to checkout. If he never selects a shipping service and price to agree to before he's done shopping, it wouldn't be a problem, but you know how some people like to find loopholes...
    Last edited by BitZoid; April 9th, 2013 at 06:01 PM.
    -- Success achieved from tribulation --
  8. #5
  9. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    You're welcome. Yes, "foolproofing" is important.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo