5

I created a custom column on sales order grid. It works as well but a used a custom render on a field (like this).

When I export the grid to CSV, the file contains the raw value, but I need apply another render to it for users understand the data.

So how I can do a custom render to column on grid just to export cases?

8

I got it. There is the renderExport method to do it.

My render file:

class Namespace_MyModule_Block_Adminhtml_Sales_Order_Renderer_Grid_MyModule extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row)
    {
        $value =  $row->getData($this->getColumn()->getIndex());

        // CUSTOM PHP CODE FOR MODIFY VALUE HERE

        return $value;
    }

    public function renderExport(Varien_Object $row)
    {
        return $this->render($row); // We can do diferent value for Render Grid and Render Export.
    }
}
  • It would be great if you could add in your answer as well (in short) where / how you configured to use that renderer for your filed (just to make this more complete) Or provide a link to a resource on how to do that. – hakre Apr 3 '16 at 13:12

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.