【问题标题】:Amin panel Order grid search is is not working after adding new columns?添加新列后,Amin 面板订单网格搜索不起作用?
【发布时间】:2013-07-03 09:01:00
【问题描述】:

我在管理面板订单网格中添加了三个新列(社区版本 1.7.0.2) 但现在搜索不起作用。当我按Purchased On 日期搜索时,它显示以下错误消息。

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous

而我的收藏如下。

$collection = $observer->getOrderGridCollection();
        $collection->getSelect()
                   ->joinLeft('sales_flat_order_payment', 'main_table.entity_id = sales_flat_order_payment.parent_id','method')
                   ->joinLeft('customer_entity', 'main_table.customer_id = customer_entity.entity_id','email')
                   ->joinLeft('sales_flat_order_item', 'main_table.entity_id = sales_flat_order_item.order_id','name');

         $collection->getSelect()->group('main_table.entity_id');

有什么建议吗?

【问题讨论】:

  • 有什么建议吗?

标签: php collections magento-1.7 admin orders


【解决方案1】:

我认为你应该在使用连接时在字段名之前指定表名。像 tablename.fieldname。 但是您的代码中的“created_at”在哪里?

【讨论】:

  • 下表有 'created_at' 列 1. customer_entity 2. sales_flat_order_grid 3. sales_flat_order_item
  • 没有。在管理面板中,订单网格由 sales_flat_order_grid 表生成。它本身有一个“create_at”列。与我加入 sales_flat_order_grid 集合的其他表相同,它们本身具有“created_at”列
  • 通过更改表的列名来试试这个。
  • 如何更改表格列名?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多