Varien_File_CsvMagento のクラスを使用して、カスタム配列データを csv に簡単にエクスポートできます。
エクスポート元のフィールドがわかっている場合はsales_flat_order_status_history、次のように簡単に実行できます (基本的な考え方にすぎません)。
<?php
/**
* @author MagePsycho <info@magepsycho.com>
* @website http://www.magepsycho.com
*/
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
#Mage::setIsDeveloperMode(true);
#ini_set('display_errors', 1);
umask(0);
Mage::app();
$filePath = '/path-to-csv/comments.csv';
$csv = new Varien_File_Csv();
$exportData = array();
$comments = getCommentsFromHistoryTable(); //you can fetch comments from the required table
foreach($comments as $_comment){ //loop over the comments to prepare the export data
$data = array();
$data['field1'] = $_comment->getField1();
$data['field2'] = $_comment->getField2();
//... so on
$exportData[] = $data;
}
$csv->saveData($filePath, $exportData);
それで全部です。指定した csv にデータを保存します。
これがお役に立てば幸いです。
ありがとう