HOW to create special field filters to search data.

HI, what is the correct way for creatin special field filter ?

What I need is:

I have the _search partial view, and I whan to add a new combo, thas is based on a query condition on the table:

invoiced - payed = debt,

so I whant to add a combo with 2 options:

-a)With debt

-b)with no debt

in case of A) I need to query database where debt > 0

in case of B) I need to query databse where debt = 0

I’m also using one extension “ERememberFiltersBehavior” to remember filters, and this extension eliminates lines from actionAdmin function.

I resolve it using $_SESSION and $_GET to retrieve and store the user selected value.

So in the search function of the model I have:

if (isset($_GET['deudaFilter']) && $_GET['deudaFilter'] == 'S') {

			$criteria->addCondition('importe_pagado < importe');


		if (isset($_GET['deudaFilter']) && $_GET['deudaFilter'] == 'P') { //parcialmente

			$criteria->addCondition('importe_pagado > 0 AND importe_pagado < importe');


		if (isset($_GET['deudaFilter']) && $_GET['deudaFilter'] == 'T') {

			$criteria->addCondition('importe_pagado = importe');


Is this correct?

or the right way is to create a new model "MyModel" based on current model and add special attributes, attributes that was NOT in the database.

I’m also using Giix, so my class is allready based on a "base"class.

Best Regards