4
4
* See COPYING.txt for license details.
5
5
*/
6
6
7
- use Magento \Catalog \Api \Data \ProductCustomOptionInterface ;
7
+ // @codingStandardsIgnoreFile
8
+ use Magento \Catalog \Model \Product \Option ;
8
9
9
10
/**
10
- * @var \Magento\Catalog\Block\Product\View\Options\Select\Checkable $block
11
+ * @var \Magento\Catalog\Block\Product\View\Options\Type\ Select\Checkable $block
11
12
*/
12
13
$ option = $ block ->getOption ();
13
-
14
14
if ($ option ) : ?>
15
- <?php
16
- $ configValue = $ block ->getPreconfiguredValue ($ option );
17
- $ optionType = $ option ->getType ();
18
- $ arraySign = $ optionType === ProductCustomOptionInterface ::OPTION_TYPE_CHECKBOX ? '[] ' : '' ;
19
- $ count = 1 ;
20
- ?>
15
+ <?php
16
+ $ configValue = $ block ->getPreconfiguredValue ($ option );
17
+ $ optionType = $ option ->getType ();
18
+ $ arraySign = $ optionType === Option ::OPTION_TYPE_CHECKBOX ? '[] ' : '' ;
19
+ $ count = 1 ;
20
+ ?>
21
21
22
- <div class="options-list nested" id="options-<?= /* @noEscape */ $ option ->getId () ?> -list">
23
-
24
- <?php if ($ optionType === ProductCustomOptionInterface::OPTION_TYPE_RADIO ) : ?>
25
- <div class="field choice admin__field admin__field-option">
26
- <input type="radio"
27
- id="options_<?= /* @noEscape */ $ option ->getId () ?> "
28
- class="radio admin__control-radio product-custom-option"
29
- name="options[<?= /* @noEscape */ $ option ->getId () ?> ]"
30
- data-selector="options[<?= /* @noEscape */ $ option ->getId () ?> ]"
31
- onclick="<?= $ block ->getSkipJsReloadPrice () ? '' : 'opConfig.reloadPrice() ' ?> "
32
- value=""
33
- checked="checked"
34
- />
35
- <label class="label admin__field-label" for="options_<?= /* @noEscape */ $ option ->getId () ?> ">
36
- <span>
37
- <?= /* @noEscape */ __ ('None ' ) ?>
38
- </span>
39
- </label>
40
- </div>
41
- <?php endif ; ?>
22
+ <div class="options-list nested" id="options-<?php echo /* @noEscape */
23
+ $ option ->getId () ?> -list">
24
+ <?php if ($ optionType === Option::OPTION_TYPE_RADIO && !$ option ->getIsRequire ()): ?>
25
+ <div class="field choice admin__field admin__field-option">
26
+ <input type="radio"
27
+ id="options_<?php echo /* @noEscape */
28
+ $ option ->getId () ?> "
29
+ class="radio admin__control-radio product-custom-option"
30
+ name="options[<?php echo /* @noEscape */
31
+ $ option ->getId () ?> ]"
32
+ data-selector="options[<?php echo /* @noEscape */
33
+ $ option ->getId () ?> ]"
34
+ onclick="<?php echo $ block ->getSkipJsReloadPrice () ? '' : 'opConfig.reloadPrice() ' ?> "
35
+ value=""
36
+ checked="checked"
37
+ />
38
+ <label class="label admin__field-label" for="options_<?php echo /* @noEscape */
39
+ $ option ->getId () ?> ">
40
+ <span>
41
+ <?php echo /* @noEscape */
42
+ __ ('None ' ) ?>
43
+ </span>
44
+ </label>
45
+ </div>
46
+ <?php endif ; ?>
42
47
43
48
<?php foreach ($ option ->getValues () as $ value ) : ?>
44
49
<?php
45
50
$ checked = '' ;
46
51
$ count ++;
47
-
48
52
if ($ arraySign ) {
49
53
$ checked = is_array ($ configValue ) && in_array ($ value ->getOptionTypeId (), $ configValue ) ? 'checked ' : '' ;
50
54
} else {
51
55
$ checked = $ configValue == $ value ->getOptionTypeId () ? 'checked ' : '' ;
52
56
}
53
-
54
57
$ dataSelector = 'options[ ' . $ option ->getId () . '] ' ;
55
58
if ($ arraySign ) {
56
59
$ dataSelector .= '[ ' . $ value ->getOptionTypeId () . '] ' ;
57
60
}
58
61
?>
59
62
60
- <div class="field choice admin__field admin__field-option'<?= /* @noEscape */ $ option ->getIsRequire () ?> '">
61
- <input type="<?= /* @noEscape */ $ optionType ?> "
62
- class="<?= /* @noEscape */
63
- /** @noinspection DisconnectedForeachInstructionInspection */
64
- $ optionType === ProductCustomOptionInterface::OPTION_TYPE_RADIO ?
63
+ <div class="field choice admin__field admin__field-option <?php echo /* @noEscape */
64
+ $ option ->getIsRequire () ? 'required ' : '' ?> ">
65
+ <input type="<?php echo /* @noEscape */
66
+ $ optionType ?> "
67
+ class="<?php /** @noinspection DisconnectedForeachInstructionInspection */
68
+ echo /* @noEscape */
69
+ $ optionType === Option::OPTION_TYPE_RADIO ?
65
70
'radio admin__control-radio ' :
66
- 'checkbox admin__control-checkbox ' ?> <?= /* @noEscape */ $ option ->getIsRequire () ?>
71
+ 'checkbox admin__control-checkbox ' ?> <?php echo /* @noEscape */
72
+ $ option ->getIsRequire () ? 'required ' : '' ?>
67
73
product-custom-option
68
- <?= $ block ->getSkipJsReloadPrice () ? '' : 'opConfig.reloadPrice() ' ?> "
69
- name="options[<?= $ option ->getId () ?> ]<?= /* @noEscape */ $ arraySign ?> "
70
- id="options_<?= /* @noEscape */ $ option ->getId () . '_ ' . $ count ?> "
71
- value="<?= /* @noEscape */ $ value ->getOptionTypeId () ?> "
72
- <?= /* @noEscape */ $ checked ?>
73
- data-selector="<?= /* @noEscape */ $ dataSelector ?> "
74
- price="<?= /* @noEscape */ $ block ->getCurrencyByStore ($ value ) ?> "
74
+ <?php echo $ block ->getSkipJsReloadPrice () ? '' : 'opConfig.reloadPrice() ' ?> "
75
+ name="options[<?php echo $ option ->getId () ?> ]<?php echo /* @noEscape */
76
+ $ arraySign ?> "
77
+ id="options_<?php echo /* @noEscape */
78
+ $ option ->getId () . '_ ' . $ count ?> "
79
+ value="<?php echo /* @noEscape */
80
+ $ value ->getOptionTypeId () ?> "
81
+ <?php echo /* @noEscape */
82
+ $ checked ?>
83
+ data-selector="<?php echo /* @noEscape */
84
+ $ dataSelector ?> "
85
+ price="<?php echo /* @noEscape */
86
+ $ block ->getCurrencyByStore ($ value ) ?> "
75
87
/>
76
88
<label class="label admin__field-label"
77
- for="options_<?= /* @noEscape */ $ option ->getId () . '_ ' . $ count ?> ">
89
+ for="options_<?php echo /* @noEscape */
90
+ $ option ->getId () . '_ ' . $ count ?> ">
78
91
<span>
79
- <?= $ block ->escapeHtml ($ value ->getTitle ()) ?>
92
+ <?php echo $ block ->escapeHtml ($ value ->getTitle ()) ?>
80
93
</span>
81
- <?= /* @noEscape */ $ block ->formatPrice ($ value ) ?>
94
+ <?php echo /* @noEscape */
95
+ $ block ->formatPrice ($ value ) ?>
82
96
</label>
83
97
</div>
84
98
<?php endforeach ; ?>
85
- </div>
86
- <?php endif ; ?>
87
-
99
+ </div>
100
+ <?php endif ; ?>
0 commit comments