在Magento中将付款方式纳入报告

时间:2011-12-14 11:30:58

标签: php phpmyadmin magento

我正在使用dropship模块(Unirgy_Dropship_Block_Adminhtml_Report_Grid),我正在尝试将付款方式添加为列。 我能够找到我需要的表并将其添加到集合中。问题是字段填充了空值。任何的想法?这是我的基本代码:需要修复的行是joinLeft行,我在其中添加了method属性。

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",
        )
    ));
    //...
}

1 个答案:

答案 0 :(得分:0)

当我做类似的事情时,这个链接上的第二篇帖子对我很有帮助

http://www.magentocommerce.com/boards/viewthread/192232/

相关问题