【发布时间】:2014-03-05 06:22:19
【问题描述】:
我正在使用 NopCommerce。我想找到特定类别的前 10 名最受欢迎的产品。
为此,我创建了名为 ProductViewDetails 的新表。我想将“产品”表与此表连接以存储产品查看次数。
那么,我怎样才能获得特定产品的 ff 浏览量?
【问题讨论】:
标签: c# asp.net-mvc nopcommerce
我正在使用 NopCommerce。我想找到特定类别的前 10 名最受欢迎的产品。
为此,我创建了名为 ProductViewDetails 的新表。我想将“产品”表与此表连接以存储产品查看次数。
那么,我怎样才能获得特定产品的 ff 浏览量?
【问题讨论】:
标签: c# asp.net-mvc nopcommerce
您需要编写逻辑来增加关注 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
}
【讨论】: