vinegredz Posted September 9, 2018 Share Posted September 9, 2018 Здравствуйте! Хочу выводить контент на странице исходя из размера баланса пользователя. Сейчас у меня вот так: {{if \IPS\nexus\Customer::loggedIn()->cm_credits}} {{foreach \IPS\nexus\Customer::loggedIn()->cm_credits as $value}} {{if $value > $record->fieldValues()['field_66'] }} <!--Баланс больше порога--> {{else}} <!--Баланс меньше порога--> {{endif}} {{endforeach}} {{endif}} Проблема в том, что это не работает. Думаю, что все дело в типах данных которые хранят переменные. Решил перевести $value к числу с плавающей точкой вот так: {{if $value = (float)$value > $record->fieldValues()['field_66'] }} При этом $record->fieldValues()['field_66'] всегда число. Подскажите, как написать необходимое условие) Link to comment Share on other sites More sharing options...
vinegredz Posted September 9, 2018 Author Share Posted September 9, 2018 Сделал так: {$value = str_replace(" руб", "", $value)} Кажется, работает, но чувствую, что какая-то лажа) Link to comment Share on other sites More sharing options...
newbie Posted September 9, 2018 Share Posted September 9, 2018 {{if $value->amountAsString() > $record->fieldValues()['field_66'] }} 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now