daramal Posted January 26, 2016 Report Share Posted January 26, 2016 Друзья, возник такой вопрос. Нужно вывести разницу между новой и старой ценой товара. Например, цена сейчас 100 руб., а была 120 руб. Сделали 100-120=-20 Сделал таким образом: {floor({$product->variant->price}-($product->variant->compare_price))} {$currency->sign|escape} Это работает, только неправильно работает, когда переключаешь валюту на сайте. Где и как можно довести до ума?! Спасибо за любую информацию! Quote Link to post Share on other sites
Solution mishanya Posted January 26, 2016 Solution Report Share Posted January 26, 2016 (edited) нужно использовать |convert {floor({$product->variant->price}-($product->variant->compare_price))|convert} Edited January 26, 2016 by mishanya Quote Link to post Share on other sites
daramal Posted January 26, 2016 Author Report Share Posted January 26, 2016 нужно использовать |convertя кстати и |convert добавлял. {floor({$product->variant->price|convert}-($product->variant->compare_price|convert))} только в этом случае опять при смены валюты неправильно вычитывает, а точнее показывает (0). а вот с дефолтной валютой все нормально считает. Quote Link to post Share on other sites
mishanya Posted January 26, 2016 Report Share Posted January 26, 2016 я кстати и |convert добавлял. {floor({$product->variant->price|convert}-($product->variant->compare_price|convert))} только в этом случае опять при смены валюты неправильно вычитывает, а точнее показывает (0). а вот с дефолтной валютой все нормально считает. все считаетhttps://yadi.sk/i/3BAO2paPnmNMthttps://yadi.sk/i/unqoGbT9nmNui Quote Link to post Share on other sites
daramal Posted January 26, 2016 Author Report Share Posted January 26, 2016 да, действительно. блин почему же у меня 0 показывает ((Можно, я Вам скину этот файл, посмотрите?! Пожалуйста! Quote Link to post Share on other sites
mishanya Posted January 26, 2016 Report Share Posted January 26, 2016 да, действительно. блин почему же у меня 0 показывает ((Можно, я Вам скину этот файл, посмотрите?! Пожалуйста!в личку архивом Quote Link to post Share on other sites
mishanya Posted January 26, 2016 Report Share Posted January 26, 2016 (edited) да, действительно. блин почему же у меня 0 показывает ((Можно, я Вам скину этот файл, посмотрите?! Пожалуйста! нужно использовать |convert не для двух операндов. а для результата. посмотрите как я написал выше. Edited January 26, 2016 by mishanya Quote Link to post Share on other sites
daramal Posted January 26, 2016 Author Report Share Posted January 26, 2016 нужно использовать |convert {floor({$product->variant->price}-($product->variant->compare_price))|convert} Спасибо огромное. Работает отлично теперь! Вы как всегда на высоте Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.