下面的代碼:過濾magento集合?
$collection->addAttributeToFilter(array(
array('attribute'=> 'someattribute','like' => 'value'),
array('attribute'=> 'otherattribute','like' => 'value'),
));
創建查詢是這樣的:
where (someattribute like 'value' OR otherattribute like 'value')
,但我怎麼能添加AND條件這樣或條件?我的意思是這樣的:
where ((someattribute like 'value' AND someattribute != 'another value') OR otherattribute like 'value')
我使用addAttributeToFilter多次在我收藏的建設,但是,我想用下面的代碼添加上述條件:
$collection->getSelect->where("(someattribute like 'value' AND someattribute != 'another value') OR otherattribute like 'value')" )
但它的不工作。也許不可能使用addAttributeToFilter AS以及在同一個集合中的哪個位置?
提前很多感謝