1

I want to assign the same text to one column of all rows of the Grid

I have my custom grid and I added column like this:

class Ailin_Orders_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
{  //somecode
     protected function _prepareColumns()
        {
            $helper = Mage::helper('ailin_orders');
            $this->addColumn('Vendor Code',
                array(
                    'header'=> Mage::helper('catalog')->__('Vendor Code'),
                    'width' => '50px',
                    'renderer'  => 'adminhtml/sales_render'
            ));
}
}

I created a file render.php to render the value simply like this:

class Ailin_Orders_Block_Adminhtml_Sales_Render
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        return "SCOZAH";
    }
}

enter image description here

1 Answer 1

1

There's a mistake in how you're calling your renderer. Try this:

$this->addColumn('Vendor Code',
            array(
                'header'=> Mage::helper('catalog')->__('Vendor Code'),
                'width' => '50px',
                'renderer'  => 'ailin_orders/adminhtml_sales_render'
        ));
1
  • yeah I will in 8 minuets!
    – Nickool
    Jun 30, 2015 at 16:36

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.