File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
app/code/Magento/PageBuilder/Plugin/Catalog/Block/Product Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 12
12
use Magento \Catalog \Model \Category ;
13
13
use Magento \CatalogInventory \Helper \Stock ;
14
14
use Magento \Catalog \Api \CategoryRepositoryInterface ;
15
+ use Magento \Framework \Exception \NoSuchEntityException ;
15
16
16
17
/**
17
18
* Catalog Products List widget block plugin
@@ -54,7 +55,6 @@ public function __construct(
54
55
* @param \Magento\CatalogWidget\Block\Product\ProductsList $subject
55
56
* @param \Magento\Catalog\Model\ResourceModel\Product\Collection $result
56
57
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
57
- * @throws \Magento\Framework\Exception\NoSuchEntityException
58
58
*/
59
59
public function afterCreateCollection (
60
60
\Magento \CatalogWidget \Block \Product \ProductsList $ subject ,
@@ -66,7 +66,14 @@ public function afterCreateCollection(
66
66
$ this ->stock ->addIsInStockFilterToCollection ($ result );
67
67
68
68
if (!empty ($ categoryId )) {
69
- $ result ->addCategoryFilter ($ this ->categoryRepository ->get ($ categoryId ));
69
+ try {
70
+ $ category = $ this ->categoryRepository ->get ($ categoryId );
71
+ } catch (NoSuchEntityException $ noEntityException ) {
72
+ $ category = null ;
73
+ }
74
+ if ($ category ) {
75
+ $ result ->addCategoryFilter ($ category );
76
+ }
70
77
}
71
78
72
79
if (!empty ($ sortOption )) {
You can’t perform that action at this time.
0 commit comments