Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder sonny's Avatar
    Join Date
    Apr 2008
    United States
    Thanked 0 Times in 0 Posts

    Best way to implenment cart options

    Hi I'm trying to code a simple lightweight and safe cart, mostly complete, but
    I am having a problem deciding on the best way to implement a option
    when needed like color, weight etc. there's no admin of course I'll' just add
    a product directly into the table or write a simple one later if ever needed.

    I will be using a lot of the same type drop down options over and over,
    should I create a options table or use a function instead. like select
    radio etc and just call that when needed feeding array values or something.

    Just wondering how some of you guys might implement something like this
    although I'm not great at this stuff I never thought the option part would
    be the thing that stumped me.


  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Toronto, Ontario
    Thanked 122 Times in 122 Posts
    I find that the simplest way is just to add a fields to the product table, and uyse comma delimited options.

    for example: Color "Red,White,Blue"
    in your code, just Explode() the value by comma into a SELECT dropdown menu.

    then gather your options, put them into one string and insert them into an options field in your shopping cart table or session.


    Posting Permissions

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