Skip to content

Instantly share code, notes, and snippets.

@philcon93
Last active June 6, 2016 22:56
Show Gist options
  • Save philcon93/1a678bb88e1733dbdd6c5996f8db4b06 to your computer and use it in GitHub Desktop.
Save philcon93/1a678bb88e1733dbdd6c5996f8db4b06 to your computer and use it in GitHub Desktop.
input to select

Change input field into a select box using mult quantity.

B@SE

[%if [@multiplier_qty@] > 0%]
<select id="qty[@rndm@][@SKU@]" name="qty" class="form-control input-lg theQty">
[%IF [@store_quantity@] > 0 %]
<option selected> [%if [@min_qty@] > 0%][@min_qty@][%else%][@multiplier_qty@][%/if%]</option>
[%SET [@data:qty-count@] = 1 /%]
[%WHILE [@data:qty-count@] <= 11%]
[%SET [@data:qty-count@] = [@data:qty-count@]+1 /%]
<option>[%calc [@data:qty-count@]*[@multiplier_qty@] /%]</option>
[%/WHILE%]
[%ELSEIF [@store_quantity@] < 1 AND [@config:ALLOW_NOSTOCK_CHECKOUT@] %]
<option selected> [%if [@min_qty@] > 0%][@min_qty@][%else%][@multiplier_qty@][%/if%]</option>
[%SET [@data:qty-count@] = 1 /%]
[%WHILE [@data:qty-count@] <= 11%]
[%SET [@data:qty-count@] = [@data:qty-count@]+1 /%]
<option>[%calc [@data:qty-count@]*[@multiplier_qty@] /%]</option>
[%/WHILE%]
[%ELSE%]
<option selected disabled>1</option>
[%/ IF%]
</select>
[%else%]
<input type="number" min="[@min_qty@]" class="form-control qty input-lg" id="qty[@rndm@][@SKU@]" name="qty" value="[%data id:'min_qty' if:'ne' value:'0' %][@min_qty@][%end data%][%data id:'min_qty' if:'eq' value:'0' %]1[%end data%]" size="2"/>
[%/if%]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment