質問

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