Pageviews and Latest Products Summary

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

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/