refactored conditions (getProducts+getTotalProducts)

instead of
if(filter_name) {...}
if(filter_name) {...}
if(filter_name) {...}

used
if(filter_name) {
 ...
 ...
 ...
}

which is faster