Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Return URL Rewrites for products #84

@paliarush

Description

@paliarush

As a Magento developer, I want GraphQL to return enough data so I can construct category-inclusive product urls so I can render context-aware product links on category pages and support the built-in "use categories path for product URLs" feature.

products query already supports canonical URL for products, this URL is returned as if it was generated by search with no category added to the URL. For example https://magento.store/some-product.html.

Sometimes it makes sense to have category added as part of SEO friendly URL, for example https://magento.store/some-category/some-product.html. It can be useful while rendering links to products from the specific category page.

AC:

  • Add url_rewrites: ![UrlRewrite] field to ProductInterface GraphQL type
  • UrlRewrite GraphQL type should have the following fields:
    • url: String
    • parameters: [HttpQueryParameter]. HttpQueryParameter type should have fields:
      • name: String
      • value: String
  • It should be possible to reuse the same types and resolvers for other entities in the future, e.g. for categories or CMS pages
  • Redirect rewrites must be excluded from the response (see rewrites grid in the admin panel for more info)
  • Modularity should be taken into account and new dependencies between modules should not be introduced. ProductInterface schema should be modified via changes in Magento/CatalogUrlRewriteGraphQl module
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions