diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Order/Create/Sidebar.php b/app/code/Magento/Bundle/Block/Adminhtml/Order/Create/Sidebar.php new file mode 100644 index 0000000000000000000000000000000000000000..12a3d48d20c4bf596652cdd1635bfe27584cef67 --- /dev/null +++ b/app/code/Magento/Bundle/Block/Adminhtml/Order/Create/Sidebar.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Bundle\Block\Adminhtml\Order\Create; + +class Sidebar +{ + /** + * Get item qty + * + * @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject + * @param callable $proceed + * @param \Magento\Framework\DataObject $item + * + * @return string + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundGetItemQty( + \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject, + \Closure $proceed, + \Magento\Framework\DataObject $item + ) { + if ($item->getProduct()->getTypeId() == \Magento\Bundle\Model\Product\Type::TYPE_CODE) { + return ''; + } + return $proceed($item); + } + + /** + * Check whether product configuration is required before adding to order + * + * @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject + * @param callable $proceed + * @param string $productType + * + * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundIsConfigurationRequired( + \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject, + \Closure $proceed, + $productType + ) { + if ($productType == \Magento\Bundle\Model\Product\Type::TYPE_CODE) { + return true; + } + return $proceed($productType); + } +} diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 65742f76f261fc8d391bc992d7d56db848307148..2270f6cb149eb9dc14c15bc097824673cad24bc8 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -19,6 +19,11 @@ use Magento\Framework\Pricing\PriceCurrencyInterface; */ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType { + /** + * Product type + */ + const TYPE_CODE = 'bundle'; + /** * Product is composite * diff --git a/app/code/Magento/Bundle/etc/adminhtml/di.xml b/app/code/Magento/Bundle/etc/adminhtml/di.xml index 0270ff9164b5980aa8c6b8b62c32bcea0e21a628..91970a4cdd9f3a145faff60f4d877bcba563ceda 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/di.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/di.xml @@ -9,6 +9,9 @@ <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper"> <plugin name="Bundle" type="Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle" sortOrder="60" /> </type> + <type name="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar"> + <plugin name="Bundle" type="Magento\Bundle\Block\Adminhtml\Order\Create\Sidebar" sortOrder="200"/> + </type> <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> <arguments> <argument name="constructors" xsi:type="array">