Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cbe7292
Removed extra qty field from bundle configuration
konarshankar07 Oct 23, 2020
34e5a1b
Review changes
konarshankar07 Oct 23, 2020
3e559a9
Fixed static tests
konarshankar07 Oct 23, 2020
8e40ddb
Fixed MFTF test
konarshankar07 Nov 1, 2020
a65f764
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
engcom-Charlie Nov 9, 2020
9f706b5
MFTF fix
konarshankar07 Nov 9, 2020
867fd35
Merge branch 'removed-duplicate-qty-field--task-30306' of https://git…
konarshankar07 Nov 9, 2020
8708e12
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
konarshankar07 Nov 16, 2020
91b782b
MFTF fixes
konarshankar07 Nov 16, 2020
8037205
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
engcom-Charlie Nov 20, 2020
faf8072
Fixed MFTF test
konarshankar07 Nov 21, 2020
9c490cd
Merge branch 'removed-duplicate-qty-field--task-30306' of https://git…
konarshankar07 Nov 21, 2020
6ab587a
Quantity field added for the checkbox bundle items
konarshankar07 Dec 2, 2020
81ab347
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
engcom-Charlie Dec 7, 2020
4aaaed1
add qty field to `multiple select` input type
engcom-Charlie Dec 7, 2020
cd6d166
changed $block to $escaper
engcom-Charlie Jan 18, 2021
4551812
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
engcom-Charlie Jan 18, 2021
5ad46fd
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
engcom-Charlie Jan 20, 2021
cb6f8ff
Replaced deprecated escape function
konarshankar07 Jan 25, 2021
eb6d7bc
Replaced deprecated escape function
konarshankar07 Jan 25, 2021
0d03fda
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
ishakhsuvarov Nov 9, 2022
7e40036
Merge branch '2.4-develop' into removed-duplicate-qty-field--task-30306
ishakhsuvarov Nov 10, 2022
70280fc
Fixed static Test failure
engcom-Echo Nov 11, 2022
f432b29
Fixed failing MFTF test AdminCreateCreditmemoWithBundleProductTest
engcom-Echo Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<block class="Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox" name="product.info.bundle.options.checkbox" as="checkbox"/>
</block>
</referenceBlock>
<referenceBlock name="product.composite.fieldset.qty" remove="true"/>
</body>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,84 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

use Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox;
use Magento\Framework\Escaper;

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper

?>
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox */ ?>
<?php /* @var $block Checkbox */ ?>
<?php /* @var $escaper Escaper */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_selections = $_option->getSelections(); ?>
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>

<div class="field admin__field options<?php if ($_option->getRequired()) { echo ' _required'; } ?>">
<label class="label admin__field-label">
<span><?= $block->escapeHtml($_option->getTitle()) ?></span>
<span><?= $escaper->escapeHtml($_option->getTitle()) ?></span>
</label>

<div class="control admin__field-control">
<div class="nested <?php if ($_option->getDecoratedIsLast()) :?> last<?php endif;?>">
<div class="nested <?php if ($_option->getDecoratedIsLast()):?> last<?php endif;?>">

<?php if (count($_selections) == 1 && $_option->getRequired()) : ?>
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
<input type="hidden"
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else :?>
name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $escaper->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else:?>

<?php foreach ($_selections as $_selection) : ?>
<?php foreach ($_selections as $_selection): ?>
<div class="field choice admin__field admin__field-option">
<input
class="change-container-classname admin__control-checkbox checkbox bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?> <?php if ($_option->getRequired()) { echo 'validate-one-required-by-name'; } ?>"
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
class="change-container-classname admin__control-checkbox
checkbox bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>
<?php if ($_option->getRequired()) { echo 'validate-one-required-by-name'; } ?>"
id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-
<?= $escaper->escapeHtmlAttr($_selection->getSelectionId()) ?>"
type="checkbox"
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][<?= $block->escapeHtmlAttr($_selection->getId()) ?>]"
<?php if ($block->isSelected($_selection)) :?>
name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]
[<?= $escaper->escapeHtmlAttr($_selection->getId()) ?>]"
<?php if ($block->isSelected($_selection)):?>
<?= ' checked="checked"' ?>
<?php endif;?>
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) :?>
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck):?>
<?= ' disabled="disabled"' ?>
<?php endif;?>
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
value="<?= $escaper->escapeHtmlAttr($_selection->getSelectionId()) ?>"
onclick="ProductConfigure.bundleControl.changeSelection(this)"
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>" />
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>" />

<label class="admin__field-label"
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
for="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-
<?= $escaper->escapeHtmlAttr($_selection->getSelectionId()) ?>">
<span><?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection) ?></span>
</label>

<?php if ($_option->getRequired()) : ?>
<?= /* @noEscape */ $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?>
<?php if ($_option->getRequired()): ?>
<?= /* @noEscape */ $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') // phpcs:ignore?>
<?php endif;?>
</div>
<?php endforeach; ?>

<div id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-container"></div>
<div id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-container"></div>
<?php endif; ?>
</div>
</div>
</div>
<fieldset id="product_composite_configure_fields_qty"
class="fieldset product-composite-qty-block
admin__fieldset <?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>">
<div class="field admin__field">
<label class="label admin__field-label"><span><?= $escaper->escapeHtml(__('Quantity')) ?></span></label>
<div class="control admin__field-control">
<input id="product_composite_configure_input_qty"
class="input-text admin__control-text qty"
type="text" name="qty" value="<?= (int) $block->getQtyValue()?>">
</div>
</div>
</fieldset>

Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,57 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

use Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Multi;
use Magento\Framework\Escaper;

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
?>
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Multi */ ?>
<?php /* @var $block Multi */ ?>
<?php /* @var $escaper Escaper */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_selections = $_option->getSelections(); ?>
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
<div class="field admin__field <?php if ($_option->getRequired()) { echo ' _required'; } ?><?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?>">
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
<div class="field admin__field <?php if ($_option->getRequired()) { echo ' _required'; } ?>
<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>">
<label class="label admin__field-label"><span><?= $escaper->escapeHtml($_option->getTitle()) ?></span></label>
<div class="control admin__field-control">
<?php if (count($_selections) == 1 && $_option->getRequired()) : ?>
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selections[0]) ?>
<input type="hidden" name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else : ?>
<select multiple="multiple" size="5" id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>][]"
class="admin__control-multiselect bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> multiselect change-container-classname"
<input type="hidden" name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $escaper->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else: ?>
<select multiple="multiple" size="5" id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>"
name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>][]"
class="admin__control-multiselect bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>
<?php if ($_option->getRequired()) { echo ' required-entry'; } ?>
multiselect change-container-classname"
onchange="ProductConfigure.bundleControl.changeSelection(this)">
<?php if (!$_option->getRequired()) : ?>
<option value=""><?= $block->escapeHtml(__('None')) ?></option>
<?php if (!$_option->getRequired()): ?>
<option value=""><?= $escaper->escapeHtml(__('None')) ?></option>
<?php endif; ?>
<?php foreach ($_selections as $_selection) : ?>
<option value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
<?php foreach ($_selections as $_selection): ?>
<option value="<?= $escaper->escapeHtmlAttr($_selection->getSelectionId()) ?>"
<?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?>
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?>
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>">
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>">
<?= /* @noEscape */ $block->getSelectionQtyTitlePrice($_selection, false) ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
</div>
</div>
<fieldset id="product_composite_configure_fields_qty"
class="fieldset product-composite-qty-block admin__fieldset
<?= $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>">
<div class="field admin__field">
<label class="label admin__field-label"><span><?= $escaper->escapeHtml(__('Quantity')) ?></span></label>
<div class="control admin__field-control">
<input id="product_composite_configure_input_qty"
class="input-text admin__control-text qty"
type="text" name="qty" value="<?= (int) $block->getQtyValue() ?>">
</div>
</div>
</fieldset>
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,68 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
?>
<?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Select */ ?>
<?php /* @var $escaper \Magento\Framework\Escaper */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_selections = $_option->getSelections(); ?>
<?php $_default = $_option->getDefaultSelection(); ?>
<?php $_skipSaleableCheck = $this->helper(Magento\Catalog\Helper\Product::class)->getSkipSaleableCheck(); ?>
<?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?>

<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()) :?> last<?php endif; ?><?php if ($_option->getRequired()) { echo ' _required'; } ?>">
<label class="label admin__field-label"><span><?= $block->escapeHtml($_option->getTitle()) ?></span></label>
<div class="field admin__field option<?= $_option->getDecoratedIsLast() ? ' last' : '' ?>
<?= $_option->getRequired() ? ' _required' : '' ?>">
<label class="label admin__field-label"><span><?= $escaper->escapeHtml($_option->getTitle()) ?></span></label>
<div class="control admin__field-control">
<?php if ($block->showSingle()) : ?>
<?php if ($block->showSingle()): ?>
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selections[0]) ?>
<input type="hidden"
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $block->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else :?>
<select id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>"
name="bundle_option[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
class="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?><?php if ($_option->getRequired()) { echo ' required-entry'; } ?> select admin__control-select change-container-classname"
name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $escaper->escapeHtmlAttr($_selections[0]->getSelectionId()) ?>"
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selections[0])) ?>" />
<?php else: ?>
<select id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>"
name="bundle_option[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]"
class="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>
<?= $_option->getRequired() ? ' required-entry' : ''?>
select admin__control-select change-container-classname"
onchange="ProductConfigure.bundleControl.changeSelection(this)">
<option value=""><?= $block->escapeHtml(__('Choose a selection...')) ?></option>
<?php foreach ($_selections as $_selection) : ?>
<option value=""><?= $escaper->escapeHtml(__('Choose a selection...')) ?></option>
<?php foreach ($_selections as $_selection): ?>
<option
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
<?php if ($block->isSelected($_selection)) { echo ' selected="selected"'; } ?>
<?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { echo ' disabled="disabled"'; } ?>
price="<?= $block->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>"
qtyId="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
value="<?= $escaper->escapeHtmlAttr($_selection->getSelectionId()) ?>"
<?= $block->isSelected($_selection) ? ' selected="selected"' : '' ?>
<?= !$_selection->isSaleable() && !$_skipSaleableCheck ? ' disabled="disabled"' : '' ?>
price="<?= $escaper->escapeHtmlAttr($block->getSelectionPrice($_selection)) ?>"
qtyId="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-qty-input">
<?= /* @noEscape */ $block->getSelectionTitlePrice($_selection, false) ?>
</option>
<?php endforeach; ?>
</select>
<?php endif; ?>

<div class="nested">
<div class="field admin__field qty">
<label class="label admin__field-label"
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input">
<span><?= $block->escapeHtml(__('Quantity:')) ?></span>
</label>
<div class="control admin__field-control">
<input <?php if (!$_canChangeQty) { echo ' disabled="disabled"'; } ?>
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-qty-input"
class="input-text admin__control-text qty validate-greater-than-zero<?php if (!$_canChangeQty) { echo ' qty-disabled'; } ?>"
type="text"
name="bundle_option_qty[<?= $block->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $block->escapeHtmlAttr($_defaultQty) ?>" />
</div>
</div>
</div>
</div>
</div>
<fieldset class="fieldset product-composite-qty-block admin__fieldset">
<div class="field admin__field qty">
<label class="label admin__field-label"
for="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-qty-input">
<span><?= $escaper->escapeHtml(__('Quantity:')) ?></span>
</label>
<div class="control admin__field-control">
<input <?php if (!$_canChangeQty): ?>
<?= ' disabled="disabled"' ?>
<?php endif; ?>
id="bundle-option-<?= $escaper->escapeHtmlAttr($_option->getId()) ?>-qty-input"
class="input-text admin__control-text qty
validate-greater-than-zero
<?php if (!$_canChangeQty): ?>
<?= ' qty-disabled' ?>
<?php endif; ?>"
type="text"
name="bundle_option_qty[<?= $escaper->escapeHtmlAttr($_option->getId()) ?>]"
value="<?= $escaper->escapeHtmlAttr($_defaultQty) ?>" />
</div>
</div>
</fieldset>
Loading