Cartridge Best Selling products

59 views
Skip to first unread message

Josh B

unread,
Jun 12, 2013, 2:28:10 PM6/12/13
to mezzani...@googlegroups.com
We are currently batting around the idea of how to show best selling products on one of the sites we are building. Thought I would throw out the couple directions we have thought of and see if anyone else has a better idea.

Option 1:
Cron job that runs nightly going through all of the new orders looking at SKUs and quantity. 
Store it in a BestSelling table that would consist of product id & total sold number.
Create a template tag that would display the products

Option 1.1:
Cron job that runs nightly going through all of the new orders looking at SKUs and quantity. 
Cached object instead of a database table
Create a template tag that would display the products

Option 2:
Add a field on the product or product variation that gets incremented every time that product is purchased.
Create a template tag that would display the products

Option 3:
Create a template tag that would do all of the look ups, cache it and do the products 


Stephen McDonald

unread,
Jun 12, 2013, 3:01:22 PM6/12/13
to mezzani...@googlegroups.com
Hey Josh, 

Option 2 has actually always existed in Cartridge since day 1, it's just that nothing actually makes use of the recorded data.

Have a look at the ProductAction model and ProductActionManager:


They allow for things like variation.product.added_to_cart() and variation.product.purchased(), which each increment values on their respective fields. These are already being called in the relevant spots:


So theoretically the data is all there. Would love to see something done with it, and have that provided in Cartridge by default, as this was always the intention.




--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Stephen McDonald
http://jupo.org

Stephen McDonald

unread,
Jun 12, 2013, 3:07:51 PM6/12/13
to mezzani...@googlegroups.com
Sorry my comment was slightly off - a value doesn't get incremented, a record gets created. That way it has a timestamp, so time-series reports could be created from the data stored.

Josh B

unread,
Jun 13, 2013, 11:39:47 AM6/13/13
to mezzani...@googlegroups.com, st...@jupo.org
Awesome, looked into it and started writing something. In your eyes should this be a manager to return the list or just a template tag?

Josh

Stephen McDonald

unread,
Jun 13, 2013, 4:34:30 PM6/13/13
to mezzani...@googlegroups.com
I guess both would be useful, with the template tag making use of the manager.
Reply all
Reply to author
Forward
0 new messages