2

I have displayed total of columns in my magento grid.However when I export the content to CSV it does display the total but it do not display the label that is been placed.

public function getTotals()
{
    $totals = new Varien_Object();
    $fields = array(
        'total_no_of_orders' => 0,
        '
    );
    foreach ($this->getCollection() as $item) {
        foreach($fields as $field=>$value){
            $fields[$field]+=$item->getData($field);
        }
    }
    //First column in the grid
    //$fields['created_at']='Totals';
    $totals->setData($fields);
    return $totals;
}

And this is the code to display the word total

 $this->addColumn('created_at', array(
      'header'    => Mage::helper('partialpayment')->__('Date'),
      'align'     =>'center',
      'width'     => '50px',
      'index'     => 'created_at',
      'type'    =>'datetime',
      'format'    => 'MM-dd-Y',
      'totals_label'  => Mage::helper('partialpayment')->__('Total'),
   ));
  • post you code, what you have tried – MeenakshiSundaram R Aug 11 '15 at 5:17
  • Code edited please check – Milople Inc Aug 11 '15 at 5:20
  • show your grid.php file – MeenakshiSundaram R Aug 11 '15 at 6:23
  • Already added the code. Do you want to check my collection? – Milople Inc Aug 11 '15 at 6:36

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.