Pageviews and Latest Products Summary

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 1, 2010   (RSS)

By mark99 - November 1, 2010

Quick question, it'd be nice to output a couple of simply lists from the data.

For example, I'd like to be able to display a simply summary list of the "Latest Product Additions" or "Latest Product Edits" and it'd also be good if the system could track pageviews for each of my products so that I could then output something like "Most Popular Products" (i.e. a top 10).

The 'Latest' additions list would only need to show basic details like the Product Name, Date Added and Category. It would be the same for 'Latest' product edits, except replacing 'Date Added' with 'Date last edited' (newest at the top). The Top 10 would be the same but would have to factor in pageviews to weight any output.

Is this something that CMS Builder can do yet?

Re: [mark99] Pageviews and Latest Products Summary

By Jason - November 1, 2010

Hi,

You could show a list of products that have recently been changed by sorting on the updatedDate field. You could show the top 10 by using a query that would look like this:

EXAMPLE:
list($updatedRecords,$updatedMetaDate)=getRecords(array(
'tableName' => 'products'
'allowSearch' => false,
'limit' => 10,
'orderBy' => 'updatedDate DESC',
));


As for the "Most Popular" option, you would need to do a little more work. If you're tracking how many times the detail page is being viewed, you would need to add a field where you would store the number of times that product has been viewed. Next, on your detail page, you would need to add code to increment that field each time the page loads. Finally, you could alter the query above to sort by your new field instead of the updatedDate field.

Hope this helps get you started. Let me know if you have any other questions.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/