How to use predefined list of quantity instead of text input field on signup form

From aMember Pro Documentation
Revision as of 06:34, 14 December 2016 by Caesar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

First of all you need to enable option 'allow user to change quantity' in product settings. aMember CP -> Products -> Manage Products -> (edit)

You need edit your signup form at aMember CP -> Forms Editor -> (edit) and add Javascript brick to your form.

Then click configure link on this brick and put the following code in brick configuration:

jQuery(function(){
    jQuery('.am-product-qty').css({opacity: 0, width: 0, padding:0}).after('<select>\
        <option value="1">1</option>\
        <option value="2">2</option>\
        <option value="3">3</option>\
        <option value="4">4</option>\
        <option value="5">5</option>\
    </select>').next('select').change(function(){
        jQuery('.am-product-qty', jQuery(this).closest('label')).val(jQuery(this).val()).change();
    });
});

Save your form and test it.