Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    I am building y site with dreamweaver and have had a cart from another company. I added drop down options for products that include color and size. The problem is they are not connected to the cart. I have the add to cart button. It adds only the first option not any of the others if selected. I have used dreamweaver and w3schools to help me learn to code but I am still new and want to pull my hair out. How can I get my options to link to the cart when selected from the drop down?

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Depends on a number of things.

    1. What cart are you using and what language is it written in ?
    2. Are the current options pulled from a DB or hardcoeded into the page ?
    3. The named options have to be called in the cart when you submit...

    There are way too many unknowns to even begin making an educated guess, since there are so many ways of doing it.

    Suggest you post your code samples of the " selected options ", and the cart code that is suppose to process and display your selections.

    Might give us an idea of what is happening.

    If you can name the cart, someone here may have first hand knowledge in working with it and customizing it.

  4. #3
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    The cart is called ecommerce templates shopping cart software. I am using them as well as dreamweaver to build my site. All of my pages are html or php. Here is the code for both.
    Cart Button:
    <form method="post" action="cart.php">
    <input type="hidden" name="id" value="CC1001">
    <input type="hidden" name="mode" value="add">
    <input type="image" src="assets/image/cartbutton.jpg" alt="Add to Cart" border="0">
    </form>

    drop down options:
    <select name="options">
    <option>Black (SLF9623)</option>
    <option>Red (SLF9622)</option>
    <option>Blue (SLF9621)</option>
    </select>

    Here is the link to one of the pages I will be using it on.
    http://www.unclestogys.com/hand_tools.html

    I have a site that is up and running but I hate it and doing a redesign.
    Thanks for the help.

  5. #4
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    From what you posted...

    The select options have to be inside the form tags for it to send the selected values to th cart.

  6. #5
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    I am new to this. Can you show me how it should look?

  7. #6
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    HTML is a tagging sequence,

    when you create a form <form> , any items you want to send to any kind of processing must be between the opening tag <form> and the closing tag </form>

    almost every "opening " tag can have extra elements...

    in your case... <form method="post" action="cart.php"> is the opening tag...

    any element you use to send information for processing needs to be between the opening tag and the closing tag of </form>

    you are sending 2 hidden values:

    <input type="hidden" name="id" value="CC1001" />
    <input type="hidden" name="mode" value="add" />

    the select elements that make up the drop down list:

    <select name="options">
    <option>Black (SLF9623)</option>
    <option>Red (SLF9622)</option>
    <option>Blue (SLF9621)</option>
    </select>

    your example uses an image as the submit button " assuming the script is using some command to submmit, but not sure"

    <input type="image" src="assets/image/cartbutton.jpg" alt="Add to Cart" border="0">

    personally I prefer a button:

    <input type="submit" value="Submit" />

    then the closing tag:

    </form>

    http://www.w3schools.com/html/html_forms.asp explains all this in much more detail.

  8. #7
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    So basically it should look like this:
    <form method="post" action="cart.php">
    <input type="hidden" name="id" value="options">
    <select name="options">
    <option>Black (SLF9623)</option>
    <option>Red (SLF9622)</option>
    <option>Blue (SLF9621)</option>
    </select>
    <input type="hidden" name="mode" value="add">
    <input type="image" src="assets/image/cartbutton.jpg" alt="Add to Cart" border="0">
    </form>

    Is that correct?

  9. #8
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    I trying what I wrote above and it didn't work. I am so very frustrated.

  10. #9
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,715
    Member #
    5580
    Liked
    717 times
    Let's just look at one item for now ... the LED flashlight ...

    1) I see two <select> sections ... not sure why there are two.

    2) You have no option values.

    So, try this instead ....

    PHP Code:

    <tr>
        <
    td><img src="assets/image/black_led_flashlight_med.jpg" width="200" height="200" alt="LED Flashlights" /></td>
        <
    td><img src="assets/image/multiknife_med.jpg" width="200" height="200" alt="Pocket Knife" /></td>

      </
    tr>
      <
    tr>
        <
    td><p>LED Flashlight</p>
        <
    p>&nbsp;</p>
        <
    div id="CollapsiblePanel3" class="CollapsiblePanel">
          <
    div class="CollapsiblePanelTab" tabindex="0">Description</div>
          <
    div class="CollapsiblePanelContent"><p>These are a light weight 3.5" 9 LED Mini Flashlight. They have a knurled barrel for easy grip and a easy push on and off button. The 9 LED make it super bright. Requires 3AAA batteries included.</p>
          <p class="
    warning">Warning</p>
          <p>To Prevent injury: Keep away from children, inspect before use (do not use if parts are loose or damaged), position batteries in proper polarity (do not install batteries of different types, charge levels or capacities together), and properly recycle all used batteries.</p></div>

        </div>
        <p>$4.98</p>
    <form method="
    post" action="cart.php">
    <select name="
    id">
          <option value="
    SLF9623">Black (SLF9623)</option>
          <option value="
    SLF9622">Red (SLF9622)</option>
          <option value="
    SLF9621">Blue (SLF9621)</option>
        </select>
    <input type="
    hidden" name="mode" value="add">
    <input type="
    image" src="assets/image/cartbutton.jpg" alt="Add to Cart" border="0">
    </form></td> 
    Notice how now, the options have values to them, and
    the <select> box name is "id" ... when an option is picked,
    the value will be assigned to "id".

    EDIT:
    The WDF text editor sucks ...
    I reposted it again ... hopefully it works.

    .


  11. #10
    Member
    Join Date
    Oct 2011
    Posts
    61
    Member #
    29656
    Thank you so much. This worked great. I can use this everywhere. I was able to test it.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:51 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com