0

I am using layout handles in adding custom column to my Orders grid. How can i disable the filtering input field?

Here is my code: app/design/adminhtml/default/default/layout/company

<?xml version="1.0"?>
<layout>
<sales_order_grid_update_handle>
    <reference name="sales_order.grid">
        <action method="addColumnAfter">
            <columnId>printed</columnId>
            <arguments>
                <header>Printed</header>
                <index>printed</index>
                <width>80</width>
                <renderer>Company_myModule_Block_Adminhtml_Sales_Order_Renderer_Printed</renderer>
                <type>text</type>
            </arguments>
            <after>status</after>
        </action>
    </reference>
</sales_order_grid_update_handle>
<adminhtml_sales_order_grid>
    <!-- apply layout handle defined above -->
    <update handle="sales_order_grid_update_handle" />
</adminhtml_sales_order_grid>
<adminhtml_sales_order_index>
    <!-- apply layout handle defined above -->
    <update handle="sales_order_grid_update_handle" />
</adminhtml_sales_order_index>
</layout>

my image

Printed.php

<?php
 class Mjsi_Orderprint_Block_Adminhtml_Sales_Order_Renderer_Printed extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
    {
    $value =  $row->getData();
    $value = $value['entity_id'];

    $resource = Mage::getSingleton('core/resource');

    /**
     * Retrieve the read connection
     */
    $readConnection = $resource->getConnection('core_read');

    /**
     * Retrieve our table name
     */
    $table = $resource->getTableName('orderprint/orderprint');


    $query = 'SELECT orderprint_id FROM ' . $table . ' WHERE order_id = '
             . $value . ' LIMIT 1';

    /**
     * Execute the query and store the result in $sku
     */
    $value = $readConnection->fetchOne($query);
    //return $value;


    if($value) {return '<span style="font-weight:bold;">Yes</span>';}
    else {return '<span style="color:#900; font-weight:bold;">No</span>';}
    ///return '<span style="color:#900;">'.$value.'</span>';
    }
}

1 Answer 1

0

Try adding <filter>false</filter> Hope it works :)

<?xml version="1.0"?>
<layout>
    <sales_order_grid_update_handle>
        <reference name="sales_order.grid">
            <action method="addColumnAfter">
                <columnId>printed</columnId>
                <arguments>
                    <header>Printed</header>
                    <index>printed</index>
                    <width>80</width>
                    <filter>false</filter> // add this code
                    <renderer>Company_myModule_Block_Adminhtml_Sales_Order_Renderer_Printed</renderer>
                    <type>text</type>
                </arguments>
                <after>status</after>
            </action>
        </reference>
    </sales_order_grid_update_handle>
    <adminhtml_sales_order_grid>
        <!-- apply layout handle defined above -->
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_grid>
    <adminhtml_sales_order_index>
        <!-- apply layout handle defined above -->
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_index>
</layout>
7
  • This <filter>false</filter> don't works .
    – Lester
    Oct 4, 2017 at 17:58
  • may be try using 0 or 1 instead of true false Oct 4, 2017 at 18:11
  • Still does not work. I want that field to disappear.
    – Lester
    Oct 4, 2017 at 18:35
  • Please try my updated code Oct 4, 2017 at 18:39
  • page does not work.
    – Lester
    Oct 4, 2017 at 18:47

Your Answer

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

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