| @@ 60-69 (lines=10) @@ | ||
| 57 | \Cache::set('PickPointSession', [], $sessionId, 12 * 60 * 60); |
|
| 58 | } |
|
| 59 | $toId = ''; |
|
| 60 | foreach ($cart->delivery->fields as $field) { |
|
| 61 | if ($field->code === 'pickpoint') { |
|
| 62 | if (!empty($_POST['deliveryFields'][$field->id]) && is_string($_POST['deliveryFields'][$field->id])) { |
|
| 63 | $toId = $_POST['deliveryFields'][$field->id]; |
|
| 64 | } elseif (isset($cart->deliveryInfos[$field->id])) { |
|
| 65 | $toId = $cart->deliveryInfos[$field->id]->value; |
|
| 66 | } |
|
| 67 | break; |
|
| 68 | } |
|
| 69 | } |
|
| 70 | if (!$toId) { |
|
| 71 | return new \Money\Sums([$cart->delivery->currency_id => 0]); |
|
| 72 | } |
|
| @@ 24-32 (lines=9) @@ | ||
| 21 | */ |
|
| 22 | static function request($cart) { |
|
| 23 | $city = ''; |
|
| 24 | foreach ($cart->delivery->fields as $field) { |
|
| 25 | if ($field->code === 'index') { |
|
| 26 | if (!empty($_POST['deliveryFields'][$field->id]) && is_string($_POST['deliveryFields'][$field->id])) { |
|
| 27 | $city = $_POST['deliveryFields'][$field->id]; |
|
| 28 | } elseif (isset($cart->deliveryInfos[$field->id])) { |
|
| 29 | $city = $cart->deliveryInfos[$field->id]->value; |
|
| 30 | } |
|
| 31 | } |
|
| 32 | } |
|
| 33 | if (!$city) { |
|
| 34 | return []; |
|
| 35 | } |
|