Я изменил app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php чтобы настроить то, что находится на Заказы сетка.Magento - SQLSTATE [42S22]: Столбец не найден: 1054 Неизвестный столбец 'billing_name' в 'where clause'
В _getCollectionClass()
у меня есть это:
protected function _getCollectionClass()
{
//return 'sales/order_grid_collection';
return 'sales/order_collection';
}
и в _prepareCollection()
у меня есть это:
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinLeft(array('s1' => 'sales_flat_order_address'),'main_table.shipping_address_id = s1.entity_id',array('region','firstname','lastname'));
$collection->getSelect()->joinLeft(array('s2'=>'sales_flat_order_address'),'main_table.billing_address_id = s2.entity_id',array('firstname','lastname'));
$collection->getSelect()->columns(new Zend_Db_Expr("CONCAT(s2.firstname, ' ',s2.lastname) AS billing_name"));
$collection->getSelect()->columns(new Zend_Db_Expr("CONCAT(s1.firstname, ' ',s1.lastname) AS shipping_name"));
$collection->getSelect()->joinLeft(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.customer_email','sfo.weight','sfo.discount_description','sfo.increment_id','sfo.store_id','sfo.created_at','sfo.status','sfo.base_grand_total','sfo.grand_total')); // New
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),'main_table.entity_id = sfoa.parent_id AND sfoa.address_type="shipping"',array('sfoa.street','sfoa.city','sfoa.region','sfoa.postcode','sfoa.telephone')); // New
$this->setCollection($collection);
return parent::_prepareCollection();
}
Теперь я изменил _prepareColumns()
добавить свои необходимые поля и все работает! за одно ... За исключением
Когда я поиск заказов по Billing или Доставка, я получаю сообщение об ошибке. Я добавил filter_index ('filter_index' => 'theindex'
) всем необходимым компонентам, и все они отлично работают. ЗА ИСКЛЮЧЕНИЕМ этих двух полей. Платеж или Отгрузка.
Так что я положил filter_index на эти тоже.
Все прекрасно. Я могу искать другие поля, но как только я ищу Billing или Доставки поля, я получаю эту ошибку:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'billing_name' in 'where clause'
Я пробовал все виды вещей, но ничего не кажется, работает. Может кто-то, пожалуйста, помогите! ???