Skip to content

Commit

Permalink
Merge pull request magento#773 from magento-engcom/MSI-683
Browse files Browse the repository at this point in the history
MSI-683: Bundled products work with Single Stock
  • Loading branch information
Valeriy Nayda authored Mar 27, 2018
2 parents c7a3a18 + 31b21fa commit 012c036
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\InventoryBundle\Plugin\InventoryConfiguration\IsSourceItemsAllowedForProductType;

use Magento\Bundle\Model\Product\Type as BundleType;
use Magento\InventoryConfiguration\Model\IsSourceItemsAllowedForProductTypeInterface;

/**
* Disable Source items management for Bundle product type.
*/
class DisableBundleTypePlugin
{
/**
* @param IsSourceItemsAllowedForProductType $subject
* @param callable $proceed
* @param string $productType
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function aroundExecute(
IsSourceItemsAllowedForProductTypeInterface $subject,
callable $proceed,
string $productType
): bool {
if ($productType === BundleType::TYPE_CODE) {
return false;
}

return $proceed($productType);
}
}
6 changes: 5 additions & 1 deletion app/code/Magento/InventoryBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"description": "N/A",
"require": {
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
"magento/framework": "100.3.*"
"magento/framework": "100.3.*",
"magento/module-bundle": "100.3.*"
},
"suggest": {
"magento/module-inventory-configuration": "100.0.*"
},
"type": "magento2-module",
"version": "100.0.0-dev",
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/InventoryBundle/etc/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\InventoryConfiguration\Model\IsSourceItemsAllowedForProductTypeInterface">
<plugin name="disable_bundle_type"
type="Magento\InventoryBundle\Plugin\InventoryConfiguration\IsSourceItemsAllowedForProductType\DisableBundleTypePlugin"/>
</type>
</config>
3 changes: 2 additions & 1 deletion app/code/Magento/InventoryBundle/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_InventoryBundle" setup_version="1.0.0" />
</config>

0 comments on commit 012c036

Please sign in to comment.