Magento: Combine eq and is null in addAttributeToFilter

后端 未结 3 552
猫巷女王i
猫巷女王i 2021-02-06 10:57

I want to combine with OR \"is null\" and \"eq\" => array()

$collection->addAttributeToFilter(\'attributename\', array(\'is\' => null));
$collection->ad         


        
3条回答
  •  隐瞒了意图╮
    2021-02-06 11:48

    To use addAttributeToFilter with an OR condition and with left join you can do something like that:

    $collection->addAttributeToFilter(
        array(
            array('attribute' => 'name_of_attribute_1','null' => 'this_value_doesnt_matter'),
            array('attribute' => 'name_of_attribute_2','in' => array(115, 116))
            )
         '',
        'left'
    );
    

提交回复
热议问题