Use only $collection->addfieldtofilter (), do not use Addattributetofilter () or zend_db_expr (can be used for more complex where statements) such as: collection- >getselect ()->where (New zend_db_expr ("E.created_at > ' 2013-01-01 00:00:00 ' OR e.created_at < ' 2012-01-01 00:00:00)); and relationship------------------------------------------------------Min_weight < $weight andmax_weight >= $weight
$_collection Array $weight )) (array$weight));
OR relationship------------------------------------------------------min_weight > $weight or$weight > Max_weight
$_collection-addfieldtofilter (array(' min_weight ', ' max_weight '), array ( array$weight), array$weight)) ;
And and or nesting relationships------------------------------------------------------min_weight > $weight and ($weight <= max_ Weight and max_weight<>nullormax_weight is NULL)
$_collection Array $weight )-addfieldtofilter ( array(' max_weight ', ' max_weight '), array ( array$weighttrue), Array true ) ));
Magento collection filtering nested where condition simple notation