1
我手動在訂單表(sales_flat_order)中添加了自定義字段(sales_code)。使用自定義字段的過濾器訂單集合:Magento
現在我想過濾使用該自定義字段的訂單集合(在管理訂單網頁中)。但magento拋出一個錯誤。
我的代碼:
$collection->addFieldToFilter('sales_code', '123456');
$collection->getSelect()->where('sales_code="123456"');
錯誤:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_code' in 'where clause'
有沒有辦法用在Magento自定義字段篩選集合。
在這種情況下,我傾向於'echo(string)$ collection-> getSelect()',然後將查詢粘貼到PhpMySQL中,錯誤消息有時會更清晰並且表名也是一種幫助。 – clockworkgeek 2012-03-07 12:04:25
(1)Magento的哪個版本? (2)「手動」意味着你是否直接在表中添加了一列? – benmarks 2012-03-07 12:44:56
1 - Magento ver-1.6.1.0 2 - 是的,我直接添加。 – 2012-03-07 12:47:35