[FIX] website_sale: change template for product and variant selector (type color)
This commit is contained in:
parent
0a537dae91
commit
c5ab412acc
|
@ -289,6 +289,13 @@
|
|||
.css_attribute_color input {
|
||||
margin: 8px;
|
||||
height: 13px;
|
||||
opacity: 0;
|
||||
}
|
||||
.css_attribute_color.active {
|
||||
border: 3px ridge #66ee66;
|
||||
}
|
||||
.css_attribute_color.active input {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
.js_add_cart_variants option.css_not_available {
|
||||
|
|
|
@ -251,6 +251,12 @@
|
|||
input
|
||||
margin: 8px
|
||||
height: 13px
|
||||
opacity: 0
|
||||
&.active
|
||||
border: 3px ridge #66ee66
|
||||
&.active input
|
||||
margin: 6px
|
||||
|
||||
.js_add_cart_variants
|
||||
option.css_not_available
|
||||
color: #ccc
|
||||
|
|
|
@ -62,6 +62,11 @@ $(document).ready(function () {
|
|||
var dec = value % 1;
|
||||
$price.html(value + (dec < 0.01 ? ".00" : (dec < 1 ? "0" : "") ));
|
||||
});
|
||||
// hightlight selected color
|
||||
$('.css_attribute_color input').on('change', function (ev) {
|
||||
$('.css_attribute_color').removeClass("active");
|
||||
$('.css_attribute_color:has(input:checked)').addClass("active");
|
||||
});
|
||||
|
||||
var $form_var = $('form.js_add_cart_variants');
|
||||
var variant_ids = $form_var.data("attribute_value_ids");
|
||||
|
|
|
@ -297,8 +297,8 @@
|
|||
</t>
|
||||
<t t-if="a.type == 'color'">
|
||||
<t t-foreach="a.value_ids" t-as="v">
|
||||
<label class="css_attribute_color"
|
||||
t-attf-style="background-color:#{v.color or v.name}">
|
||||
<label t-attf-style="background-color:#{v.color or v.name}"
|
||||
t-attf-class="css_attribute_color #{'active' if v.id in attrib_set else ''}">
|
||||
<input type="checkbox"
|
||||
name="attrib"
|
||||
t-att-value="'%s,%s' % (a.id,v.id)"
|
||||
|
@ -481,8 +481,8 @@
|
|||
<ul class="nav nav-pills nav-stacked">
|
||||
<t t-set="inc" t-value="0"/>
|
||||
<t t-foreach="variant_id.value_ids" t-as="value_id">
|
||||
<label class="css_attribute_color"
|
||||
t-attf-style="background-color:#{value_id.color or value_id.name}">
|
||||
<label t-attf-style="background-color:#{value_id.color or value_id.name}"
|
||||
t-attf-class="css_attribute_color #{'active' if not inc else ''}">
|
||||
<input type="radio"
|
||||
t-att-checked="'checked' if not inc else ''"
|
||||
t-att-name="'attribute-%s' % variant_id.attribute_id.id"
|
||||
|
@ -529,13 +529,12 @@
|
|||
|
||||
<template id="product_attributes" inherit_id="website_sale.product" optional="enabled" name="Product attributes">
|
||||
<xpath expr="//p[@t-field='product.description_sale']" position="after">
|
||||
<hr t-if="product.attribute_line_ids"/>
|
||||
<hr t-if="sum([(1 if len(l.value_ids)==1 else 0) for l in product.attribute_line_ids])"/>
|
||||
<p class="text-muted">
|
||||
<t t-foreach="product.attribute_line_ids" t-as="variant_id">
|
||||
<t t-set="inc" t-value="0"/>
|
||||
<span t-field="variant_id.attribute_id"/>:
|
||||
<t t-foreach="variant_id.value_ids" t-as="value_id"><t t-if="inc">,</t> <span t-field="value_id.name"/><t t-set="inc" t-value="inc+1"/></t>
|
||||
<br/>
|
||||
<t t-if="len(variant_id.value_ids)==1">
|
||||
<span t-field="variant_id.attribute_id"/>: <span t-field="variant_id.value_ids[0].name"/><br/>
|
||||
</t>
|
||||
</t>
|
||||
</p>
|
||||
</xpath>
|
||||
|
|
Loading…
Reference in New Issue