Skip to content

Commit

Permalink
Merge pull request #22 from magento-commerce/develop
Browse files Browse the repository at this point in the history
MCLOUD-9275: Cloud Tools Release
  • Loading branch information
BaDos authored Sep 9, 2022
2 parents 68ab097 + 1b96b9c commit 2e67b6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Model/UrlFinder/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Magento\CloudComponents\Model\UrlFinder;

use Magento\Catalog\Model\Product\Visibility as ProductVisibility;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\CloudComponents\Model\UrlFinderInterface as CloudUrlFinderInterface;
Expand Down Expand Up @@ -43,6 +44,11 @@ class Product implements CloudUrlFinderInterface
*/
private $productCollectionFactory;

/**
* @var ProductVisibility
*/
private $productVisibility;

/**
* @var integer
*/
Expand All @@ -51,19 +57,22 @@ class Product implements CloudUrlFinderInterface
/**
* @param UrlFixer $urlFixer
* @param CollectionFactory $productCollectionFactory
* @param ProductVisibility $productVisibility
* @param StoreInterface[] $stores
* @param array $productSku
* @param int $productLimit
*/
public function __construct(
UrlFixer $urlFixer,
CollectionFactory $productCollectionFactory,
ProductVisibility $productVisibility,
array $stores,
array $productSku = [],
int $productLimit = self::PRODUCT_LIMIT
) {
$this->urlFixer = $urlFixer;
$this->productCollectionFactory = $productCollectionFactory;
$this->productVisibility = $productVisibility;
$this->stores = $stores;
$this->productSku = $productSku;
$this->productLimit = $productLimit;
Expand Down Expand Up @@ -100,6 +109,7 @@ private function getProducts($storeId): Collection
/** @var Collection $collection */
$collection = $this->productCollectionFactory->create();
$collection->addStoreFilter($storeId);
$collection->setVisibility($this->productVisibility->getVisibleInSiteIds());

if (count($this->productSku)) {
$collection->addAttributeToFilter('sku', $this->productSku);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/magento-cloud-components",
"description": "Cloud Components Module for Magento 2.x",
"type": "magento2-module",
"version": "1.0.11",
"version": "1.0.12",
"require": {
"php": "^7.2 || ^8.0",
"ext-json": "*",
Expand Down

0 comments on commit 2e67b6d

Please sign in to comment.