Magento: Combine eq and is null in addAttributeToFilter

后端 未结 3 598
猫巷女王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:28

    • I have product attribute is_expired with Yes and No value and i want only those product have NO value.below query work for me that get record that have neq 1 and not null.

      • Combine not equal to and null condition WITH OR.

         $collection->addAttributeToFilter('attribue_name', array('or'=> array(
             0 => array( 'neq' => '1'),
             1 => array('is' => new Zend_Db_Expr('null')))
         ), 'left');
        
    • You can changed neq with eq.

提交回复
热议问题