2

enter image description here

when order status is complete . View link should be there if status is pending How to it condition on grid.

2 Answers 2

1

Step 1: it's Very Easy you need to Override the Mage_Adminhtml_Block_Sales_Order_Grid as per magento Standrads.

or

You can Copy app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php to app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php

Step 2:Now you need to open that file and search _prepareColumns() method.

Step 3: In that function Search Below Code.

 if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
        $this->addColumn('action',
            array(
                'header'    => Mage::helper('sales')->__('Action'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('sales')->__('View'),
                        'url'     => array('base'=>'*/sales_order/view'),
                        'field'   => 'order_id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
                'is_system' => true,
        ));
    }

Step 4: Comment that code & Check your sales Order Grid.

let me know if you have any Query.

5
  • every time not a solution to using local pool change a core file so try to extend a functionality using observer. Commented Mar 25, 2015 at 5:35
  • I Agree with you each time is not good but they Need to just remove that link if there is highly customization then they need to override the that Grid. that's y I mention First option to override grid @ravipatel
    – Keyul Shah
    Commented Mar 25, 2015 at 5:37
  • Keyul @ i need view link only when status is "Pending".once status is Complete i want to hide the view link
    – Magento AJ
    Commented Mar 25, 2015 at 5:59
  • Then You need to do More customization and you need to used the rendered in magento then you can achieve this kind of feature
    – Keyul Shah
    Commented Mar 25, 2015 at 6:03
  • Can we have any process to achieve that to use renderer i tried but its not working
    – Magento AJ
    Commented Mar 25, 2015 at 6:48
1
<global>
    <blocks>
        <module>
            <class>Vendor_Module_Block</class>
        </module>
        <adminhtml>
            <rewrite>
                <sales_order_grid>Vendor_Module_Block_Rewrite_Adminhtml_Block_Sales_Order_Grid</sales_order_grid>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

Rewrite class:

class Vendor_Module_Block_Rewrite_Adminhtml_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
    protected function _prepareColumns()
    {
        parent::_prepareColumns();

        return $this->removeColumn('action');
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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