Magento或查询

Magento或查询,magento,Magento,我想在magento mysql查询中使用或,我正在寻找magento中的等效项 其中(is_in_stock=0,show_in_front=1)和(is_in_stock=1,show_in_front=1) 我知道下面可以用于“或”,但不确定如何生成如上所述的对等查询 ->addAttributeToFilter( array( 'attribute' => 'is_in_stock', 'eq' => '0'

我想在magento mysql查询中使用或,我正在寻找magento中的等效项

其中(is_in_stock=0,show_in_front=1)和(is_in_stock=1,show_in_front=1)

我知道下面可以用于“或”,但不确定如何生成如上所述的对等查询

 ->addAttributeToFilter(
     array(
          'attribute' => 'is_in_stock',
          'eq'      => '0',
     ),

以下是或条件的示例代码

$collection->addAttributeToFilter(
array(
    array('attribute'=> 'attribute1','like' => 'value1'),
    array('attribute'=> 'attribute2','like' => 'value2'),
    array('attribute'=> 'attribute3','like' => 'value3'),
    )
);

请检查此查询

//OR Condition
->addAttributeToFilter(array(array('attribute' => 'is_in_stock','eq' => '0'),array('attribute' => 'show_in_front','eq' => '1')));
//And Condition
->addAttributeToFilter('is_in_stock', array('eq' => '1'));
->addAttributeToFilter('show_in_front', array('eq' => '1'));

谢谢你的回答,成功了。我还有一个问题。我们有两个属性检查库存和在前面显示。我想有magento等效查询;“其中(签入库存>0或(签入库存=0并显示库存=1))”。请帮助我找到等效的magento查询。请向我发送第一个查询问题