Custom Filter Based On Other Field Value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blueprint
    Active Community Member
    • Jan 2019
    • 223

    Custom Filter Based On Other Field Value

    How can I implement a custom filter which is based around the value of another field?

    For example, I have a field called `stockLevel` and another called `minStock`. I want to develop a filter whereby I can show all entity records whose `stockLevel` is less than `minStock`.

    So far, I have this:

    Code:
    protected function filterBelowMinimumStock(&$result)
    {
        $result['whereClause'][] = array(
        'stockLevel<' => <FIELD NAME HERE>
        );
    }
    However, I don't know what to do with the <FIELD NAME HERE> bit
    Last edited by blueprint; 12-05-2019, 05:04 PM.
Working...