Description
Preconditions
Magento 2.2.5
PHP 7.1.20
Steps to reproduce.
- Add some values to «Catalog» → «Inventory» → «Product Stock Options» → «Minimum Qty Allowed in Shopping Cart».
- Flush cache.
- Go to the Catalog => Products
- Select some products in the list
- Select "Update attributes" in the action dropdown
Expected result
The form to update all available attributes should be shown.
Actual result
PHP throws an E_WARNING:
1 exception(s):
Exception #0 (Exception): Warning: A non-numeric value encountered in /var/www/foo.de/htdocs/shop/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml on line 135
Exception #0 (Exception): Warning: A non-numeric value encountered in /var/www/foo.de/htdocs/shop/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml on line 135
#0 /var/www/foo.de/htdocs/shop/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml(135): Magento\Framework\App\ErrorHandler->handler(2, 'A non-numeric v...', '/var/www/dev.bl...', 135, Array)
#1 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/dev.bl...')
#2 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Inventory), '/var/www/dev.bl...', Array)
#3 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView('/var/www/dev.bl...')
#4 /var/www/foo.de/htdocs/shop/vendor/magento/module-backend/Block/Template.php(124): Magento\Framework\View\Element\Template->_toHtml()
#5 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Backend\Block\Template->_toHtml()
#6 /var/www/foo.de/htdocs/shop/vendor/magento/module-backend/Block/Widget/Tabs.php(390): Magento\Framework\View\Element\AbstractBlock->toHtml()
#7 /var/www/foo.de/htdocs/shop/vendor/magento/module-backend/view/adminhtml/templates/widget/tabs.phtml(57): Magento\Backend\Block\Widget\Tabs->getTabContent(Object(Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Inventory))
#8 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/dev.bl...')
#9 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tabs), '/var/www/dev.bl...', Array)
#10 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView('/var/www/dev.bl...')
#11 /var/www/foo.de/htdocs/shop/vendor/magento/module-backend/Block/Template.php(124): Magento\Framework\View\Element\Template->_toHtml()
#12 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Backend\Block\Template->_toHtml()
#13 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(558): Magento\Framework\View\Element\AbstractBlock->toHtml()
#14 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(534): Magento\Framework\View\Layout->_renderBlock('attributes_tabs')
#15 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('attributes_tabs')
#16 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('attributes_tabs')
#17 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('attributes_tabs', true)
#18 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('attributes_tabs')
#19 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('left')
#20 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('left')
#21 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('left')
#22 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('left', true)
#23 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('left')
#24 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('side.col')
#25 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('side.col')
#26 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('side.col')
#27 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('side.col', true)
#28 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('side.col')
#29 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('page.main.conta...')
#30 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.main.conta...')
#31 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.conta...')
#32 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.main.conta...', true)
#33 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('page.main.conta...')
#34 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('page.content')
#35 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.content')
#36 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content')
#37 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.content', true)
#38 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('page.content')
#39 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#40 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#41 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#42 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#43 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#44 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('backend.page')
#45 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('backend.page')
#46 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page')
#47 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('backend.page', true)
#48 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('backend.page')
#49 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('root')
#50 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#51 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#52 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#53 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Layout.php(954): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#54 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/View/Layout/Interceptor.php(492): Magento\Framework\View\Layout->getOutput()
#55 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Result/Page.php(257): Magento\Framework\View\Layout\Interceptor->getOutput()
#56 /var/www/foo.de/htdocs/shop/vendor/magento/framework/View/Result/Layout.php(170): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#57 /var/www/foo.de/htdocs/shop/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#58 /var/www/foo.de/htdocs/shop/vendor/magento/framework/App/Http.php(139): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#59 /var/www/foo.de/htdocs/shop/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#60 /var/www/foo.de/htdocs/shop/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#61 /var/www/foo.de/htdocs/shop/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#62 {main}
Root cause
Min quantity is an array and not an integer value as the UI suggests:
Therefore this code fails:
File: vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
<input type="text" class="input-text validate-number" id="inventory_min_qty"
name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_qty]"
value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('min_qty') * 1 ?>" disabled="disabled"/>
Workaround
Remove the * 1
from the mentioned code.