Reputation: 121
I am having trouble referencing a product image on my NopCommerce site.
i have changed the default slim box gallery to a booklet style gallery. i have managed to reference the 1st product image by inserting the code:
into the correct view. i now need to reference the 2nd product image on the 2nd page of my booklet.
so far i have:
added a definition in the catalog controller of:
model.PictureModel.Page2Url = _pictureService.GetPictureUrl(productVariant.PictureId, _mediaSettings.ProductVariantPictureSize, false);
I have also added this to the picture model:
public string Page2Url { get; set; }
after this i inserted this code:
Page2Url = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), _mediaSettings.ProductDetailsPictureSize),
into the catalog controller under where the 1st image is referenced. this is now as the code says it should, referencing the 1st product image again. what do i need to change to get it to call the 2nd product image?
My site is:
Egiftingwizard.com
Upvotes: 2
Views: 799
Reputation: 126
You can try skip, take in linq to take the 2nd product image. Try this
Page2Url = _pictureService.GetPictureUrl(pictures.Skip(1).Take(1), _mediaSettings.ProductDetailsPictureSize)
Upvotes: 3