How to get Manufacturer Along with product on category pages

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 年 前
I want to get Manufacturer only Name,Logo ( custom field) on the catalog product pages.
Please point to the faster route to use so no delays on the page load.
1 年 前
To do this:

Add this to the ProductOverviewModel class.

public IList<ManufacturerBriefInfoModel> ProductManufacturers { get; set; }


Add this inside  PrepareProductOverviewModelsAsync;

ProductManufacturers=await PrepareProductManufacturerModelsAsync(product)


So will be like below:

var model = new ProductOverviewModel
                {
                    Id = product.Id,
                    Name = await _localizationService.GetLocalizedAsync(product, x => x.Name),
                    ShortDescription = await _localizationService.GetLocalizedAsync(product, x => x.ShortDescription),
                    FullDescription = await _localizationService.GetLocalizedAsync(product, x => x.FullDescription),
                    SeName = await _urlRecordService.GetSeNameAsync(product),
                    Sku = product.Sku,
                    ProductType = product.ProductType,
                    Image1 = product.Image1,
                    Image2 = product.Image2,
                    Image3 = product.Image3,
                    MarkAsNew = product.MarkAsNew &&
                        (!product.MarkAsNewStartDateTimeUtc.HasValue || product.MarkAsNewStartDateTimeUtc.Value < DateTime.UtcNow) &&
                        (!product.MarkAsNewEndDateTimeUtc.HasValue || product.MarkAsNewEndDateTimeUtc.Value > DateTime.UtcNow),
                    ProductManufacturers=await PrepareProductManufacturerModelsAsync(product)
                };


Now you can access manufacture on any page the ProductOverviewModel  goes to.

SO on _productbox you can access it using:

Model.ProductManufacturers.


Now you can show Manufacturer along any listing.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.