dropdown for product variant picker

main
alexanderroese 2024-07-13 23:41:00 +02:00
parent c412713a00
commit a21e84e4e1
1 changed files with 7 additions and 28 deletions

View File

@ -42,7 +42,7 @@
{% if shx_current_page contains "texte" %}
<script>
console.log("2 product variant", "{{ picker_type }}", {{ product | json }}, {{ shx_current_page }})
console.log("3 product variant", "{{ picker_type }}", {{ product | json }}, {{ shx_current_page }})
</script>
<style>
@ -101,29 +101,10 @@
background-color: #e9e9e9;
}
/*
.shx-dummy-select {
display: none;
} */
}
</style>
{% comment %}
<div class="field custom">
<select
id="Option-{{ section.id }}-{{ forloop.index0 }}"
class="field__input"
name="options[{{ option.name | escape }}]"
form="{{ product_form_id }}"
>
{% for product_variant in product.variants %}
<option value="{{ product_variant.title }}">
<div style="display: flex; flex-direction: column">
<span>{{ product_variant.title }}</span>
</div>
</option>
{% endfor %}
</select>
</div>
{% endcomment %}
<legend class="form__label">{{ option.name }}</legend>
@ -139,8 +120,6 @@
{% endfor %}
</select>
<h1>{{ option.selected_value }}</h1>
<button class="shx-custom-dropbtn" id="shx-custom-selected">
<div style="display: flex; justify-content: space-between; align-items: center; pointer-events: none">
<span id="shx-custom-selected-value">{{ option.selected_value }}</span>
@ -207,7 +186,7 @@
});
// Set the initial value when the page loads
window.addEventListener('load', function() {
/* window.addEventListener('load', function() {
const selectedValue = selectElement.value;
// customSelectedValue.innerText = selectedValue;
@ -219,11 +198,10 @@
} else {
div.classList.remove('shx-custom-selected-variant');
}
}); */
});
}); */ /*
}); */
</script>
{% endif %}
{% else %}
{%- if picker_type == 'swatch' -%}
<fieldset class="js product-form__input product-form__input--swatch">
<legend class="form__label">
@ -279,6 +257,7 @@
{% render 'icon-caret' %}
</div>
</div>
{% endif %}
{% endif %}
{%- endfor -%}
<script type="application/json">