1
我編寫了一個Magento網格擴展Mage_Adminhtml_Block_Widget_Grid,用於自定義管理客戶頁面。 我在默認情況下需要排序多列,那麼我寫_prepareCollection方法:默認Magento自定義管理網格頁面中的多個排序列
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('customer/customer_collection')
->addNameToSelect()
->addAttributeToSelect('customer_type')
->addAttributeToSelect('email')
->addAttributeToSelect('created_at')
->addAttributeToSelect('group_id')
->addAttributeToSelect('customer_status')
->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')
->addAttributeToSort('customer_status', 'asc')
->addAttributeToSort('customer_type', 'asc');
$this->setCollection($collection);
return parent::_prepareCollection();
}
注意customer_status和CUSTOMER_TYPE都是屬性。 但它不起作用。我需要幫助,謝謝。
好,謝謝你,那工作 –