Page 1 of 1

Who's on line? Show product names?

Posted: Sat May 30, 2009 5:03 pm
by William M
In Reports > Who's on Line, is there a way to get the product name instead of

/Product.aspx?ProductId=49&CategoryId=7

This is tough to decipher at the end of a long day.

Re: Who's on line? Show product names?

Posted: Mon Jun 01, 2009 4:31 am
by mazhar
Try following trick edit your Admin/People/Users/ViewHistoryDialog.ascx.cs file and change GetUri(object dataItem) method as below

Code: Select all

protected string GetUri(object dataItem)
    {
        PageView pageView = (PageView)dataItem;
        
        if(pageView.CatalogNodeType == CatalogNodeType.Product)
            return pageView.CatalogNode.Name;
        
        if (!string.IsNullOrEmpty(pageView.UriQuery))
        {
            if (pageView.UriQuery.Contains("ProductId"))
            {
                string uriQuery = pageView.UriQuery;
                uriQuery = uriQuery.Replace("ProductId=",string.Empty);
                int index = uriQuery.IndexOf("&");
                int productId = 0;
                if (index < 0)
                    productId = AlwaysConvert.ToInt(uriQuery);
                else
                {
                    string pid = uriQuery.Substring(0, index + 1);
                    productId = AlwaysConvert.ToInt(pid);
                }
                Product product = ProductDataSource.Load(productId);
                if (product != null)
                    return product.Name;
            }
                
            return pageView.UriStem + "<wbr>?" + pageView.UriQuery.Replace("&", "<wbr>&").Replace("%", "<wbr>%");
        }
        else return pageView.UriStem;
    }