15 use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory;
32 private $categoryRepository;
61 $anchorCategoryIds =
$category->getAnchorsAbove();
62 if ($anchorCategoryIds) {
63 foreach ($anchorCategoryIds as $anchorCategoryId) {
64 $anchorCategory = $this->categoryRepository->get($anchorCategoryId);
65 $urls[] = $this->urlRewriteFactory->create()
69 $this->urlPathGenerator->getUrlPathWithSuffix(
76 $this->urlPathGenerator->getCanonicalUrlPath(
82 ->setMetadata([
'category_id' => $anchorCategory->getId()]);
__construct(ProductUrlPathGenerator $urlPathGenerator, UrlRewriteFactory $urlRewriteFactory, CategoryRepositoryInterface $categoryRepository)
generate($storeId, Product $product, ObjectRegistry $productCategories)