Skip to content

Commit

Permalink
Fix to ignored the product don't have combinable
Browse files Browse the repository at this point in the history
  • Loading branch information
hungmac-sw committed Jul 1, 2022
1 parent ad4a1c1 commit a2799a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 1.1.0 - Erweiterung
- [Issue #1](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/1) Zeige auch Varianten, die nicht auf Lager sind
- [Issue #2](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/2) Ausblenden von geteilten Varianten
- [Issue #6](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/6) Ignoriert, dass das Produkt nicht kombinierbar ist

# 1.0.0 - Erste Veröffentlichung
- Variantenschalter auf der Produktliste anzeigen
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 1.1.0 - Enhancement
- [Issue #1](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/1) Show also variants which are out of stock
- [Issue #2](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/2) Hide split variants
- [Issue #6](https://github.com/Shape-and-Shift/shopware-variant-switch/issues/6) Ignored the product don't have combinable

# 1.0.0 - First release
- Show variant switch on product listing card
Expand Down
7 changes: 7 additions & 0 deletions src/Storefront/Page/ProductListingConfigurationLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function loadListing(ProductCollection $products, SalesChannelContext $co
}));

$allCombinations = $this->loadCombinations($productIds, $context->getContext());
if (\count($allCombinations) === 0) {
return;
}

/** @var SalesChannelProductEntity $product */
foreach ($products as $product) {
Expand All @@ -58,6 +61,10 @@ public function loadListing(ProductCollection $products, SalesChannelContext $co

$groups = $this->sortSettings($productSetting, $product);

if (!array_key_exists($product->getParentId(), $allCombinations)) {
continue;
}

$combinations = $allCombinations[$product->getParentId()];

$current = $this->buildCurrentOptions($product, $groups);
Expand Down

0 comments on commit a2799a6

Please sign in to comment.