Plus or Minus Images to Control Quantity input boxes

Shopify Partner
120 0 24
Hi Guys, About a week ago I was going through all of the shopify sites that have recently been launched on this forum and I came across a site that used a plus or minus image to control the quantity input box. Does anyone know about this site or how to do it? Man, i thought I bookmarked it ...... grrr Thanks Everyone
0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 122

I’m sure it’s jquery, prototype or some other library, but without a link…. ;)

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes
Shopify Partner
120 0 24

I found some code and it works very nicely if anyone’s interested. I’d like to share it because the forum and it’s very nice people have given me so much and I haven’t had an opportunity to give back yet so here goes.

SCRIPT CODE


function TextBox_AddToIntValue(targetId,addToValue)
{
    var input = document.getElementById(targetId);
    var textInt = parseInt(input.value);
    if(isNaN(textInt))
    {
        textInt = 0;
    }
    input.value = textInt + addToValue;
}

CODE FOR MINUS BUTTON


<a class="plus-minus" onclick="TextBox_AddToIntValue('product-quantity-{{product.id}}',-1)"><img src="{{ 'minus.png' | asset_url }}" alt="Minus" width="20" height="25" border="0" align="absmiddle" /></a>

CODE FOR PLU BUTTON


<input name="quantity" id="product-quantity-{{product.id}}" type="text" value="1" size="3" />
     <a class="plus-minus" onclick="TextBox_AddToIntValue('product-quantity-{{product.id}}',+1)"><img src="{{ 'plus.png' | asset_url }}" alt="Plus" width="20" height="25" border="0" align="absmiddle" /></a>

View it in practice here: http://supermarchepa.myshopify.com/collections/all

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 122

Nice tip thanks for sharing! That’s what helps this forum out :)

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes
Tourist
5 0 1

Oh! It's a nice code for my shop! But I put the script code in jquery library and plus and minus buttons codes in cart.liquid template and the buttons not working yet...I can insert the script code wrong?? I need help please! :(

0 Likes
Highlighted
Excursionist
18 0 1

Is it still possible to do these changes?
And is it possible in the Debut / Minimal theme ?

0 Likes