2011-12-14 82 views
0

我正在使用dropship模塊(Unirgy_Dropship_Block_Adminhtml_Report_Grid),並試圖將付款方式添加爲列。 我能找到我需要的表格並將其添加到集合中。問題在於這些字段中填充了空值。任何想法?這是我的基本代碼:需要修復的行是joinLeft行,我在其中添加method屬性。在Magento中獲取付款方式

protected function _prepareCollection() { 
    //... 
    $eav = Mage::getSingleton('eav/config'); 
    $oapAttr = $eav->getAttribute('order_payment', 'method'); 
    $collection = Mage::getResourceModel('sales/order_shipment_collection'); 
    //... 
    $collection->getSelect() 
     ->join(array('oa'=>Mage::getSingleton('core/resource')->getTableName('sales_order_entity')), 'oa.parent_id=_table_order_increment_id.entity_id', array()) 
     ->joinLeft(array('oap'=>Mage::getSingleton('core/resource')->getTableName('sales_order_entity_varchar')), "oap.entity_id=oa.entity_id and oap.attribute_id=".$oapAttr->getId(), array('method'=>'value')) 
    ; 
    $this->setCollection($collection); 
    //... 
    return parent::_prepareCollection(); 
} 
protected function _prepareColumns() { 
    //... 
    $this->addColumn('method', array(
     'header' => $hlp->__('Payment Method'), 
     'index' => 'method', 
     'type' => 'options', 
     'options' => array(
      'authorizenet' => "Credit Card", 
      'paypal_standard' => "Paypal", 
      'ugiftcert'  => "Gift Certificate", 
      'free'   => "Free", 
     ) 
    )); 
    //... 
} 

回答

相關問題