在Nop.Web.Controllers.ShoppingCartController.cs,功能PrepareShoppingCartModel:
using (profiler.Step("Picture"))
{
//picture
if (_shoppingCartSettings.ShowProductImagesOnShoppingCart)
{
var picture = _pictureService.GetPictureById(sci.ProductVariant.PictureId);
if (picture == null)
{
picture = _pictureService.GetPicturesByProductId(sci.ProductVariant.Product.Id, 1).FirstOrDefault();
}
cartItemModel.Picture = new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(picture, _mediaSetting.CartThumbPictureSize, true),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), cartItemModel.ProductName),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), cartItemModel.ProductName),
};
}
}
只需更改的,要開始部分:
var picture = _pictureService.GetPicturesByProductId(sci.ProductVariant.Product.Id, 1).FirstOrDefault();
謝謝SOOOO很多我從來沒有想到看看那裏。它效果很好 – scripter78