4

I want to have a default value in a column on sales grid, the value will be the actual day.

$this->addColumn('created_at', array(
        'header' => Mage::helper('sales')->__('Purchased On'),
        'index' => 'created_at',
        'type' => 'datetime',
        'width' => '100px',
        'filter_index' => 'main_table.created_at',

        'value'=>array(
            'from'=>date('Y-m-d', time())
        )
    ));

But its not working and I don't know why.

How can I do that?

1

try below code

$this->addColumn('created_at', array(
    'header' => Mage::helper('sales')->__('Purchased On'),
    'index' => 'created_at',
    'type' => 'datetime',
    'width' => '100px',
    'filter_index' => 'main_table.created_at',

    'value'=>array(
        'from'=>date('Y-m-d')
    )
));
|improve this answer|||||
  • 2
    That is exactly what I have, but I solved with the method $this->setDefaultFilter( $arrayFilter ); – allamgr Mar 15 '17 at 13:28
1

In the _prepareColumns method of my custom class extending Mage_Adminhtml_Block_Catalog_Product_Grid I was able to set a filter like this:

$this->setDefaultFilter(array('status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));

or

$this->setDefaultFilter(array('name' => 'foo'));
|improve this answer|||||
0

File Path:

app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

Put your code these way You can See Only actual day

  $this->addColumn('created_at', array(
    'header' => Mage::helper('sales')->__('Purchased On'),
    'index' => 'created_at',
    'type' => 'date',
    'width' => '100px',
));   
|improve this answer|||||
  • 2
    That is exactly what I have, but I solved with the method $this->setDefaultFilter( $arrayFilter ); – allamgr Mar 15 '17 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.