netfuchs Posted November 5, 2018 Share Posted November 5, 2018 (edited) Hi all Prestashop version is 1.7.4.2 On the product page I want to show product-attributes in a grid, with the possibility to insert the quantity per attribute and to add this to the cart. Problem is: after changing the quantity in one of the fields, the inserted value will be reset and the order of the attribute rows will be changed. I have modified the file /themes/classic/templates/catalog/_partials/product-variants.tpl. As the result, I have one line per attribute, with a quantity field and an add-to-the-cart button per row. I have also erased the quantity field at the page ../catalog/product.tpl, but this had no effect to the behaviour. I have also modified or erased the functions of product.js and theme.js, but i didn't notice any impact. /themes/classic/templates/catalog/_partials/product-variants.tpl looks like this: <div class="product-variants"> {foreach from=$groups key=id_attribute_group item=group} <div class="clearfix product-variants-item"> <span class="control-label">{$group.name}</span> <row> <table class="table-product-discounts"> {foreach from=$combinations key=id_attribute item=group_combinations} <tr> <td>{$group_combinations.attributes_values.1}</td> <td>{math equation="x + y" x=$productPriceWithoutReduction y=$group_combinations.price}</td> <td><form autocomplete="off" name="formlist{$group_combinations.attributes.0}" action=" {$urls.pages.cart}" method="post"> <input type="hidden" name="token" value="{$static_token}"> <input type="hidden" value="{$product.id_product}" name="id_product" id="id_product"> <input type="hidden" data-product-attribute="{$group_combinations.attributes.0}" name="id_product_attribute" value="{$group_combinations.attributes.0}"> <input type="number" style="padding: 11px 10px; float:left; width: 40%; class="input-group form-control" data-product-attribute="{$group_combinations.attributes.0}" name="qty{$group_combinations.attributes.0}" min="1" value="1"> <button class="btn btn-primary list-btn" data-button-action="add-to-cart" type="submit" > <i class="material-icons shopping-cart"></i> </button> </form> </td> </tr> {/foreach} </table> </row> </div> {/foreach} </div> Any help is highly appreciated. Thank you. Edited November 9, 2018 by netfuchs URL to test page removed (see edit history) 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