Skip to content

Load product eav attribute to Order grid csv export

Hi I have a custom grid which displays sales order items and I need to add a column to grid csv export.The column is an product eav attribute of ordered product.How can I load the product’s eav attribute for each order item row for the exported csv. I have found the following query but I need to load the product’s eav attribute.

    $collection->getSelect()
        ->columns(
            array(
                'pickup_location_code' => new Zend_Db_Expr('(SELECT `pickup_location_code` FROM `sales_order_grid` WHERE `sales_order_grid`.`entity_id` = main_table.`entity_id` GROUP BY `sales_order_grid`.`entity_id`)')
            )
        );

The above code is used in a plugin beforeLoad the grid. Please help.