manufacturer product

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 Jahre weitere
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
9 Jahre weitere
If you product object, just use following line to get manufactures of the product
product.ProductManufacturers 
9 Jahre weitere
svipla wrote:
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


Here you are :). A solution for "No_Source".

Following are steps to do it:
- Copy/paste "_ProductBox.cshtml" partial view to "Themes/DefaultClean/Views/Shared" folder.
- Add code to show product manufacturer(s)
- Restart application to take effect.
9 Jahre weitere
In the "Themes/DefaultClean/Views/Shared/_ProductBox.cshtml" partial view, add following blocks of code:

BLOCK 1:
---
BEFORE

@model ProductOverviewModel
@using Nop.Core
@using Nop.Core.Domain.Orders
@using Nop.Core.Domain.Tax
@using Nop.Core.Infrastructure
@using Nop.Web.Models.Catalog;

AFTER

@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;
9 Jahre weitere
BLOCK 2:
---
Place following code

@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>
}

above this code

<div class="product-item" data-productid="@Model.Id">
9 Jahre weitere
BLOCK 3:
---
Place following code

<!--product manufacturers-->
        @RenderProductManufacturers()

below this code

<div class="description">
            @Html.Raw(Model.ShortDescription)
        </div>

Hope this help :)
4 Jahre weitere
some know how to set this in .net core in nop 4.2. Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.