Magento date text: where does it come from and how can I change it? -
with knowledge i've learned here recent magento upgrade , ensuing fixing, please help me 1 of biggest ui gripes: date. stupid:
i hacked core file app/code/core/mage/adminhtml/block/sales/order/grid.php
, changed '100px' '165px', prevents date wrapping. i'd love alter date 'm n, y g:i:s a' gmail uses 'g:i:s a' if today or 'm n, ga' if not today. i'd add together in year if year of date displayed wasn't current year.
i saw overriding magento admin controller, beginners, might plenty me override _preparecolumns()
in core file, i'd find out how alter date! btw, grepped whole install , no part of date format string shows up.
update: found date string format set in lib/zend/locale/data/root.xml
, may overridden if locale other en_us, file empty. expound upon first part of r.s's answer, date "format" not php date()
style, tried , got quite unusual results. perusing locale xml files, made few experiments, 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 prepare date field width 100px ));
working on making custom module override block renderer. part 2 of r.s's code shown isn't working, links give me recipe. update 1 time again results.
update: tried (and failed) override adminhtml block sales order grid (absog
). module, em_deleteorder overriding absog
. searched replacement module didn't override absog
, found extension great powers respect sales grid: mageworx enhanced orders. installed , hacking source date format want! i'm happy , done, no more updates question.
try
$this->addcolumn('created_at', array( 'header' => mage::helper('sales')->__('purchased on'), 'index' => 'created_at', 'type' => 'datetime', 'format' => 'mmm d, h:mm a', 'width' => '165px', ));
you utilize renderer
$this->addcolumn('created_at', array( 'header' => mage::helper('sales')->__('purchased on'), 'index' => 'created_at', //'type' => 'datetime', //remove 'renderer' = new mageigniter_formatdate_block_adminhtml_renderer_data() 'width' => '165px', ));
then create
class mageigniter_formatdate_block_adminhtml_renderer_data extends mage_adminhtml_block_widget_grid_column_renderer_action { public function render(varien_object $row) { homecoming $this->_getvalue($row); } public function _getvalue(varien_object $row) { $val = $row->getdata($this->getcolumn()->getindex()); // row value // need format $val homecoming $val; } }
see
magento client grid - mask email address http://www.magentocommerce.com/boards/viewthread/192232/#t420795 magento
No comments:
Post a Comment