PHP calculate % and extract the result
3 USDПолучаю цену в Woocommerce:
<?php echo esc_attr( $product->get_price() ); ?>
Задача: вывести следующей строкой новую цену, которая считается автоматически -5% от текущей цены.
На выходе нужно просто получить новую цену с округлением вниз, т.е. если мы получили 173.30 , то будет 170.
Client's feedback on cooperation with freelancer
PHP calculate % and extract the resultI solved several tasks on PHP in 10 minutes. pleasant to work 🙂
Freelancer's feedback on cooperation with Vladislavs Sipov
PHP calculate % and extract the resultExcellent customer, clearly placed tasks and paid in time, I recommend cooperation
Profile deleted
-
473 21 0 Ready to take up the task.
Email: [email protected]
Здравствуйте, готов взяться за выполнение задания.
Email: [email protected]
-
1137 75 0 I will be happy to take your task. We will decide during the evening.
С удовольствием возьмусь за вашу задачу. Решим в течении вечера.
-
1 day5 USD
2748 153 0 1 1 day5 USDHello to you. Ready to do.
Здравствуйте. Готов сделать.
-
С проверкой, если цена меньше 10 округляем до меньшего целого
<?php echo esc_attr(($product->get_price()>10)?(floor(($product->get_price()*0.95)/10)*10):floor($c*0.95)); ?>
-
Ребята, зря мы старались...
-
Я в шоке, господа! Благодарю вас за доброту и щедрость. К сожалению не увидел комментариев, а в лс уже постучались и предложили решение.
Поздно заметил, если бы Алексей не стукнул в ЛС сейчас, то и совсем не увидел )
-
Решение кстати подошло следующее:
<?php echo esc_attr(floor($product->get_price()-$product->get_price()/100*5)); ?>
-
Если 119.00 РУБ, то должно стать 113.00 РУБ, но проблема еще в том, что:
<?php echo esc_attr( $product->get_price() ); ?>
выводит только 119 РУБ и на выходе я получаю 113 РУБ, но дописываю с помощью HTML в конец .00 РУБ
Всё из-за того что полную цену выводит:
<?php woocommerce_template_single_price(); ?>
А к такому выражению, которое подтягивает другой документ вычисления исполнитель не смог приминить, что наверное и невозможно. -
Еще один моент:
esc_attr() WP 2.8.0
Преобразует знаки <, >, &, ", ' в html сущности. Не создает двойного преобразования.
Функция предназначена для фильтрации строки, которую планируется выводить в значениях html атрибутов.
В данном случае esc_attr() нафиг не нужна дя обработки результата floor ...
Наверное надо закругляться - на такую пустяковую задачу 26 сообщений, да и проект закрыт ..
Всем пока. Было весело.
-
Current freelance projects in the category JavaScript
Write an extension for Google Chrome
22 USD
Extension is needed for Google Chrome (fake forecast of the next number or color for the casino) Need to remember the last entered numbers and when the button is pressed, a random number is displayed Also need to remember the entered color and when the button is pressed, show a… JavaScript, Web programming ∙ 3 proposals |
Fix the landing page for Google Ads, clean up compromised linksSpecialist needed to clean compromised links from the website https://armadom.com.ua/ (landing was done on webflow) Google support writes: clean compromised links added below: cdnmetric[.]com/ Write if you have experience with this and know how to fix it to pass the appeal in… JavaScript, Web programming |
Laravel + VueJS + InertiaJSGood day, the project is written, it is working and ready to launch. Except for one nuance. SSR(Server Side Rendering) works very slowly, when launching a bot to check the load - the site crashes after 3-4 minutes. If you restart SSR during the check, it works but very slowly.… JavaScript, PHP ∙ 2 proposals |
Writing software for creating an Open Book on the Solana network
107 USD
During the creation of interchangeable tokens (SPL token) on the Solana network, it is necessary to automate the process of creating an Open Book for the token and speed it up by increasing transaction fees. Software functions: - Create Open Book - Set a "tea" limit on the… Java, JavaScript |
Website layout according to the design.
510 USD
Good day. There is a layout in Figma: https://www.figma.com/file/RGVIymprYc4QaiJ5qp3iwL/LayerGame?type=design&node-id=0-1&mode=design There is a UI kit and a ready-made layout of the Main page, implemented in React, animations are done using GSAP. It is necessary to layout 2… HTML and CSS, JavaScript ∙ 38 proposals |