[FIX] website_sale_options: only one optional product is added to the cart and the quantity of the optional product don't change in the cart when we click on more or less. Fix the number of items displayed in the modal options.

This commit is contained in:
Christophe Matthieu 2014-09-29 16:12:57 +02:00 committed by Christophe Simonis
parent 7ce3961693
commit d8e67d647f
3 changed files with 14 additions and 4 deletions

View File

@ -95,7 +95,7 @@ $('.oe_website_sale').each(function () {
$parent.find(".oe_default_price:first .oe_currency_value").html( price_to_str(+$(this).data('lst_price')) );
$parent.find(".oe_price:first .oe_currency_value").html(price_to_str(+$(this).data('price')) );
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img, img.product_detail_img');
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img:first, img.product_detail_img');
$img.attr("src", "/website/image/product.product/" + $(this).val() + "/image");
});
@ -129,7 +129,7 @@ $('.oe_website_sale').each(function () {
}
if (product_id) {
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img, img.product_detail_img');
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img:first, img.product_detail_img');
$img.attr("src", "/website/image/product.product/" + product_id + "/image");
$img.parent().attr('data-oe-model', 'product.product').attr('data-oe-id', product_id)
.data('oe-model', 'product.product').data('oe-id', product_id);

View File

@ -53,7 +53,7 @@ $(document).ready(function () {
$(".js_remove .js_items").addClass("hidden");
$(".js_remove .js_item").removeClass("hidden");
} else {
$(".js_remove .js_items").removeClass("hidden").text($(".js_remove .js_items").text().replace(/[0-9.,]+/, qty));
$(".js_remove .js_items").removeClass("hidden").text($(".js_remove .js_items:first").text().replace(/[0-9.,]+/, qty));
$(".js_remove .js_item").addClass("hidden");
}
});
@ -65,5 +65,14 @@ $(document).ready(function () {
});
return false;
});
$('#cart_products input.js_quantity').change(function () {
var value = $(this).val();
var $next = $(this).closest('tr').next('.optional_product');
while($next.length) {
$next.find('.js_quantity').text(value);
$next = $next.next('.optional_product');
}
});
});

View File

@ -131,6 +131,7 @@
<a href="#" class="js_remove"><small>Remove from cart</small></a>
</span>
</td>
<t t-set="option_inc" t-value="option_inc+1"/>
</tr>
</tbody>