Re: Add quantity input box within product list grid for Crisp White Skin
This action is performed in background via an AJAX call from this JavaScript file:
skins/customer/items_list/product/products_list.js
The function that performs the call is this one:
ProductsListView.prototype.addToCart = function (elem) {}
The template file that renders the button in product grids is this one:
skins/customer/items_list/product/parts/grid.button-add2cart-wrapper.twig
If you check the file, you will see that the button is injected into "itemsList.product.grid.customer.tail" list.
So, to add the quantity selector you should:
1. Create a custom module
2. In the module create a new template file that will inject the input box into the same "itemsList.product.grid.customer.tail" list (use the "weight" attribute to control a position of the widget among others in this list).
3. In the module create a new JS file that will replace ProductsListView.prototype.addToCart with your custom function that will pass the specified quantity in the "add-to-cart" request to the server.
4. In the module "decorate" \XLite\View\ItemsList\Product\AProduct class and make the getJSFiles() method load your JS file.
|