diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index 4336ca2293029723497c04d223a419988a3d024d..338369b46e3fcd4f5901f0a430da497c4a81ce28 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 864f62410cad1c67be89221a24ad3af968407705..7451aa00add090b6543a31e44c5b34928a8d63b3 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='{