Magento Forum

need to get products close to “today”
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Hello - I have a product set with a custom attribute “event_date”
I need to be able to pull “upcoming” products

I would like to either:
1) sort by date / attribute but only grab ones that are close to today (ones in the future, but closest to today’s date...) - most like via “getModel(’catalog/products’)…

or

2) Sort by date attribute within a .phtml file.

I was hoping magento might have a useful way to accomplish number 1, otherwise I need to find a PHP way to sort through a product collection and reorganize based on a custom attribute!

Anyone have any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Looks like i’ll have to sort by date attribute via the .phtml template file I’m using...I was hoping for a “faster” solution (via sql...hoping magento had something that would handle this in their Model?? - but I don’t have a clear enough understanding of how their Model retrieves info from the DB yet)

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top