Page 1 of 1

Recently Viewed Products Control is not working correctly

Posted: Fri Mar 14, 2008 11:42 am
by ayilmaz
Hi,
I have added the Recently Viewed Products control which is ConLib/RecentlyViewd.ascx. However the very recent product that I viewed shows up at the very bottom of the list not at the top. In the code behind the call to the datasource:

PageViewDataSource.GetRecentlyViewedProducts(userId, this.MaxItems, 0, "ActivityDate DESC")

is supposedly sorting the results descending by ActivityDate. I checked the database, the activity dates are being updated as pages are viewed however the last viewed page is showing up at the bottom.

Does this control work properly? Is anyone using it?

Thanks,
Ayilmaz

Posted: Fri Mar 14, 2008 11:59 am
by Shopping Cart Admin
Hello,

It's working just fine in my testing. Newest ones are showing up first in the list.

viewtopic.php?t=6073

Posted: Fri Mar 14, 2008 12:31 pm
by ayilmaz
I did not change any code in this control. I did not change the backend. How come it is not working?

My site's url is http://www.candlesandhomedecor.com
Would you like to see it yourself? Just click on a product and then click on a category link.

Any ideas? It is really bizarre...

Thanks,
Aylin

Posted: Fri Mar 14, 2008 3:07 pm
by ayilmaz
Hi Mike,
Did you get a chance to look at the website? Do you have any ideas, recommendations?
Thanks a lot,
Aylin

Posted: Fri Mar 14, 2008 5:03 pm
by jmestep
I looked at it and I guess you're going to have to stand on your head to see the most recent one first. :D

Posted: Fri Mar 14, 2008 8:33 pm
by ayilmaz
Thanks Judy :)

I ran the Sql Server Profiler to see the queries running, here is the query to get the top 5 products from ac_pageviews table.


SELECT DISTINCT TOP 5 CatalogNodeId, CatalogNodeTypeId FROM ( SELECT TOP 15
PageViewId,StoreId,ActivityDate,RemoteIP,RequestMethod,UserId,UriStem,UriQuery,TimeTaken,UserAgent,Referrer,CatalogNodeId,CatalogNodeTypeId,Browser,BrowserName,BrowserPlatform,BrowserVersion,AffiliateId FROM ac_PageViews WHERE StoreId
= 1 AND CatalogNodeTypeId = 1 AND UserId = 2 ORDER BY ActivityDate DESC ) ac_PageViews_1

Now, the inner query returns the correct order

Inner query:

SELECT TOP 15
PageViewId,StoreId,ActivityDate,RemoteIP,RequestMethod,UserId,UriStem,UriQuery,TimeTaken,UserAgent,Referrer,CatalogNodeId,CatalogNodeTypeId,Browser,BrowserName,BrowserPlatform,BrowserVersion,AffiliateId FROM ac_PageViews WHERE StoreId
= 1 AND CatalogNodeTypeId = 1 AND UserId = 2 ORDER BY ActivityDate DESC

However when the results are selected again using the outer query "SELECT DISTINCT TOP 5 CatalogNodeId, CatalogNodeTypeId FROM.. "
The order gets messed up.

The PROBLEM is that the outer query causes the results the be sorted by catalogNodeId.

I did not insert any data manually. I don't know why this is not working.

Why do we need the outer query?

Thanks,
Aylin

Posted: Fri Mar 14, 2008 11:00 pm
by AbleMods
Mine's never worked like I expected it should, so I pulled it long ago from my site.

From a technical standpoint, the queries are valid. 15 records based on pageview count are selected and returned in ascending order by activitydate. Then the top 5 of the most recent 15 records are returned.

The reasonable assumption (you, me and most everyone else) is the returned dataset will be actually be sorted in order of most recent first, which obviously it isn't. But the query is showing the top 5 most recently viewed records, it's just not sorting those final 5 records in order of recent-ness.

I agree the query seems unusually inefficient - especially for a control likely placed in a common area like a sidebar that'll get rendered on most every page hit to the site.

I suggest you post an Able support ticket with your profiler results and comments from your post - that'll give them the information they need to fix it. Nicely done with the profiler, I need to start using that more myself.

Oh and yes, recent-ness is a word. It's my word. Mine I tell you :wink:

Posted: Sat Mar 15, 2008 1:30 am
by ayilmaz
Thanks for the comment. I am glad to hear I am not the only one. I just submitted a ticket.

Posted: Sat Mar 15, 2008 1:36 am
by ayilmaz
Hey Joe,
BTW, I have checked out your website and have been reading your comments. First of all thanks a lot for all the contribution, they have been extremely helpful. I noticed that you have a live chat option on your webpage. How did you do that and is there an affiliate program that you are using? if you don't mind sharing.
Thanks,
Aylin

Posted: Sat Mar 15, 2008 8:29 am
by AbleMods
Thank you for the compliments :)

My livechat program is from Xigla.com. It works pretty well although I highly suggest NOT turning on the "real-time" feature as it absolutely slam your bandwidth. Otherwise, it worked incredibly well almost out of the box - like 10 minutes to integrate into AC7.

Only downside to Xigla.com stuff is the guy is *really* short with tech support responses in bad english. And he's a Javascript coder, so his ".Net" applications are just barely that - everything he does behind-the-scenes is java. His web site design is awesome but his programming is buggy. I hate code-behind in JS, especially when it's not documented well.

I've never used an affiliate program - not entirely sure what they do. I am using the Affiliates feature in AC7 to do some simplistic campaign tracking.

Re: Recently Viewed Products Control is not working correctly

Posted: Sun Oct 05, 2008 9:49 am
by bryancapitano
Hi,

We'd like to enable this Recently Viewed module in an AbleCommerce store we're building. Can somebody tell me, where do we go to enable this module?

Thanks,

Re: Recently Viewed Products Control is not working correctly

Posted: Sun Oct 05, 2008 10:13 am
by AbleMods
AC7 includes a user control that provides the recently viewed functionality.

To add it to your site, simply edit a scriptlet (most people use a sidebar scriptlet) and add the line [[ConLib:RecentlyViewed]].

You can use the integrated ConLib Reference available on the Admin Help menu to see what parameters are available.