Skip to content

Commit 71d33c2

Browse files
committed
Allow for loadedProducts array to be tuned better
1 parent 4071fc9 commit 71d33c2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Util/ProductProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,22 @@ public function getLoadedProducts(): array
5454
$loadedProductSkus = array_diff($this->productSkus, array_keys($this->loadedProducts));
5555
if (count($loadedProductSkus) > 0) {
5656
foreach ($this->loadProductsBySkus($loadedProductSkus) as $product) {
57-
$this->loadedProducts[$product->getSku()] = $product;
57+
$this->addProductToLoadedProducts($product);
5858
}
5959
}
6060

6161
return $this->loadedProducts;
6262
}
6363

64+
/**
65+
* @param ProductInterface $product
66+
* @return void
67+
*/
68+
public function addProductToLoadedProducts(ProductInterface $product): void
69+
{
70+
$this->loadedProducts[$product->getSku()] = $product;
71+
}
72+
6473
/**
6574
* @param string $sku
6675
* @return ProductInterface

0 commit comments

Comments
 (0)