[enhancement] [website] numeric attribute selector, smart selection of variant based on attribute combinations
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index 4bd521d..acbcedf 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -29,7 +29,8 @@
<div class="item-attribute-selectors">
{% if has_variants %}
{% for d in attributes %}
- <div class="item-view-attribute"
+ {% if attribute_values[d.attribute] -%}
+ <div class="item-view-attribute {% if (attribute_values[d.attribute] | len)==1 -%} hidden {%- endif %}"
style="margin-bottom: 10px;">
<h6 class="text-muted">{{ _(d.attribute) }}</h6>
<select class="form-control"
@@ -37,12 +38,17 @@
data-attribute="{{ d.attribute }}">
{% for value in attribute_values[d.attribute] %}
<option value="{{ value }}"
- {% if selected_attributes and selected_attributes[d.attribute]==value -%} selected {%- endif %}>
+ {% if selected_attributes and selected_attributes[d.attribute]==value -%}
+ selected
+ {%- elif disabled_attributes and value in disabled_attributes.get(d.attribute, []) -%}
+ disabled
+ {%- endif %}>
{{ _(value) }}
</option>
{% endfor %}
</select>
</div>
+ {%- endif %}
{% endfor %}
{% endif %}
</div>