Skip to content

Commit 7c35d23

Browse files
author
Oleksandr Karpenko
committed
Merge remote-tracking branch 'origin/MAGETWO-44307' into BUGS
2 parents a1ad80e + 072db47 commit 7c35d23

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Bundle\Block\Adminhtml\Order\Create;
7+
8+
class Sidebar
9+
{
10+
/**
11+
* Get item qty
12+
*
13+
* @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject
14+
* @param callable $proceed
15+
* @param \Magento\Framework\DataObject $item
16+
*
17+
* @return string
18+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
19+
*/
20+
public function aroundGetItemQty(
21+
\Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject,
22+
\Closure $proceed,
23+
\Magento\Framework\DataObject $item
24+
) {
25+
if ($item->getProduct()->getTypeId() == \Magento\Bundle\Model\Product\Type::TYPE_CODE) {
26+
return '';
27+
}
28+
return $proceed($item);
29+
}
30+
31+
/**
32+
* Check whether product configuration is required before adding to order
33+
*
34+
* @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject
35+
* @param callable $proceed
36+
* @param string $productType
37+
*
38+
* @return bool
39+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
40+
*/
41+
public function aroundIsConfigurationRequired(
42+
\Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject,
43+
\Closure $proceed,
44+
$productType
45+
) {
46+
if ($productType == \Magento\Bundle\Model\Product\Type::TYPE_CODE) {
47+
return true;
48+
}
49+
return $proceed($productType);
50+
}
51+
}

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
*/
2020
class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
2121
{
22+
/**
23+
* Product type
24+
*/
25+
const TYPE_CODE = 'bundle';
26+
2227
/**
2328
* Product is composite
2429
*

app/code/Magento/Bundle/etc/adminhtml/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper">
1010
<plugin name="Bundle" type="Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle" sortOrder="60" />
1111
</type>
12+
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar">
13+
<plugin name="Bundle" type="Magento\Bundle\Block\Adminhtml\Order\Create\Sidebar" sortOrder="200"/>
14+
</type>
1215
<type name="Magento\Catalog\Model\Product\CopyConstructor\Composite">
1316
<arguments>
1417
<argument name="constructors" xsi:type="array">

0 commit comments

Comments
 (0)