danvers Posted October 22, 2014 Share Posted October 22, 2014 Hello, I need to change the id of the quantity input in my product.tpl when the radio input is checked. WHY? My product.tpl display a "Add to cart" for each attribute. When I select for instance the second attribute and choose "1" quantity or any quantity it adds the quantity in the first quantity box (here in the example "5") --> Only the first quantity box works, the others don't. So, I think I've managed to see why, it's because all the input quantity have the same id "quantity_wanted", and the script just add the first quantity he finds in any input with id "quantity_wanted"(the first attribute then) <input id="quantite" type="radio" class="attribute_radio" name="{$groupName}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} onclick="findCombination(); getProductAttribute();" /> <span id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <!-- <label>{l s='Quantity:'}</label> --> <input type="number" name="qty" id="quantity_wanted" class="text" value="1" size="2" maxlength="2" /> </span> THEN What I need, is something like this with {if} (of course it doesn't work, as I don't know how-to properly write it) <input type="number" name="qty" {if (input.#quantite.checked == "checked")} id="quantity_wanted"{/if} class="text" value="1" size="2" maxlength="2" /> Could someone tell me how-to write it properly? Or if you have some other solution to my problem, I'm listening. Best regards, Link to comment Share on other sites More sharing options...
danvers Posted October 22, 2014 Author Share Posted October 22, 2014 Ok after some research, I think the better solution is a javascript to put in blockcart.js but I don't know how-to write it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now