With the knowledge I've learned here from my recent Magento upgrade and ensuing fixing, please help me with one of my biggest UI gripes: the date. It is stupid:
I hacked the core file app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
and changed '100px' to '165px', which prevents the date from wrapping. I'd really love to change the date from 'M n, Y g:i:s A' to something like Gmail uses 'g:i:s a' if today or 'M n, ga' if not today. I'd add in the year if the year of the date to be displayed wasn't the current year.
I saw Overriding Magento Admin Controller, for Beginners, which might be enough for me to override _prepareColumns()
in the core file, but I'd really like to find out how to change that date! BTW, I grepped the whole install and no part of that date format string shows up.
Update: found that the date string format is set in lib/Zend/Locale/Data/root.xml
and may be overridden if your locale is something other than en_us, whose file is empty. To expound upon the first part of R.S's answer, the date "format" is not php date()
style, which I tried and got quite strange results. Perusing the Locale XML files, I made a few experiments, which are here:
$this->addColumn('created_at', array(
'header' => Mage::helper('sales')->__('Purchased On'),
'index' => 'created_at',
'type' => 'datetime',
'format' => 'MMM d, h:mm a', // Feb 18, 1:57 PM
//'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM),
//'format' => 'MMM d, y G',
'width' => '165px', // CKCK: edited to fix date field width was 100px
));
Working on making a custom module to override the block renderer. Part 2 of R.S's code as shown isn't working, but his links give me a recipe. Will update again with results.
Update:
I tried (and failed) to override the Adminhtml block sales order grid (absog
). Another module, EM_DeleteOrder was already overriding absog
. I searched for a replacement module that didn't override absog
and found an extension with great powers with respect to the sales grid: MageWorx Enhanced Orders. So I installed that and am hacking their source for the date format I want! I'm happy and done, no more updates to this question.