Magento集合中的和或条件

Magento集合中的和或条件,magento,collections,filter,multiple-conditions,Magento,Collections,Filter,Multiple Conditions,我想做一个如下所示的查询,从产品集合中筛选一些产品(使用属性) SELECT <attributes> FROM <tables & joins> WHERE (<some AND conditions>) OR (<some AND conditions>) 选择 从…起 其中()或() 其中条件应过滤匹配第一组和条件或第二组和条件的产品。 问题是我找不到在多个和条件之间添加或条件的方法。 有人能帮我使用MagentoaddAttr

我想做一个如下所示的查询,从产品集合中筛选一些产品(使用属性)

SELECT <attributes>
FROM <tables & joins>
WHERE (<some AND conditions>) OR (<some AND conditions>) 
选择
从…起
其中()或()
其中
条件应过滤匹配第一组
条件或第二组
条件的产品。 问题是我找不到在多个
条件之间添加
条件的方法。
有人能帮我使用Magento
addAttributeToFilter()
来编码上面的where条件吗?或任何其他功能?

如果我理解正确,我认为您需要执行以下操作:

->addAttributeToFilter(...filter here...)
->addAttributeToFilter(array(
    array(
        'attribute' => 'special_to_date',
        'date' => true,
        'from' => $dateTomorrow
    ),
    array(
        'attribute' => 'special_to_date',
        'null' => 1
    )
));
这将是:

…在此进行筛选。。。和(特殊截止日期>='2012-07-03'或特殊截止日期为空).