Images are in the Blog's RSS. They are not in the New Products RSS.
(Which RSS are you concerned with?)
public ActionResult RecentlyAddedProductsRss()
{
var feed = new SyndicationFeed(
string.Format("{0}: Recently added products", _storeContext.CurrentStore.Name),
"Information about products",
new Uri(_webHelper.GetStoreLocation(false)),
"RecentlyAddedProductsRSS",
DateTime.UtcNow);
if (!_catalogSettings.RecentlyAddedProductsEnabled)
return new RssActionResult() { Feed = feed };
var items = new List<SyndicationItem>();
var products = _productService.SearchProducts(
storeId: _storeContext.CurrentStore.Id,
orderBy: ProductSortingEnum.CreatedOn,
pageSize: _catalogSettings.RecentlyAddedProductsNumber);
foreach (var product in products)
{
string productUrl = Url.RouteUrl("Product", new { SeName = product.GetSeName() }, "http");
var item = new SyndicationItem(product.GetLocalized(x => x.Name), product.GetLocalized(x => x.ShortDescription), new Uri(productUrl), String.Format("RecentlyAddedProduct:{0}", product.Id), product.CreatedOnUtc);
var pictures = _pictureService.GetPicturesByProductId(product.Id);
if (pictures.Count > 0)
{
var imageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), _mediaSettings.ProductDetailsPictureSize);
item.ElementExtensions.Add(
new XElement("enclosure", new XAttribute("type", "image/jpeg"), new XAttribute("url", imageUrl)).CreateReader()
);
}
items.Add(item);
}
feed.Items = items;
return new RssActionResult() { Feed = feed };
}
public ActionResult RecentlyAddedProductsRss()
{
var feed = new SyndicationFeed(
string.Format("{0}: Recently added products", _storeContext.CurrentStore.Name),
"Information about products",
new Uri(_webHelper.GetStoreLocation(false)),
"RecentlyAddedProductsRSS",
DateTime.UtcNow);
if (!_catalogSettings.RecentlyAddedProductsEnabled)
return new RssActionResult() { Feed = feed };
var items = new List<SyndicationItem>();
var products = _productService.SearchProducts(
storeId: _storeContext.CurrentStore.Id,
orderBy: ProductSortingEnum.CreatedOn,
pageSize: _catalogSettings.RecentlyAddedProductsNumber);
foreach (var product in products)
{
string productUrl = Url.RouteUrl("Product", new { SeName = product.GetSeName() }, "http");
var item = new SyndicationItem(product.GetLocalized(x => x.Name), product.GetLocalized(x => x.ShortDescription), new Uri(productUrl), String.Format("RecentlyAddedProduct:{0}", product.Id), product.CreatedOnUtc);
var pictures = _pictureService.GetPicturesByProductId(product.Id);
if (pictures.Count > 0)
{
var imageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), _mediaSettings.ProductDetailsPictureSize);
item.ElementExtensions.Add(
new XElement("enclosure", new XAttribute("type", "image/jpeg"), new XAttribute("url", imageUrl)).CreateReader()
);
}
items.Add(item);
}
feed.Items = items;
return new RssActionResult() { Feed = feed };
}
public ActionResult RecentlyAddedProductsRss()
{
var feed = new SyndicationFeed(
string.Format("{0}: Recently added products", _storeContext.CurrentStore.Name),
"Information about products",
new Uri(_webHelper.GetStoreLocation(false)),
"RecentlyAddedProductsRSS",
DateTime.UtcNow);
if (!_catalogSettings.RecentlyAddedProductsEnabled)
return new RssActionResult() { Feed = feed };
var items = new List<SyndicationItem>();
var products = _productService.SearchProducts(
storeId: _storeContext.CurrentStore.Id,
orderBy: ProductSortingEnum.CreatedOn,
pageSize: _catalogSettings.RecentlyAddedProductsNumber);
foreach (var product in products)
{
string productUrl = Url.RouteUrl("Product", new { SeName = product.GetSeName() }, "http");
var item = new SyndicationItem(product.GetLocalized(x => x.Name), product.GetLocalized(x => x.ShortDescription), new Uri(productUrl), String.Format("RecentlyAddedProduct:{0}", product.Id), product.CreatedOnUtc);
var pictures = _pictureService.GetPicturesByProductId(product.Id);
if (pictures.Count > 0)
{
var imageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), _mediaSettings.ProductDetailsPictureSize);
item.ElementExtensions.Add(
new XElement("enclosure", new XAttribute("type", "image/jpeg"), new XAttribute("url", imageUrl)).CreateReader()
);
}
items.Add(item);
}
feed.Items = items;
return new RssActionResult() { Feed = feed };
}