Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #193 from isaaceindhoven/fix/avoid-api-exceptions-…
Browse files Browse the repository at this point in the history
…for-empty-product-template-ids

Avoid API Exceptions for empty product template ids
  • Loading branch information
Hnto authored Nov 3, 2021
2 parents c477e35 + 2b241db commit 8d52c40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Block/Catalog/Product/ProductList/Related/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function aroundGetItems(Related $subject, Closure $proceed)
if (!$this->config->isRecommendationsEnabled(Config::RECOMMENDATION_TYPE_CROSSSELL)) {
return $proceed();
}
if (!$this->templateFinder->forProduct($subject->getProduct(), $this->getType())) {
return $proceed();
}

try {
return $this->getCollection();
Expand Down
3 changes: 3 additions & 0 deletions Block/Catalog/Product/ProductList/Upsell/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public function aroundGetItemCollection(Upsell $subject, Closure $proceed)
if (!$this->config->isRecommendationsEnabled(Config::RECOMMENDATION_TYPE_UPSELL)) {
return $proceed();
}
if (!$this->templateFinder->forProduct($subject->getProduct(), $this->getType())) {
return $proceed();
}

try {
return $this->getCollection();
Expand Down

0 comments on commit 8d52c40

Please sign in to comment.