Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hundebol 167 posts 314 karma points
    Apr 11, 2012 @ 16:25
    Hundebol
    0

    Quantity as select

    Hi Tea-Guys!

    Is it possible to change the quantity input field to a select option (easy change, i'm not that much of a developer)

    I believe one has to change both markup and jquery?

    best regards Brian

  • Anders Burla 2560 posts 8256 karma points
    Apr 12, 2012 @ 17:08
    Anders Burla
    0

    Hi Hundebol

    That should be pretty easy. You can just go ahead and change the html markup. Then go through the javascript and look for the class name used for the quantity field and change it to the new markup. Think its just done by trying and updating the javascript until it works again :)

    Kind regards
    Anders

  • Hundebol 167 posts 314 karma points
    Apr 17, 2012 @ 15:06
    Hundebol
    0

    Hi Anders,

    The HTML markup is no problem at all. (i think)

    Current - input box:     

    <input type="text" name="quantity" id="quantity" class="quantity" value="1" /> 

    My take on a select box:

                    <select name="quantity" class="quantity" id="quantity">
                      <option value="1">1</option>
                      <option value="10">10</option>   
                    </select> 

     

    The JavaScript is worse. if someone has done this, and have a snippet to share - then i would appreciate. :)

    Current looks like this:

    quantityInput = product.find('input.quantity'),
    quantity = quantityInput[0] ? quantityInput.val() : 1,

     

    best regards, Hundebol

  • Anders Burla 2560 posts 8256 karma points
    Apr 17, 2012 @ 16:26
    Anders Burla
    0

    Just do this quantityInput = product.find('select.quantity'') - try and alert the quantityInput.val() and see it gives you the selected value

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft