27
27
* @method \Magento\Sitemap\Model\Sitemap setStoreId(int $value)
28
28
* @SuppressWarnings(PHPMD.TooManyFields)
29
29
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
31
+ * @SuppressWarnings(PHPMD.CamelCasePropertyName)
32
+ * @SuppressWarnings(PHPMD.CamelCaseMethodName)
30
33
*/
31
34
class Sitemap extends \Magento \Framework \Model \AbstractModel
32
35
{
@@ -448,7 +451,7 @@ protected function _isSplitRequired($row)
448
451
* @param null|string $lastmod
449
452
* @param null|string $changefreq
450
453
* @param null|string $priority
451
- * @param null|array $images
454
+ * @param null|array|\Magento\Framework\DataObject $images
452
455
* @return string
453
456
* Sitemap images
454
457
* @see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=178636
@@ -473,7 +476,7 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr
473
476
// Add Images to sitemap
474
477
foreach ($ images ->getCollection () as $ image ) {
475
478
$ row .= '<image:image> ' ;
476
- $ row .= '<image:loc> ' . htmlspecialchars ($ this -> _getMediaUrl ( $ image ->getUrl () )) . '</image:loc> ' ;
479
+ $ row .= '<image:loc> ' . htmlspecialchars ($ image ->getUrl ()) . '</image:loc> ' ;
477
480
$ row .= '<image:title> ' . htmlspecialchars ($ images ->getTitle ()) . '</image:title> ' ;
478
481
if ($ image ->getCaption ()) {
479
482
$ row .= '<image:caption> ' . htmlspecialchars ($ image ->getCaption ()) . '</image:caption> ' ;
@@ -483,9 +486,7 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr
483
486
// Add PageMap image for Google web search
484
487
$ row .= '<PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail"> ' ;
485
488
$ row .= '<Attribute name="name" value=" ' . htmlspecialchars ($ images ->getTitle ()) . '"/> ' ;
486
- $ row .= '<Attribute name="src" value=" ' . htmlspecialchars (
487
- $ this ->_getMediaUrl ($ images ->getThumbnail ())
488
- ) . '"/> ' ;
489
+ $ row .= '<Attribute name="src" value=" ' . htmlspecialchars ($ images ->getThumbnail ()) . '"/> ' ;
489
490
$ row .= '</DataObject></PageMap> ' ;
490
491
}
491
492
@@ -591,6 +592,7 @@ protected function _getBaseDir()
591
592
*/
592
593
protected function _getStoreBaseUrl ($ type = \Magento \Framework \UrlInterface::URL_TYPE_LINK )
593
594
{
595
+ /** @var \Magento\Store\Model\Store $store */
594
596
$ store = $ this ->_storeManager ->getStore ($ this ->getStoreId ());
595
597
$ isSecure = $ store ->isUrlSecure ();
596
598
return rtrim ($ store ->getBaseUrl ($ type , $ isSecure ), '/ ' ) . '/ ' ;
@@ -612,12 +614,13 @@ protected function _getUrl($url, $type = \Magento\Framework\UrlInterface::URL_TY
612
614
* Get media url
613
615
*
614
616
* @param string $url
615
- * @return string $url
617
+ * @return string
616
618
* @deprecated No longer used, as we're generating product image URLs inside collection instead
619
+ * @see \Magento\Sitemap\Model\ResourceModel\Catalog\Product::_loadProductImages()
617
620
*/
618
621
protected function _getMediaUrl ($ url )
619
622
{
620
- return $ url ;
623
+ return $ this -> _getUrl ( $ url, \ Magento \ Framework \UrlInterface:: URL_TYPE_MEDIA ) ;
621
624
}
622
625
623
626
/**
0 commit comments