From 8afa1b60621e8d995d541f4063a7ba2c5ab1be2d Mon Sep 17 00:00:00 2001 From: Christophe Matthieu <chm@odoo.com> Date: Fri, 19 Sep 2014 11:07:33 +0200 Subject: [PATCH] [FIX] website_sale: displayed price doesn't change for 'List View of Variants' customize template --- addons/website_sale/static/src/js/website_sale.js | 6 ++++++ addons/website_sale/views/templates.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index 4336ca229302..338369b46e3f 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -90,6 +90,12 @@ $('.oe_website_sale').each(function () { return price + (dec ? '' : '.0') + (dec%10 ? '' : '0'); } + $(oe_website_sale).on('change', 'input.js_product_change', function (ev) { + var $parent = $(this).closest('.js_product'); + $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')) ); + }); + $(oe_website_sale).on('change', 'input.js_variant_change, select.js_variant_change', function (ev) { var $ul = $(this).parents('ul.js_add_cart_variants:first'); var $parent = $ul.closest('.js_product'); diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 864f62410cad..7451aa00add0 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -460,7 +460,7 @@ <input type="hidden" t-if="len(product.product_variant_ids) == 1" name="product_id" t-att-value="product.product_variant_ids[0].id"/> <t t-if="len(product.product_variant_ids) > 1"> <label label-default="label-default" class="radio" t-foreach="product.product_variant_ids" t-as="variant_id"> - <input type="radio" name="product_id" t-att-value="variant_id.id"/> + <input type="radio" name="product_id" class="js_product_change" t-att-value="variant_id.id" t-att-data-lst_price="variant_id.lst_price" t-att-data-price="variant_id.price"/> <span t-esc="variant_id.name_get()[0][1]"/> <span class="badge" t-if="variant_id.price_extra"> <t t-esc="variant_id.price_extra > 0 and '+' or ''"/><span t-field="variant_id.price_extra" style="white-space: nowrap;" t-field-options='{ -- GitLab