Most viewed Products
Most viewed Products
Is there a plugin or a way to display the most viewed products of the website somewhere on a page ? Kind of like featured products but the top 5 or so with the most page views overall.
Re: Most viewed Products
Take a look at the PopularProductsDialog ConLib control.
Re: Most viewed Products
This is for top sells though, I want most views?
Re: Most viewed Products
Sorry, I didn't read your question very closely.
Plugables has a free control called AlsoBought. (see forum post viewtopic.php?f=25&t=14179&p=60969&hili ... ght#p60969)
You can change their SQL query from:
to
and you should now have a list of the top viewed products that are currently visible on your site. You can remove the join with the ac_Products table if you don't care if the products are currently available.
Do note that the number of days that records stay in the ac_PageViews table is controlled by Page Tracking history value in the AC admin. Also be aware that running this query a lot may have a performance impact on your site.
Plugables has a free control called AlsoBought. (see forum post viewtopic.php?f=25&t=14179&p=60969&hili ... ght#p60969)
You can change their SQL query from:
Code: Select all
DbCommand selectCommand = database.GetSqlStringCommand("SELECT DISTINCT TOP "+MaxItems.ToString()+" OI.ProductId FROM ac_OrderItems AS OI WHERE OI.OrderId IN ( SELECT OrderId FROM ac_OrderItems WHERE ProductId = @ProductId ) AND OI.ProductId <> @ProductId1 ORDER BY OI.ProductID DESC");
//database.AddInParameter(selectCommand, "@MaxItems", System.Data.DbType.Int32, MaxItems);
database.AddInParameter(selectCommand, "@ProductId", System.Data.DbType.Int32,productId);
database.AddInParameter(selectCommand, "@ProductId1", System.Data.DbType.Int32, productId);
Code: Select all
DbCommand selectCommand = database.GetSqlStringCommand("select top "+MaxItems.ToString()+" p.ProductId from ac_Products p join ac_PageViews pv on p.ProductId = pv.CatalogNodeId where pv.CatalogNodeTypeId = 1 and p.VisibilityId = 0 group by p.productid order by COUNT(*) desc");
Do note that the number of days that records stay in the ac_PageViews table is controlled by Page Tracking history value in the AC admin. Also be aware that running this query a lot may have a performance impact on your site.