I make a filter for ads. There is such a point as the choice in which currency to display amounts.
How can the filter recalculate and display the result with recalculated values? That is, I have courses, I know how to recount. Question is it possible to make a request of this type?
if($this->course_type == Course::CONST_EUR){ $query->andFilterWhere(['object.price' * $course_value]); } It produces the error 'Operator '0' requires two operand , and I don’t think that the filter can recalculate and change the output data.
But there are no ideas yet, tell me how it can be implemented?
object.pricephrase by some value of$course_value(this is not necessary). And you need to do this:['object.price' => $price * $rate], that is, as far as I understand, thepricecolumn in theobjecttable should be equal to the requested price multiplied by the exchange rate of the selected currency. - check1stselectwrite your multiplication 'SELECT object.price * 2.4 as price ...' - Bookin$query- check1st$query-$query->andFilterWhere(['like', 'type_flat.id',$this->type_house]);,$query->andFilterWhere(['between', 'object.price', $this->price_from != null ? $this->price_from : 0, $this->price_to != null ? $this->price_to : $max_price]);etc. - Vlad Shkuta