Filtering by Select Attribute?
Permalink 1 user found helpfulEverything seems peachy until I try to filter based on select type attributes.
example...
Loader::model('user_list'); $userList = new UserList(); $userList->sortBy('last_name', 'asc'); $userList->filterByGroup('Members'); // Works $userList->filterByFirstName('John'); // Doesn't Work $userList->filterByRegion('Los Angeles'); // Doesn't Work $userList->filterByRegion(array('Los Angeles')); // Doesn't Work $userList->filterByRegion(10);
What is the correct method to filter the results?
I searched through the code for several hours, and was at a dead end. I actually started extending the model and doing raw sql queries.
You just saved me a lot of time. :-)
I need to make a block to place on the site to execute the query and return the avatar results.
Any help to get me over the hump.
Thanks in advance
Matching text in this kind of field can't just be using the normal equality operator = so I could do it using 'like' as follows:
I think this should be fixed, so I'll report it.
** Edit:
I'm wrong, let me correct. All values are stored in the same field, with a \n (new line) separator.
So, when searching for one of the values, it won't match (using the = operator) as the search matches all the field's content. Thus, you have to use the 'like' operator instead.