|
8 | 8 | <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox */ ?> |
9 | 9 | <?php $_option = $block->getOption() ?> |
10 | 10 | <?php $_selections = $_option->getSelections() ?> |
| 11 | +<?php $inputClass = 'checkbox product bundle option bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?> |
| 12 | +<?php $inputId = 'bundle-option-' . $block->escapeHtmlAttr($_option->getId()) ?> |
| 13 | +<?php $inputName = 'bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']' ?> |
| 14 | +<?php $dataValidation = 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . |
| 15 | + $block->escapeHtmlAttr($_option->getId()) . ']"]:checked\'}"' ?> |
| 16 | + |
11 | 17 | <div class="field option <?= ($_option->getRequired()) ? ' required': '' ?>"> |
12 | 18 | <label class="label"> |
13 | 19 | <span><?= $block->escapeHtml($_option->getTitle()) ?></span> |
14 | 20 | </label> |
15 | 21 | <div class="control"> |
16 | 22 | <div class="nested options-list"> |
17 | | - <?php if ($block->showSingle()) : ?> |
| 23 | + <?php if ($block->showSingle()): ?> |
18 | 24 | <?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?> |
19 | 25 | <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selections[0]) ?> |
20 | 26 | <input type="hidden" |
21 | 27 | class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> product bundle option" |
22 | 28 | name="bundle_option[<?= $block->escapeHtml($_option->getId()) ?>]" |
23 | 29 | value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"/> |
24 | | - <?php else :?> |
25 | | - <?php foreach ($_selections as $_selection) : ?> |
| 30 | + <?php else: ?> |
| 31 | + <?php foreach ($_selections as $selection): ?> |
| 32 | + <?php $sectionId = $selection->getSelectionId() ?> |
26 | 33 | <div class="field choice"> |
27 | | - <input class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> checkbox product bundle option change-container-classname" |
28 | | - id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>" |
| 34 | + <input class="<?=/* @noEscape */ $inputClass ?> change-container-classname" |
| 35 | + id="<?=/* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId)?>" |
29 | 36 | type="checkbox" |
30 | | - <?php if ($_option->getRequired()) { echo 'data-validate="{\'validate-one-required-by-name\':\'input[name^="bundle_option[' . $block->escapeHtmlAttr($_option->getId()) . ']"]:checked\'}"'; } ?> |
31 | | - name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]" |
32 | | - data-selector="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]" |
33 | | - <?php if ($block->isSelected($_selection)) { echo ' checked="checked"'; } ?> |
34 | | - <?php if (!$_selection->isSaleable()) { echo ' disabled="disabled"'; } ?> |
35 | | - value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"/> |
| 37 | + <?php if ($_option->getRequired()): ?> |
| 38 | + <?= /* @noEscape */ $dataValidation ?> |
| 39 | + <?php endif;?> |
| 40 | + name="<?=/* @noEscape */ $inputName .'['. $block->escapeHtmlAttr($sectionId)?>]" |
| 41 | + data-selector="<?= /* @noEscape */ $inputName.'['.$block->escapeHtmlAttr($sectionId)?>]" |
| 42 | + <?php if ($block->isSelected($selection)): ?> |
| 43 | + <?= ' checked="checked"' ?> |
| 44 | + <?php endif; ?> |
| 45 | + <?php if (!$selection->isSaleable()): ?> |
| 46 | + <?= ' disabled="disabled"' ?> |
| 47 | + <?php endif; ?> |
| 48 | + value="<?= $block->escapeHtmlAttr($sectionId) ?>" |
| 49 | + data-errors-message-box="#validation-message-box"/> |
36 | 50 | <label class="label" |
37 | | - for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"> |
38 | | - <span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span> |
| 51 | + for="<?= /* @noEscape */ $inputId . '-' . $block->escapeHtmlAttr($sectionId) ?>"> |
| 52 | + <span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($selection) ?></span> |
39 | 53 | <br/> |
40 | | - <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?> |
| 54 | + <?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($selection) ?> |
41 | 55 | </label> |
42 | 56 | </div> |
43 | 57 | <?php endforeach; ?> |
44 | 58 | <div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div> |
| 59 | + <div id="validation-message-box"></div> |
45 | 60 | <?php endif; ?> |
46 | 61 | </div> |
47 | 62 | </div> |
|
0 commit comments