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 OR.
Revisions
- October 27, 2016 @ 17:42:36 [Current Revision] by admin
- October 27, 2016 @ 17:42:36 by admin
Revision Differences
There are no differences between the October 27, 2016 @ 17:42:36 revision and the current revision. (Maybe only post meta information was changed.)
No comments yet.