Most viewed Products

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
BWalt302
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Oct 17, 2011 10:21 am

Most viewed Products

Post by BWalt302 » Mon Jan 09, 2012 4:40 pm

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.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Most viewed Products

Post by david-ebt » Mon Jan 09, 2012 7:14 pm

Take a look at the PopularProductsDialog ConLib control.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

BWalt302
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Oct 17, 2011 10:21 am

Re: Most viewed Products

Post by BWalt302 » Tue Jan 10, 2012 1:42 pm

This is for top sells though, I want most views?

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Most viewed Products

Post by david-ebt » Tue Jan 10, 2012 5:13 pm

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:

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);
to

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");
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.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Post Reply