When you want to filter collection result by using like, you can use the following code: $collection->addAttributeToFilter('name', array( array('like' => '% '.$needle.' %'), //spaces on each side array('like' => '% '.$needle), //space before and ends with $needle array('like' => $needle.' %') // starts with needle and space after ));
Passing the second parameter as an array of arrays will concatenate the conditions using
- October 27, 2016 @ 17:42:36 [Current Revision] by admin
- October 27, 2016 @ 17:42:36 by admin
No comments yet.