문제

I want to show most viewed category wise product in category home page using plugin at public store

I made a new plugin name is:Nop.Plugin.MostViewProduct.Product

I added model folder and write code in it that is below :

namespace Nop.Plugin.MostViewProduct.Product.Models {

public partial class MostViewProductModel : BaseNopModel
{
    [NopResourceDisplayName("MostViewProduct.ProductId")]
    [AllowHtml]
    public int ProductId { get; set; }

    [NopResourceDisplayName("MostViewProduct.ProductCount")]
    [AllowHtml]
    public int ProductCount { get; set; }

    public virtual Product Product { get; set; }

}

} and I got error when add public virtual Product Product { get; set;} and error is Nop.Plugin.MostviewProduct.Product is a 'namespace' but is used like a typed .i has already include namespace that is using Nop.Core.Domain.Catalog;

why it is generating an error?

thank you in advance.

도움이 되었습니까?

해결책

There is a conflict between the Nop.Plugin.MostViewProduct.Product namespace and the Nop.Core.Domain.Catalog.Product type. To resolve this, explicitly define which your property should use:

 public virtual Nop.Core.Domain.Catalog.Product Product { get; set; }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top