Hello
I have a product, how do I know the list of manufacturers?
Each product is associated with a single manufacturer. When I view a category, I want to print the manufacturer for each product.
Thanks so much
@model ProductOverviewModel
@using Nop.Core
@using Nop.Core.Domain.Orders
@using Nop.Core.Domain.Tax
@using Nop.Core.Infrastructure
@using Nop.Web.Models.Catalog;
@model ProductOverviewModel
@using Nop.Core
@using Nop.Core.Domain.Orders
@using Nop.Core.Domain.Tax
@using Nop.Core.Infrastructure
@using Nop.Services.Catalog
@using Nop.Web.Extensions
@using Nop.Web.Models.Catalog;
@helper RenderProductManufacturers()
{
var productManufacturers = EngineContext.Current.Resolve<IManufacturerService>()
.GetProductManufacturersByProductId(Model.Id)
.Select(i => i.Manufacturer.ToModel())
.ToList();
if (!productManufacturers.Any())
{
return;
}
<div class="manufacturers">
@if (productManufacturers.Count == 1)
{
<span class="label">@T("Products.Manufacturer"):</span>
}
else
{
<span class="label">@T("Products.Manufacturers"):</span>
}
<span class="value">
@for (int i = 0; i < productManufacturers.Count; i++)
{
var item = productManufacturers[i];
<a href="@Url.RouteUrl("Manufacturer", new { SeName = item.SeName })">@item.Name</a>
if (i != productManufacturers.Count - 1)
{
<span class="separator">,</span>
}
}
</span>
</div>
}
<div class="product-item" data-productid="@Model.Id">