我需要添加客户的'公司'属性发票网格。 下面是我更改的代码,它在phpmyadmin中显示正确的查询结果,但不知何故,它只显示2作为发票网格上的Total记录。Magento发票网格新专栏问题
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinInner(array('order_address' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order_address')),'order_address.parent_id = main_table.order_id',array('company'))->group('parent_id')->order('entity_id', 'desc');
$this->setCollection($collection);
return parent::_prepareCollection();
}
和查询
SELECT `main_table`.*, `order_address`.`company` FROM `sales_flat_invoice_grid` AS `main_table` INNER JOIN `sales_flat_order_address` AS `order_address` ON order_address.parent_id = main_table.order_id GROUP BY `parent_id`
如果我改变的记录200每页数,它显示了所有的记录,但在寻呼和总记录一些问题。
它总是显示1页和'共找到2条记录'。所以我不能移动到下一页。
请帮忙。
谢谢
你为什么不称赞这个答案的原作者? http://stackoverflow.com/a/4219386/927404 – 2012-09-12 12:09:32