2014-03-05 40 views
0

我正在使用NopCommerce。我想查找特定類別的前10名最受歡迎產品。
爲此我創建了一個名爲ProductViewDetails的新表。我想用此表加入「產品」表以存儲產品查看次數。如何在NopCommerce中獲得產品查看次數?

那麼,如何獲得特定產品的ff視圖數?

回答

2

你需要編寫邏輯在以下action

public ActionResult Product(int productId) 
     { 
     _productViewService.IncreaseViewCount(productId); 
} 

在服務增加產品的查看次數,你需要編寫實際的邏輯來提高觀看次數

public virtual void IncreaseViewCount(int pId) 
{ 
    //here get entry for product view details if exists or create new one 
    //then increase count by 1 
} 
相關問題