Magento collection filtering nested where condition simple notation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.