Reputation: 2443
I am trying to get the products which match certain attribute values + Null
in product collection. I have tried the following code, but it does not work:
$collection->addAttributeToFilter('length', NULL);
$collection->addAttributeToFilter('length', array('in' => array(115, 116)));
Upvotes: 2
Views: 1382
Reputation: 2443
$collection->addAttributeToFilter(
array(
array(
'attribute' => 'length',
'null' => true
),
array(
'attribute' => 'length',
'finset' => array(115,116)
)
)
);
Upvotes: 2