【发布时间】:2014-09-17 03:58:34
【问题描述】:
我想使用 AddAttributeToFilter 选择条件为“A 或(B 和 C)”的产品集合,但我不知道..
有人可以帮我吗?
【问题讨论】:
标签: magento
我想使用 AddAttributeToFilter 选择条件为“A 或(B 和 C)”的产品集合,但我不知道..
有人可以帮我吗?
【问题讨论】:
标签: magento
$collection = Mage::getModel('xyz/abc')->getCollection();
$collection->addAttributeToFilter(
array(
array('attribute'=> 'someattribute','like' => 'value'),
array('attribute'=> 'otherattribute','like' => 'value'),
array('attribute'=> 'anotherattribute','like' => 'value'),
)
);
$collection->addAttributeToFilter('status', array('eq' => 1));
跨国会是这样的
WHERE ((someattribute LIKE 'value') OR (otherattribute LIKE 'value') OR (anotherattribute LIKE 'value')) and status=1
您也可以访问此链接了解更多信息
【讨论】: