delivery stiker - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of delivery stiker.php
- <?php
- function get_free_delivery($item)
- {
- if($item['id'] == 21912) return false;
- if(!in_array($item['group_id'], array(1, 2, 3, 4, 5, 11, 15, 25, 27)))
- return false;
- if($item['instock_warehouse'] != NULL && ($item['margin']??0)>2000)
- return true;
- if(in_array($item["manufacturer"], array("Искра", "ИТС", "Сэлма", "ЭТА", "ЭСВА")))
- return false;
- if ($item["weight"] > 200)
- return false;
- if ($item["weight"] == NULL)
- return false;
- if(in_array($item['group_id'], array(1, 2, 3, 4, 5, 27))) {
- if ($item["margin"] > 3000)
- return true;
- if ($item["margin"] > 2000 && in_array($item["manufacturer"], array("Сварог", "Aurora", "Triton", "Gazvolt", "EWM", "GasIQ", "Blueweld", "Fubag", "Endress", "Translas", "Abac", "Comaro", "Kraftmann")))
- return true;
- }
- if($item['group_id'] == 11 || $item['group_id'] == 15) { //generators - Генераторы
- if ($item["weight"] < 50 && $item["margin"] >= 5000) {
- $delivery = true;
- } elseif ($item["weight"] < 81 && $item["margin"] >= 8000) {
- $delivery = true;
- } elseif ($item["weight"] < 100 && $item["margin"] >= 10000) {
- $delivery = true;
- } elseif ($item["weight"] < 150 && $item["margin"] >= 16000) {
- $delivery = true;
- } elseif ($item["weight"] < 200 && $item["margin"] >= 22000) {
- $delivery = true;
- } elseif ($item["weight"] < 250 && $item["margin"] >= 28000) {
- $delivery = true;
- } elseif ($item["weight"] < 300 && $item["margin"] >= 34000) {
- $delivery = true;
- } elseif ($item["weight"] == 0) {
- $delivery = false;
- } elseif ($item["margin"] == 0) {
- $delivery = false;
- } else {
- $delivery = false;
- }
- return $delivery;
- }
- if($item['group_id'] == 25) return true;
- return false;
- }
File Description
- delivery stiker
- PHP Code
- 18 Feb-2020
- 1.94 Kb
You can Share it:
Latest PHP Pastes