[FIX] website_sale: rounding price; typo and search sequence of membership
This commit is contained in:
parent
1356374275
commit
0492e59314
|
@ -9,6 +9,7 @@
|
|||
<record model="ir.ui.view" id="membership_product_search_form_view">
|
||||
<field name="name">membership.product.search.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="priority">50</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Membership Products">
|
||||
<field name="name" filter_domain="['|',('name','ilike',self),('code','ilike',self)]" string="Membership Product"/>
|
||||
|
|
|
@ -63,6 +63,7 @@ $(document).ready(function () {
|
|||
}
|
||||
var value = $price.data("price") + parseFloat($label.find(".badge span").text() || 0);
|
||||
var dec = value % 1;
|
||||
console.log(dec);
|
||||
$price.html(value + (dec < 0.01 ? ".00" : (dec < 1 ? "0" : "") ));
|
||||
});
|
||||
// hightlight selected color
|
||||
|
@ -87,7 +88,7 @@ $(document).ready(function () {
|
|||
var product_id = false;
|
||||
for (var k in variant_ids) {
|
||||
if (_.isEqual(variant_ids[k][1], values)) {
|
||||
var dec = ((variant_ids[k][2] % 1) * 100) | 0;
|
||||
var dec = Math.round((variant_ids[k][2] % 1) * 100);
|
||||
$price.html(variant_ids[k][2] + (dec ? '' : '.0') + (dec%10 ? '' : '0'));
|
||||
product_id = variant_ids[k][0];
|
||||
break;
|
||||
|
@ -133,8 +134,13 @@ $(document).ready(function () {
|
|||
$('.js_add_cart_variants:first ul:first > li').each(function () {
|
||||
var $li = $(this);
|
||||
var $span = $("<div><span></span>: <span></span></div>");
|
||||
$span.children().first().text($li.children().first().text());
|
||||
$span.children().last().text($li.find("label:has(input:checked) span:first").text());
|
||||
var attr = $li.children().first().text();
|
||||
var value = $li.find("label:has(input:checked) span:first").text();
|
||||
if (!/\S/.test(value)) {
|
||||
value = $li.find("label:has(input:checked) input").attr("title");
|
||||
}
|
||||
$span.children().first().text( attr );
|
||||
$span.children().last().text( value );
|
||||
$confirm.append($span);
|
||||
});
|
||||
});
|
||||
|
@ -144,8 +150,21 @@ $(document).ready(function () {
|
|||
var $parent = $(this).parents('.js_product:first');
|
||||
$parent.find("a.js_add, span.js_remove").toggleClass("hidden");
|
||||
$parent.find("input.js_optional_same_quantity").val( $(this).hasClass("js_add") ? 1 : 0 );
|
||||
var $remove = $parent.find(".js_remove");
|
||||
});
|
||||
|
||||
$("input.js_quantity").change(function (event) {
|
||||
var qty = parseFloat($(this).val());
|
||||
if (qty === 1) {
|
||||
$(".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_item").addClass("hidden");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#product_detail form[action^="/shop/cart/update"] .a-submit').off("click").click(function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
|
|
|
@ -448,63 +448,13 @@
|
|||
<input type="hidden" class="js_quantity" t-attf-name="optional-quantity-#{option_inc}" value="0"/>
|
||||
<a href="#" class="js_add"><strong>Add to Cart</strong></a>
|
||||
<span class="js_remove hidden">
|
||||
Will be add to your cart<br/>
|
||||
<span class="js_item">1 Item</span><span class="js_items hidden">5 Items</span><br/>
|
||||
<a href="#" class="js_remove"><small>Cancel</small></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--
|
||||
<div class="js_product" t-foreach="optional_product_ids" t-as="product">
|
||||
<strong class="media-heading" t-field="product.name"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-2">
|
||||
<span t-field="product.image_small" t-field-options='{"widget": "image"}'/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<input type="hidden" class="optional_product_id" t-attf-name="optional-product-#{option_inc}" t-att-value="int(product.product_variant_ids[0]) if len(product.product_variant_ids) == 1 else '0'"/>
|
||||
<t t-call="website_sale.variants"/>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<strong>Price</strong><br/>
|
||||
<t t-if="product.lst_price != product.price">
|
||||
<span class="text-danger" style="text-decoration: line-through;"
|
||||
t-field="product.lst_price"
|
||||
t-field-options='{
|
||||
"widget": "monetary",
|
||||
"display_currency": "website.pricelist_id.currency_id"
|
||||
}'/><br/>
|
||||
</t>
|
||||
<span class="oe_price"
|
||||
t-field="product.price"
|
||||
t-field-options='{
|
||||
"widget": "monetary",
|
||||
"display_currency": "website.pricelist_id.currency_id"
|
||||
}'/>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<strong>Number</strong><br/>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<a t-attf-href="#" class="mb8 js_add_cart_json">
|
||||
<i class="fa fa-minus"></i>
|
||||
</a>
|
||||
</span>
|
||||
<input type="text" class="js_quantity form-control" t-attf-name="optional-quantity-#{option_inc}" value="0"/>
|
||||
<span class="input-group-addon">
|
||||
<a t-attf-href="#" class="mb8 float_left js_add_cart_json">
|
||||
<i class="fa fa-plus"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<p class="css_not_available_msg bg-danger" style="padding: 15px;">Product not available</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-default a-submit js_goto_shop"><i class="fa fa-chevron-left"></i> Continue shopping</a>
|
||||
|
@ -586,6 +536,7 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="4"><h4>Select Your Options</h4></td></tr>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue