Skip to content
Snippets Groups Projects
Commit 0ff26cf7 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] website_sale: quick add in the cart

If the product to quick add in the cart has several variants, the button cart
redirects the user to the page of this product. If "attribute_value_ids" is not
in the DOM when clicking on the button cart, the product is immediately added in
the cart.

Closes #6714

opw:639897
parent 04ef9d99
Branches
Tags
No related merge requests found
......@@ -116,7 +116,12 @@
<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">
<xpath expr="//div[@class='product_price']" position="inside">
<input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>
<t t-if="len(product.product_variant_ids) == 1">
<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>
</t>
<t t-if="len(product.product_variant_ids) &gt; 1">
<a class="btn btn-default btn-xs fa fa-shopping-cart" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"/>
</t>
</xpath>
</template>
......
$(document).ready(function () {
if(! $("ul.js_add_cart_variants[data-attribute_value_ids]").length){
return;
}
$('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit')
.off('click')
.removeClass('a-submit')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment