[IMP] website_sale: variant change the price

bzr revid: chm@openerp.com-20131003104701-28mvvte5wa6q8mt7
This commit is contained in:
Christophe Matthieu
2013-10-03 12:47:01 +02:00
parent b03b86ac41
commit 16a3aa522b
3 changed files with 14 additions and 2 deletions
+1
View File
@@ -347,6 +347,7 @@ FaceTime HD Camera, 1.2 MP Photos</field>
</record>
<record id="product_product_11" model="product.product">
<field name="name">iPod</field>
<field name="variants">16 Gb</field>
<field name="default_code">A6678</field>
<field name="categ_id" ref="ipod"/>
<field name="public_categ_id" ref="Keyboard_Mouse"/>
@@ -52,6 +52,17 @@ $(document).ready(function () {
return false;
});
// change price when they are variants
$('form.js_add_cart_json label').on('mouseup', function (ev) {
ev.preventDefault();
var $label = $(ev.currentTarget);
var $price = $label.parent("form").find(".oe_price");
if (!$price.data("price")) {
$price.data("price", parseFloat($price.html()));
}
$price.html($price.data("price")+parseFloat($label.find(".badge span").html() || 0));
});
$(document).on('click', '.js_publish_management .js_go_to_top,.js_publish_management .js_go_to_bottom', function (event) {
var $a = $(event.currentTarget);
var $data = $a.parents(".js_publish_management:first");
+2 -2
View File
@@ -339,7 +339,7 @@
<input type="radio" name="product_id" t-att-value="product.id" t-att-checked="product == product.product_variant_ids[0] or None"/>
<t t-esc="product.variants or ''">Standard</t>
<span class="badge" t-if="product.price_extra">
<t t-esc="product.price_extra > 0 and '+' or ''"/><t t-esc="product.price_extra"/> €
<t t-esc="product.price_extra > 0 and '+' or ''"/><span t-esc="product.price_extra"/> €
</span>
</label>
<br/>
@@ -352,7 +352,7 @@
<t t-esc="product.product_variant_ids[0].lst_price" /> €
</span>&amp;nbsp;
</t>
<h4><b><t t-esc="product.product_variant_ids[0].price" /> €</b></h4>
<h4><b><span class="oe_price" t-esc="product.product_variant_ids[0].price" /> €</b></h4>
</b>
</div>
<button class="btn btn-primary btn-lg mt8">Add to Cart</button>