[FIX] website_sale: add to cart with optional products

When clicking on button "add_to_cart" for a product with several options,
the user must be redirected to the product page. In this way, the user can
choose the options, he wants to buy with the product before adding the product
in the cart.

opw:653356
This commit is contained in:
Goffin Simon
2015-11-03 16:27:20 +01:00
parent 388f7a7db9
commit e45ade1979
+2 -2
View File
@@ -121,10 +121,10 @@
<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"/>
<t t-if="len(product.product_variant_ids) == 1">
<t t-if="len(product.product_variant_ids) == 1 and not len(product.optional_product_ids) &gt;= 1">
<a class="btn btn-default btn-xs a-submit"><span class="fa fa-shopping-cart"/></a>
</t>
<t t-if="len(product.product_variant_ids) &gt; 1">
<t t-if="len(product.product_variant_ids) &gt; 1 or len(product.optional_product_ids) &gt;= 1">
<a class="btn btn-default btn-xs" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"><span class="fa fa-shopping-cart"/></a>
</t>
</xpath>