Skip to content

Commit a868b7e

Browse files
authored
Merge pull request #170 from renttek/master
Exclude non visible products from url regeneration
2 parents 8621db0 + 3c2f265 commit a868b7e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Model/RegenerateProductRewrites.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace OlegKoval\RegenerateUrlRewrites\Model;
1212

13+
use Magento\Catalog\Model\Product\Visibility;
1314
use OlegKoval\RegenerateUrlRewrites\Helper\Regenerate as RegenerateHelper;
1415
use Magento\Framework\App\ResourceConnection;
1516
use Magento\Catalog\Model\ResourceModel\Product\ActionFactory as ProductActionFactory;
@@ -265,6 +266,7 @@ protected function _getProductsCollection($productsFilter = [], $storeId = 0)
265266
->addAttributeToSelect('visibility')
266267
->addAttributeToSelect('url_key')
267268
->addAttributeToSelect('url_path')
269+
->addAttributeToFilter('visibility', ['neq' => Visibility::VISIBILITY_NOT_VISIBLE])
268270
// use limit to avoid a "eating" of a memory
269271
->setPageSize($this->productsCollectionPageSize);
270272

@@ -274,4 +276,4 @@ protected function _getProductsCollection($productsFilter = [], $storeId = 0)
274276

275277
return $productsCollection;
276278
}
277-
}
279+
}

0 commit comments

Comments
 (0)