Skip to content

#15588 Fixed incorrect image urls in multistore xml sitemap #15689

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

Merged
merged 7 commits into from
Jun 7, 2018

Conversation

StevenGuapaBV
Copy link
Contributor

@StevenGuapaBV StevenGuapaBV commented Jun 2, 2018

Description

Added the appEmulation to get the correct image Url for the generated sitemaps. This was needed because the catalog image helper context had incorrect Url data.

Fixed Issues (if relevant)

  1. Images in XML sitemap are always linked to base store in multistore #15588: Images in XML sitemap are always linked to base store in multistore#15588

Manual testing scenarios

  1. In a multistore environment generate multiple sitemaps. Check if the image:loc has the correct base URL for set store.

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)

Added the appEmulation to get the correct image Url for the generated sitemaps. Context had incorrect Url data.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jun 2, 2018

CLA assistant check
All committers have signed the CLA.

 48 | ERROR | [x] Opening parenthesis of a multi-line function call must be the last content on the line
@JeroenVanLeusden
Copy link
Member

Might be smart to wrap this in a try, catch block to make sure emulation is stopped when an exception occurs. Like: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/ProductAlert/Block/Product/ImageProvider.php#L62-L67

@magento-engcom-team
Copy link
Contributor

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

$sitemap->generateXml();
$this->appEmulation->stopEnvironmentEmulation();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned by @JeroenVanLeusden I think it would be a good idea to make sure we are stopping this emulation in all cases including exception cases. #15689 (comment)

placed the stop Emulation in a finally. Now it will always be executed.
@StevenGuapaBV
Copy link
Contributor Author

Hi @dmanners and @JeroenVanLeusden. I changed the logic and put the stop in a finally. Is that okay as well? Seems to make more sense than a try catch in a try catch block.

A finally will always be executed and the stop emulation does not throw an exception of its own.

@magento-engcom-team
Copy link
Contributor

Hi @StevenGuapaBV. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.2.6 release.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

@StevenGuapaBV
Copy link
Contributor Author

Hi @magento-engcom-team,

I made the forwardport for the 2.3 release line via the porting tool. This should be done now.

@sidolov sidolov mentioned this pull request Jun 22, 2018
4 tasks
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.

7 participants