Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add store id to retrieve localized content from category repository #22212

Closed
wants to merge 1 commit into from

Conversation

mirkocesaro
Copy link

Description

This commit solves an issue with the anchor category url generation.
To generate the anchor category url, data is retrieved by category repository without specifying proper store id. Doing so, the generated url does not use the localized category name into request path.

Manual testing scenarios

  1. We assume we are working with Magento with one website and (at least) two storeviews:
  • store ID: 1 (default)
  • store ID: 2
  1. Create an anchor category "test" (let say it has id 456) under Default Category with different url key for the storeviews:
  • url_key for store 1 : test-foo
  • url_key for store 2 : test-bar
  1. Create a child category of "test" named "test child" and assign one product whose url_key is for exaple: "my-product" (let say id 123)

Expected result:
In the url_rewrite table we exepct to find the following rows:

entity_type|entity_id|target_path                             |request_path            |store_id|
-----------|---------|----------------------------------------|------------------------|--------|
product    |123      |catalog/product/view/id/123/category/456|test-foo/my-product.html|1       |
product    |123      |catalog/product/view/id/123/category/456|test-bar/my-product.html|2       |

Actual result:

entity_type|entity_id|target_path                             |request_path            |store_id|
-----------|---------|----------------------------------------|------------------------|--------|
product    |123      |catalog/product/view/id/123/category/456|test-foo/my-product.html|1       |
product    |123      |catalog/product/view/id/123/category/456|test-foo/my-product.html|2       |

as we can see the request_path value for the second row (store_id 2) is not as expected

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

This commit solves an issue with the anchor category url generation.
To generate the anchor category url, data is retrieved by category repository without specifying  proper store id. Doing so, the generated url does not use the localized category name into request path.
@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2019

Hi @mirkocesaro. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Apr 8, 2019

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @phoenix128, thank you for the review.
ENGCOM-4701 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@mirkocesaro thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@hostep
Copy link
Contributor

hostep commented Apr 8, 2019

Thanks for the PR @mirkocesaro

But we already have two competing PR's with the exact same changes:

@phoenix128, we should probably close this PR as a duplicate, right?

@sivaschenko
Copy link
Member

Hi @mirkocesaro , thanks for the pull request! However, I have to close it as it's a duplicate to #20826

@m2-assistant
Copy link

m2-assistant bot commented Apr 10, 2019

Hi @mirkocesaro, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants