Unexpected filter results

edited November 2015 in Share
I have an advanced module with a filter on a field called 'parent'. When I filter on this parent field with id 30 (as shown in url below) I get items with parent 305 as well. Any thoughts on how to prevent this?

https://www.domain.com/fueladmin/shop/categories/items?parent=30&search_term=&limit=50&view_type=list&offset=0&order=asc&col=title&precedence=1&fuel_inline=0

Comments

  • edited 3:19AM
    Try adding the following to your model:
    public $filter_join = 'and';
  • edited 3:19AM
    Stumbled into this issue again. So what I have is a select with parent categories in the listview. When I select parent category 92 I get parent category 192 as well. The sql explains it:

    SELECT `id`, `title`, `slug`, `parent`, `precedence`, `active` FROM (`shop_categories`) WHERE (LOWER(shop_categories.parent) LIKE "%92%") ORDER BY `title` asc LIMIT 50

    It performs a LIKE on the filter. Would it possible to perform an exact match instead?
  • edited 3:19AM
    You can add suffixes to your field names that will apply different operators in the comparison. In your case, you want a shop_categories.parent_equal:
    http://docs.getfuelcms.com/modules/simple#filtering
  • edited 3:19AM
    Thanks! Works like a charm ;-)
Sign In or Register to comment.