0

Because my grid has a problem when join table, so I used renderer to show data like this

'brand' => array(
            'header' => Mage::helper('advr')->__('Brand'),
            'column_css_class' => 'nobr',
            'renderer' => 'Mirasvit_Advr_Block_Adminhtml_Renderer_Brand',
        ),

Renderer/Brand.php

<?php
class Vendor_Module_Block_Adminhtml_Renderer_Brand extends 
Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{

    $order = Mage::getModel('sales/order')->loadByIncrementId($row->getIncrementId());
    $items = $order->getAllVisibleItems();
    $brand = array();
    foreach ($items as $i){
        $productId = $i->getProductId();
        $product = Mage::getModel('catalog/product')->load($productId);
        $brand[] = $product->getAttributeText('brand');
    }
    return implode(',', $brand);
}

public function renderExport(Varien_Object $row) {
    return $this->render($row);
}
}
?>

but it can not get this column in csv file. Anyone know how to fix it? Help me please, thanks

  • add index to brand column – Rahul Singh Jan 21 at 9:26
  • I tried, but not work. – Thanh TN Jan 21 at 10:14
  • can you add code of _prepareCollection() – Rahul Singh Jan 21 at 10:44
  • thank you. I found a solution to fix it in export function, now it can get data of this column in csv file – Thanh TN Jan 21 at 10:51
  • that's great... – Rahul Singh Jan 21 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.