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

sitemap image URLs do not match with those on product pages #7504

Closed
maderlock opened this issue Nov 21, 2016 · 4 comments
Closed

sitemap image URLs do not match with those on product pages #7504

maderlock opened this issue Nov 21, 2016 · 4 comments
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@maderlock
Copy link

This is currently stopping product images from being correctly indexed by google, which is a serious problem for our clients.

Preconditions

  1. Mageneto 2.1.2

Steps to reproduce

  1. Create a product and add an image.
  2. Generate a sitemap

Expected result

  1. img src on product page will match image:loc in sitemap

Actual result

  1. They do not match

The problem here is that google will not index the images from the sitemap as it the URLs do not match up.

However, I have struggled to make these match up. gallery.phtml outputs the image as follows:

$imageUrl = $this->helper('Magento\Catalog\Helper\Image')
            ->init($block->getProduct(), 'product_page_image_large')
            ->setImageFile($block->getImageFile())
            ->getUrl();

The sitemap gets the image url directly from the product attribute not really consecutive lines, but taken from module-sitemap/Model/Sitemap.php:

foreach ($this->_productFactory->create()->getCollection($storeId) as $item) {
$images = $item->getImages();
foreach ($images->getCollection() as $image) {
...
$row .= '<image:loc>' . htmlspecialchars($this->_getMediaUrl($image->getUrl())) . '</image:loc>';

The problem here is that $this->_productFactory->create()->getCollection($storeId) gets an array rather than the actual products. Therefore I do not think we can use this with the image helper.

Any thoughts on how to fix this issue?

@maderlock
Copy link
Author

I'm going to attempt a fix. My current thought is that we'll have to do full product loads, or at least via a collection, so that the image helper can be called. My concern is that this will slow this process down considerably, but at this point it's much more important that it's outputting the correct URLs.

@Andrii-Deineha
Copy link
Contributor

@maderlock Hi, thanks for reporting this issue. Internal ticket was created MAGETWO-70962.

@veloraven veloraven added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jul 24, 2017
@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-70056

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

@maderlock thank you for your report.
The fix for this issue is already available in release 2.2.0

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

5 participants