2014-09-18 2 views
0

나는 customer.i에 4 개의 사용자 정의 attrubute를 가지고 있습니다. export.i가 내보내기 용으로 그리드에 추가했을 때 csv에 추가하고 싶습니다만, 생성되었지만 데이터가 아닙니다. csv를 채우지 마십시오. 아래 은 grid.php에서 csv 가져 오기에 사용할 코드입니다.고객 내보내기 csv에 사용자 정의 속성을 추가하는 방법

 if ($this->_isExport) { 
    $this->addColumn('contact_job_title', array(
    'header' => Mage::helper('customer')->__('Contact Job Title'), 
    'index' => 'contact_job_title', 
)); 
$this->addColumn('contact_seq_no', array(
    'header' => Mage::helper('customer')->__('Contact Seq No'), 
    'index' => 'contact_seq_no', 
)); 
$this->addColumn('debtor_acc_no', array(
    'header' => Mage::helper('customer')->__('Debtor Acc No'), 
    'index' => 'debtor_acc_no', 
)); 
$this->addColumn('debtor_api_key', array(
    'header' => Mage::helper('customer')->__('Debtor Api Key'), 
    'index' => 'debtor_api_key', 
)); 
    } 

어떤 도움을 주시면 감사하겠습니다.

답변

1

가 좋아 난 그냥 수출에만

if ($this->_isExport) { 
     $this->addColumn('debtor_api_key', array(
      'header' => Mage::helper('customer')->__('Debtor Api Key'), 
      'index' => 'debtor_api_key', 
     )); 
     $this->addColumn('contact_job_title', array(
      'header' => Mage::helper('customer')->__('Contact Job Title'), 
      'index' => 'contact_job_title', 
     )); 
     $this->addColumn('contact_seq_no', array(
      'header' => Mage::helper('customer')->__('Contact Seq No'), 
      'index' => 'contact_seq_no', 
     )); 
     $this->addColumn('creditstatus', array(
      'header' => Mage::helper('customer')->__('Creditstatus'), 
      'index' => 'creditstatus', 
     )); 
     $this->addColumn('debtor_acc_no', array(
      'header' => Mage::helper('customer')->__('Debtor Acc No'), 
      'index' => 'debtor_acc_no', 
     )); 
    } 
에 대한

protected function _prepareCollection() 
{ 
    $collection = Mage::getResourceModel('customer/customer_collection') 
     ->addNameToSelect() 
     ->addAttributeToSelect('email') 
     ->addAttributeToSelect('debtor_api_key') /* added attribute */ 
     ->addAttributeToSelect('contact_job_title') /* added attribute */ 
     ->addAttributeToSelect('contact_seq_no') /* added attribute */ 
     ->addAttributeToSelect('creditstatus') /* added attribute */ 
     ->addAttributeToSelect('debtor_acc_no') /* added attribute */ 
     ->addAttributeToSelect('created_at') 
     ->addAttributeToSelect('group_id') 
     ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left') 
     ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left') 
     ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left') 
     ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left') 
     ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left'); 

    $this->setCollection($collection); 

    return parent::_prepareCollection(); 
} 

와하는 addColumn에서 선택 속성을 추가 대답

발견

관련 문제