I'd like to simply add a new-order class to an order row (or field, which seems simpler) if an order was placed in the last day.
For testing, I haven't moved anything to an overridden class, I'm simply working directly in the app/code/core/Mage/Adminhtml/Widget/Block/Grid/Column/Renderer/Longtext.php class just to get it working.
I have it basically set up how I like, but my logic is applying the class to all rows instead of just those I specify. I feel like I'm missing something simple. Here's some code:
class Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Longtext extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
// ...native code
if ($this->getColumn()->getId() == 'real_order_id') {
// realized this is available already with $row->getData()
// $order = Mage::getModel('sales/order')->loadByIncrementId($text);
$yesterday = strtotime("-1 day", Mage::getModel('core/date')->gmtTimestamp());
$yesterday = Mage::getModel('core/date')->date(null, $yesterday);
if ($row->getCreatedAt() > $yesterday) {
$this->getColumn()->setColumnCssClass('new-order');
};
}
return $text;
}
}
When I make the call to setColumnCssClass() from here, it sets the data properly in the getData() object, but it is adding it for all rows; however, it is not actually applying that CSS class to the column.