I want to fetch product collection sorted in desc order of created date and filter it out if the special price end date is lower than current date.
I am able to sort it using this code.
if ($this->getCurrentOrder()) {
if(($this->getCurrentOrder())=='position'){
$this->_collection->setOrder('entity_id','desc');
} else {
$this->_collection->setOrder($this->getCurrentOrder(),$this->getCurrentDirection());
}
}
But I cant filter this out further with special price end date < today's date.
Can anyone help? I will really appreciate it.
Thanks.
Best Answer
The code above should allow only products that don't have an end date for the special price or if the end date is in the future.
[EDIT]
To add a filter for
special_from_date
you can add this after the code above