所有所有
addAttributeToFilter() is used to filter EAV collections.
addFieldToFilter() is used to filter Non-EAV collections.
EAV的模型首先是例如产品,客户,销售,等等,所以你可以使用使用addAttributeToFilter()
为这些实体。
addFieldToFilter() is mapped to `addAttributeToFilter()` for `EAV` entities. So you can just use `addFieldToFiler().`
您可以在app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php
看看其中映射完成:
public function addFieldToFilter($attribute, $condition = null) {
return $this->addAttributeToFilter($attribute, $condition);
}
如果您使用的自定义模块,那么你可以直接使用addFieldToFilter()
与column
名
像
$collection = Mage::getModel('module/model')->getCollection()
->addFieldToFilter('column_name',$data);
让我知道如果您有任何疑问
尝试改变模块的资源文件_construct功能... 应用程序/代码/ [包装]/[模块] /型号/资源/ [模块] $这个 - > _init('module/module','prod_id'); –
你有没有找到解决办法? –
@KeyurShah不,实际上问题是我的自定义模块中的搜索功能网格抛出错误,说列entity_id不存在。但在我的数据库表中我没有任何这样的列。所以我想如果我可以使用列名别名东东。 – Muk