Skip to content

Commit 2fcb2bb

Browse files
MAGETWO-67010: [Performance] Swatches real server side optimization
1 parent a0363f5 commit 2fcb2bb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ public function hasOptions()
143143
public function getAllowProducts()
144144
{
145145
if (!$this->hasAllowProducts()) {
146+
$products = [];
146147
$skipSaleableCheck = $this->catalogProduct->getSkipSaleableCheck();
147-
148-
if ($skipSaleableCheck) {
149-
$products = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null);
150-
} else {
151-
$products = $this->getProduct()->getTypeInstance()->getSalableUsedProducts($this->getProduct(), null);
148+
$allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null);
149+
foreach ($allProducts as $product) {
150+
if ($product->isSaleable() || $skipSaleableCheck) {
151+
$products[] = $product;
152+
}
152153
}
153-
154154
$this->setAllowProducts($products);
155155
}
156156
return $this->getData('allow_products');

0 commit comments

Comments
 (0)