Skip to content

Commit 7e8f972

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/MAGETWO-54197' into bugfixes
2 parents 6176951 + 6245922 commit 7e8f972

File tree

2 files changed

+54
-0
lines changed
  • app/code/Magento/ConfigurableProduct

2 files changed

+54
-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 © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\ConfigurableProduct\Block\Adminhtml\Order\Create;
7+
8+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
9+
10+
class Sidebar
11+
{
12+
/**
13+
* Get item qty
14+
*
15+
* @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject
16+
* @param \Closure $proceed
17+
* @param \Magento\Framework\DataObject $item
18+
* @return string
19+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
20+
*/
21+
public function aroundGetItemQty(
22+
\Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject,
23+
\Closure $proceed,
24+
\Magento\Framework\DataObject $item
25+
) {
26+
if ($item->getProduct()->getTypeId() == Configurable::TYPE_CODE) {
27+
return '';
28+
}
29+
return $proceed($item);
30+
}
31+
32+
/**
33+
* Check whether product configuration is required before adding to order
34+
*
35+
* @param \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar $subject
36+
* @param \Closure $proceed
37+
* @param string $productType
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 == Configurable::TYPE_CODE) {
47+
return true;
48+
}
49+
return $proceed($productType);
50+
}
51+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<type name="Magento\Catalog\Model\Product\Validator">
1717
<plugin name="configurable" type="Magento\ConfigurableProduct\Model\Product\Validator\Plugin" sortOrder="50" />
1818
</type>
19+
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar">
20+
<plugin name="configurable" type="Magento\ConfigurableProduct\Block\Adminhtml\Order\Create\Sidebar" sortOrder="200"/>
21+
</type>
1922
<type name="Magento\ConfigurableProduct\Block\Adminhtml\Product\Attribute\Edit\Tab\Variations\Main">
2023
<arguments>
2124
<argument name="inputTypeFactory" xsi:type="object">Magento\Catalog\Model\System\Config\Source\InputtypeFactory</argument>

0 commit comments

Comments
 (0)