【发布时间】:2012-09-16 19:11:03
【问题描述】:
我想通过在 Collection
中应用 OR 条件从表中获取数据我正在使用这些代码行
$collect = Mage::getModel('storelocater/storelocater')->getCollection()->addFieldToFilter(array( 数组('属性' => '国家', 'eq' => '印度'),
数组(
'属性' => '状态', 'eq' => '向上')
)); 回声 $data = $collect->getSelect();
它打印输出
SELECT main_table.* FROM storelocater AS main_table WHERE ((Array = '') OR (Array = ''))
我也使用 addAttributeToFilter 而不是 addFieldToFilter 但它返回致命错误
【问题讨论】:
-
你有没有试过这个链接stackoverflow.com/questions/5301231/…它对我有用,或者收集条件
-
是的,我试过这个。但 addAtrributeToFilter() 函数仅适用于 EAV 实体。它不适用于自定义表格。
标签: magento magento-1.7