Skip to content

Commit 94e5c5d

Browse files
MAGETWO-67010: [Performance] Swatches real server side optimization
1 parent 0fca687 commit 94e5c5d

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
@@ -154,14 +154,14 @@ public function hasOptions()
154154
public function getAllowProducts()
155155
{
156156
if (!$this->hasAllowProducts()) {
157-
$products = [];
158157
$skipSaleableCheck = $this->catalogProduct->getSkipSaleableCheck();
159-
$allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null);
160-
foreach ($allProducts as $product) {
161-
if ($product->isSaleable() || $skipSaleableCheck) {
162-
$products[] = $product;
163-
}
158+
159+
if ($skipSaleableCheck) {
160+
$products = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null);
161+
} else {
162+
$products = $this->getProduct()->getTypeInstance()->getSalableUsedProducts($this->getProduct(), null);
164163
}
164+
165165
$this->setAllowProducts($products);
166166
}
167167
return $this->getData('allow_products');

0 commit comments

Comments
 (0)