|
6 | 6 | <div class="product__variants js-product-variants"> |
7 | 7 | {foreach from=$groups key=id_attribute_group item=group} |
8 | 8 | {if !empty($group.attributes)} |
| 9 | + {assign var=groupId value="group_{$id_attribute_group}_{$product.id}"} |
| 10 | + {assign var=inputId value="input_{$id_attribute_group}_{$product.id}"} |
| 11 | + {assign var=legendId value="legend_{$id_attribute_group}_{$product.id}"} |
| 12 | + |
9 | 13 | <fieldset class="product-variant"> |
10 | 14 | <div class="product-variant__label"> |
11 | | - <legend class="form-label product-variant__legend" id="legend_{$product.id}_{$id_attribute_group}">{$group.name}</legend> |
| 15 | + <legend class="form-label product-variant__legend" id="{$legendId}">{$group.name}</legend> |
12 | 16 | <span class="selected-value product-variant__selected" aria-hidden="true"> |
13 | 17 | {l s=': ' d='Shop.Theme.Catalog'} |
14 | 18 | {foreach from=$group.attributes key=id_attribute item=group_attribute} |
|
20 | 24 | {if $group.group_type == 'select'} |
21 | 25 | <select |
22 | 26 | class="form-select" |
23 | | - id="group_{$product.id}_{$id_attribute_group}" |
24 | | - aria-labelledby="legend_{$product.id}_{$id_attribute_group}" |
| 27 | + id="{$inputId}" |
| 28 | + aria-labelledby="{$legendId}" |
25 | 29 | data-product-attribute="{$id_attribute_group}" |
26 | 30 | name="group[{$id_attribute_group}]"> |
27 | 31 | {foreach from=$group.attributes key=id_attribute item=group_attribute} |
28 | 32 | <option value="{$id_attribute}" {if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option> |
29 | 33 | {/foreach} |
30 | 34 | </select> |
31 | 35 | {elseif $group.group_type == 'color'} |
32 | | - <div id="group_{$product.id}_{$id_attribute_group}" class="product-variant__colors" role="radiogroup" aria-labelledby="legend_{$product.id}_{$id_attribute_group}"> |
| 36 | + <div id="{$groupId}" class="product-variant__colors" role="radiogroup" aria-labelledby="{$legendId}"> |
33 | 37 | {foreach from=$group.attributes key=id_attribute item=group_attribute} |
34 | | - {assign var=optionId value="group_{$product.id}_{$id_attribute_group}_{$id_attribute}"} |
35 | | - {assign var=labelId value="label_{$product.id}_{$id_attribute_group}_{$id_attribute}"} |
| 38 | + {assign var=inputId value="input_{$id_attribute_group}_{$id_attribute}_{$product.id}"} |
| 39 | + {assign var=labelId value="label_{$id_attribute_group}_{$id_attribute}_{$product.id}"} |
| 40 | + |
36 | 41 | <div class="product-variant__color input-color"> |
37 | 42 | <input |
38 | 43 | class="input-color__input" |
39 | 44 | type="radio" |
40 | | - id="{$optionId}" |
| 45 | + id="{$inputId}" |
41 | 46 | data-product-attribute="{$id_attribute_group}" |
42 | 47 | name="group[{$id_attribute_group}]" |
43 | 48 | value="{$id_attribute}" |
|
46 | 51 | > |
47 | 52 | <label |
48 | 53 | class="input-color__label{if $group_attribute.texture} input-color__label--texture{/if}{if $group_attribute.selected} input-color__label--active{/if}" |
49 | | - for="{$optionId}" |
| 54 | + for="{$inputId}" |
50 | 55 | > |
51 | 56 | <span id="{$labelId}" |
52 | 57 | {if $group_attribute.texture} |
|
62 | 67 | {/foreach} |
63 | 68 | </div> |
64 | 69 | {elseif $group.group_type == 'radio'} |
65 | | - <div id="group_{$product.id}_{$id_attribute_group}" class="product-variant__radios" role="radiogroup" aria-labelledby="legend_{$product.id}_{$id_attribute_group}"> |
| 70 | + <div id="{$groupId}" class="product-variant__radios" role="radiogroup" aria-labelledby="{$legendId}"> |
66 | 71 | {foreach from=$group.attributes key=id_attribute item=group_attribute} |
67 | | - {assign var=optionId value="group_{$product.id}_{$id_attribute_group}_{$id_attribute}"} |
68 | | - {assign var=labelId value="label_{$product.id}_{$id_attribute_group}_{$id_attribute}"} |
| 72 | + {assign var=inputId value="input_{$id_attribute_group}_{$id_attribute}_{$product.id}"} |
| 73 | + {assign var=labelId value="label_{$id_attribute_group}_{$id_attribute}_{$product.id}"} |
| 74 | + |
69 | 75 | <div class="product-variant__radio form-check"> |
70 | 76 | <input |
71 | 77 | class="form-check-input" |
72 | 78 | type="radio" |
73 | | - id="{$optionId}" |
| 79 | + id="{$inputId}" |
74 | 80 | data-product-attribute="{$id_attribute_group}" |
75 | 81 | name="group[{$id_attribute_group}]" |
76 | 82 | value="{$id_attribute}" |
77 | 83 | aria-labelledby="{$labelId}" |
78 | 84 | {if $group_attribute.selected} checked="checked" aria-checked="true"{/if} |
79 | 85 | > |
80 | | - <label for="{$optionId}"> |
| 86 | + <label for="{$inputId}"> |
81 | 87 | <span class="form-check-label" id="{$labelId}"><span class="visually-hidden">{$group.group_name} - </span>{$group_attribute.name}</span> |
82 | 88 | </label> |
83 | 89 | </div> |
|
0 commit comments