this is what i am trying to do ! i want to filter my results on the basis of end date mean if end date is less then the current date then display the result else do not.
public function getAllEvents() {
$all_events = Mage::getModel('events/events')->getCollection()
->addAttributeToFilter('end_date', array('lt' => date(strtotime(getdate()),'YYYY-MM-dd HH:mm:ss'))
->setOrder('start_date', 'ASC')
->getData();
return $all_events;
}
but am getting this error on frontend when i try to get the result $this->getAllEvents();
Parse error: syntax error, unexpected T_OBJECT_OPERATOR please help
You are missing a ) on the following line:
->addAttributeToFilter('end_date', array('lt' => date(strtotime(getdate()),'YYYY-MM-dd HH:mm:ss'))
Add another ) and you should be all set.