Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with option

    im trying to add ifs to a shopping cart. basically what i want is if a certain option is picked then i want it to be able to show or not show another option.

    say i have 25 colors and they are available in 10 different sizes but only 10 colors are available in the last five of those sizes.

    example i have:
    if (product_option('Cover').selectedIndex == 1)
    { alert('You have chosen Hard cover for this product'); return true; }

    how do you say:
    if product_option'whatcolor' then show sizes 1-10
    if product_option'othercolor' then hide sizes 5-10

    can anyone help me with this?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need the if-else control structures:
    http://www.php.net/manual/en/control...-structures.if
    http://www.php.net/manual/en/control...tures.else.php

    and the section on logical operators too
    http://www.php.net/manual/en/languag...comparison.php

    and then it's done in an instant.


  •  

    Posting Permissions

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