Showing results for 
Search instead for 
Did you mean: 

Cron Job To Update Position Value Based On Sales

Cron Job To Update Position Value Based On Sales

I need someone to show me how to write a cron job that will adjust the "position" value of a product based on sales.  For example, the best selling product over a 90 day period has a value of 1 and a product which hasn't sold yes has a position of 99999.

Why ?  

I want to display the best selling products at the top of the page when "recommended" order by has been selected (which is the default value).


I guess the easiest way to do this is to rank the products based on sales quantity.  I could get technical and start adding in product profit and cash margin, but I will keep it simple for the moment and just use qty sold over an adjustable time period (which I will say is 90 days)


I don't know how to write a cron job, as I'm quite new to Magento.


Can someone show me an example of how to do this.