Skip to content

Commit 70df945

Browse files
committed
Merge branch 'ACP2E-2549' of https://github.com/magento-l3/magento2ce into Tier4-PR-01-02-2024
2 parents 0d41d9b + 51b8e2d commit 70df945

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function generateForGlobalScope($productCategories, Product $product, $ro
170170
$productId,
171171
Product::ENTITY
172172
)) {
173-
if (count($visibleForStores) == 0 || in_array((int)$id, $visibleForStores)) {
173+
if (count($visibleForStores) === 0 || in_array((int)$id, $visibleForStores)) {
174174
$mergeDataProvider->merge(
175175
$this->generateForSpecificStoreView(
176176
$id,
@@ -182,7 +182,7 @@ public function generateForGlobalScope($productCategories, Product $product, $ro
182182
);
183183
}
184184
} else {
185-
if (count($visibleForStores) == 0 || in_array((int)$id, $visibleForStores)) {
185+
if (count($visibleForStores) === 0 || in_array((int)$id, $visibleForStores)) {
186186
$scopedProduct = $this->productRepository->getById($productId, false, $id);
187187
$mergeDataProvider->merge(
188188
$this->generateForSpecificStoreView(

app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\CatalogUrlRewrite\Service\V1\StoreViewService;
1313
use Magento\Framework\App\ObjectManager;
1414
use Magento\Catalog\Model\Product\Visibility;
15+
use Magento\Store\Model\Store;
1516
use Magento\Store\Model\StoreManagerInterface;
1617

1718
/**
@@ -146,6 +147,7 @@ public function generate(Product $product, $rootCategoryId = null)
146147
if ($product->getVisibility() == Visibility::VISIBILITY_NOT_VISIBLE) {
147148
$visibleForStores = $this->visibleForStores->execute($product);
148149
if (count($visibleForStores) === 0 ||
150+
$product->getStoreId() !== Store::DEFAULT_STORE_ID &&
149151
!in_array($product->getStoreId(), $visibleForStores)
150152
) {
151153
return [];

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlRewriteGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function testGenerateForDefaultNonVisible()
170170
$productMock->expects($this->once())
171171
->method('getVisibility')
172172
->willReturn(Product\Visibility::VISIBILITY_NOT_VISIBLE);
173-
$productMock->expects($this->exactly(2))
173+
$productMock->expects($this->exactly(3))
174174
->method('getStoreId')
175175
->willReturn($storeId);
176176
$productCategoriesMock = $this->getMockBuilder(Collection::class)

0 commit comments

Comments
 (0)