Skip to content

Commit 287b563

Browse files
committed
MAGETWO-60103: [Backport] Configurable variation is displayed on category/product page when is out of stock - 2.1
1 parent 10269d4 commit 287b563

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ public function isSalable($product)
812812
if (!is_null($product)) {
813813
$this->setStoreFilter($product->getStoreId(), $product);
814814
}
815-
$salable = (count($this->getSalableUsedProducts($product)) > 0) ? true : false;
815+
$salable = count($this->getSalableUsedProducts($product)) > 0;
816816
}
817817

818818
return $salable;

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Controller/CartTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*/
1010
namespace Magento\ConfigurableProduct\Controller;
1111

12+
use Magento\TestFramework\Helper\Bootstrap;
13+
use Magento\Catalog\Api\ProductRepositoryInterface;
14+
1215
class CartTest extends \Magento\TestFramework\TestCase\AbstractController
1316
{
1417
/**
@@ -21,7 +24,10 @@ public function testConfigureActionWithConfigurableProduct()
2124
/** @var $session \Magento\Checkout\Model\Session */
2225
$session = $this->_objectManager->create('Magento\Checkout\Model\Session');
2326

24-
$quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), 1);
27+
$productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class);
28+
$product = $productRepository->get('configurable');
29+
30+
$quoteItem = $this->_getQuoteItemIdByProductId($session->getQuote(), $product->getId());
2531
$this->assertNotNull($quoteItem, 'Cannot get quote item for configurable product');
2632

2733
$this->dispatch(

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/quote_with_configurable_product.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\TestFramework\Helper\Bootstrap;
99

1010
require 'product_configurable.php';
11+
/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
1112

1213
$productRepository = Bootstrap::getObjectManager()
1314
->create(ProductRepositoryInterface::class);

0 commit comments

Comments
 (0)