1

Magento 2 admin dashboard > Catalog > Products > then select all products and click on update attributes,

gives some error. Please check the screenshot below.

Product page

Below is the code of ***inventory.phtml* file**

 <?php

    /** @var Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Inventory $block */
    ?>
    <script>
        require(['jquery'], function($){
            $('[data-role=toggle-editability-all]').change(function(e) {
                var toggler = $(this);
                var field = toggler.parents('.field');
                var someEditable = $('input[type!="checkbox"], select, textarea', field);
                var someEditableCheckboxes = $('input[type="checkbox"]', field).not(toggler);
                if(someEditableCheckboxes.length){
                    someEditable.prop('disabled', !toggler.prop('checked') || someEditableCheckboxes.prop('checked'));
                    someEditableCheckboxes.prop('disabled', !toggler.prop('checked'));
                } else {
                    someEditable.prop('disabled', !toggler.prop('checked'));
                }
            });
            $('[data-role=toggle-editability]').change(function(e) {
                var useConfigSettings = $(this);
                var field = useConfigSettings.parents('.field');
                var someEditable = $('input[type!="checkbox"], select, textarea', field);
                someEditable.prop('disabled', useConfigSettings.prop('checked'));
            });
        });
    </script>

    <?php
    $defaultMinSaleQty = $block->getDefaultConfigValue('min_sale_qty');
    if (!is_numeric($defaultMinSaleQty)) {
        $defaultMinSaleQty = json_decode($defaultMinSaleQty, true);
        $defaultMinSaleQty = (float) $defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1;
    }
    ?>
    <div class="fieldset-wrapper form-inline advanced-inventory-edit">
        <div class="fieldset-wrapper-title">
            <strong class="title">
                <span><?= $block->escapeHtml(__('Advanced Inventory')) ?></span>
            </strong>
        </div>
        <div class="fieldset-wrapper-content">
            <fieldset class="fieldset" id="table_cataloginventory">
            <div class="field">
                <label class="label" for="inventory_manage_stock">
                    <span><?= $block->escapeHtml(__('Manage Stock')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <select id="inventory_manage_stock" name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[manage_stock]"
                                    class="select" disabled="disabled">
                                <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option>
                                <option value="0"
                                    <?php if ($block->getFieldValue('manage_stock') == 0) :?>
                                        selected="selected"
                                    <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option>
                            </select>
                        </div>
                        <div class="field choice">
                            <input name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox"
                                   id="inventory_use_config_manage_stock" data-role="toggle-editability" value="1"
                                   checked="checked" disabled="disabled"/>
                            <label for="inventory_use_config_manage_stock"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_manage_stock_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_manage_stock_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field required">
                <label class="label" for="inventory_qty">
                    <span><?= $block->escapeHtml(__('Qty')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text required-entry validate-number" id="inventory_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty]"
                                   value="<?= $block->getDefaultConfigValue('qty') * 1 ?>" disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_qty_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_qty_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field with-addon">
                <label class="label" for="inventory_min_qty">
                    <span><?= $block->escapeHtml(__('Out-of-Stock Threshold')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text validate-number" id="inventory_min_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_qty]"
                                   value="<?= $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_use_config_min_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_qty]" value="1"
                                   data-role="toggle-editability" checked="checked" disabled="disabled"/>
                            <label for="inventory_use_config_min_qty" class="label">
                                <span><?= $block->escapeHtml(__('Use Config Settings')) ?></span>
                            </label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_min_qty_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_min_qty_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_min_sale_qty">
                    <span><?= $block->escapeHtml(__('Minimum Qty Allowed in Shopping Cart')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text validate-number" id="inventory_min_sale_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[min_sale_qty]"
                                   value="<?= $defaultMinSaleQty * 1 ?>"
                                   disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_use_config_min_sale_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_min_sale_qty]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_min_sale_qty"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_min_sale_qty_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_min_sale_qty_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_max_sale_qty">
                    <span><?= $block->escapeHtml(__('Maximum Qty Allowed in Shopping Cart')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text validate-number" id="inventory_max_sale_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[max_sale_qty]"
                                   value="<?= $block->getDefaultConfigValue('max_sale_qty') * 1 ?>"
                                   disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox"
                                   id="inventory_use_config_max_sale_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_max_sale_qty]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_max_sale_qty"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_max_sale_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_max_sale_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_is_qty_decimal">
                    <span><?= $block->escapeHtml(__('Qty Uses Decimals')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <select id="inventory_is_qty_decimal"
                                    name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_qty_decimal]"
                                    class="select"
                                    disabled="disabled">
                                <option value="0"><?= $block->escapeHtml(__('No')) ?></option>
                                <option value="1"
                                    <?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1) :?>
                                        selected="selected"
                                    <?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option>
                            </select>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_is_qty_decimal_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_is_qty_decimal_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_backorders">
                    <span><?= $block->escapeHtml(__('Backorders')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <select id="inventory_backorders"
                                    name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[backorders]"
                                    class="select"
                                    disabled="disabled">
                                <?php foreach ($block->getBackordersOption() as $option) :?>
                                    <?php $_selected = ($option['value'] == $block->getDefaultConfigValue('backorders')) ? ' selected="selected"' : '' ?>
                                    <option
                                        value="<?= $block->escapeHtmlAttr($option['value']) ?>"<?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_use_config_backorders"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_backorders]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_backorders"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_backorders_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_backorders_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>

                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_notify_stock_qty">
                    <span><?= $block->escapeHtml(__('Notify for Quantity Below')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text validate-number" id="inventory_notify_stock_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[notify_stock_qty]"
                                   value="<?= $block->getDefaultConfigValue('notify_stock_qty') * 1 ?>"
                                   disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox"
                                   id="inventory_use_config_notify_stock_qty"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_notify_stock_qty]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_notify_stock_qty"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_notify_stock_qty_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_notify_stock_qty_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_enable_qty_increments">
                    <span><?= $block->escapeHtml(__('Enable Qty Increments')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <select id="inventory_enable_qty_increments"
                                    name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[enable_qty_increments]"
                                    class="select"
                                    disabled="disabled">
                                <option value="1"><?= $block->escapeHtml(__('Yes')) ?></option>
                                <option value="0"
                                    <?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0) :?>
                                        selected="selected"
                                    <?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option>
                            </select>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_use_config_enable_qty_increments"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_enable_qty_increments]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_enable_qty_increments"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_enable_qty_increments_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_enable_qty_increments_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_qty_increments">
                    <span><?= $block->escapeHtml(__('Qty Increments')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <input type="text" class="input-text validate-number" id="inventory_qty_increments"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[qty_increments]"
                                   value="<?= $block->getDefaultConfigValue('qty_increments') * 1 ?>"
                                   disabled="disabled"/>
                        </div>
                        <div class="field choice">
                            <input type="checkbox"
                                   id="inventory_use_config_qty_increments"
                                   name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_qty_increments]"
                                   value="1"
                                   data-role="toggle-editability"
                                   checked="checked"
                                   disabled="disabled"/>
                            <label for="inventory_use_config_qty_increments"
                                   class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_qty_increments_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_qty_increments_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>

            <div class="field">
                <label class="label" for="inventory_stock_availability">
                    <span><?= $block->escapeHtml(__('Stock Availability')) ?></span>
                </label>

                <div class="control">
                    <div class="fields-group-2">
                        <div class="field">
                            <select id="inventory_stock_availability"
                                    name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_in_stock]" class="select"
                                    disabled="disabled">
                                <option value="1"><?= $block->escapeHtml(__('In Stock')) ?></option>
                                <option value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0) :?> selected<?php endif; ?>><?= $block->escapeHtml(__('Out of Stock')) ?></option>
                            </select>
                        </div>
                        <div class="field choice">
                            <input type="checkbox" id="inventory_stock_availability_checkbox" data-role="toggle-editability-all"/>
                            <label for="inventory_stock_availability_checkbox"
                                   class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
                        </div>
                    </div>
                </div>
                <div class="field-service" value-scope="<?= $block->escapeHtmlAttr(__('[GLOBAL]')) ?>"></div>
            </div>
            </fieldset>
        </div>
    </div>

1 Answer 1

5

I'm facing same error in Magento 2.3.3

main.CRITICAL: Notice: Undefined offset: 32000 in vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml on line 36

Quick fix for this is to add minimum stock Qty allowed in Shopping Cart:

Stores -> Configuration -> Catalog -> Inventory -> Minimum Qty Allowed in Shopping Cart

I set All Groups to 1

After this I was able to edit selected products. (options are loading)

Related with some PR on dev magento github:

https://github.com/magento/magento2/pull/21643

https://github.com/magento/magento2/pull/19095

1
  • 1
    32000 is the constant value for "All Groups", defined in vendor/magento/module-customer/Api/Data/GroupInterface.php. The error occurs because there is no configured minimum sale quantity where one is expected (but not supplied by default).
    – jiheison
    Commented Jan 21, 2020 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.