| @@ 499-511 (lines=13) @@ | ||
| 496 | $countryIso3 = $order->deliveryAddress->country; |
|
| 497 | $country = $this->manager->getRepository('Shopware\Models\Country\Country')->findOneBy(['iso3' => $countryIso3]); |
|
| 498 | ||
| 499 | if (!$country) { |
|
| 500 | return new Shipping([ |
|
| 501 | 'isShippable' => false, |
|
| 502 | 'messages' => [ |
|
| 503 | new Message([ |
|
| 504 | 'message' => 'order_not_shippable_to_country', |
|
| 505 | 'values' => [ |
|
| 506 | 'country' => $countryIso3, |
|
| 507 | ] |
|
| 508 | ]) |
|
| 509 | ] |
|
| 510 | ]); |
|
| 511 | } |
|
| 512 | ||
| 513 | if (count($order->orderItems) == 0) { |
|
| 514 | throw new \InvalidArgumentException( |
|
| @@ 559-571 (lines=13) @@ | ||
| 556 | } |
|
| 557 | ||
| 558 | $shippingMethods = Shopware()->Modules()->Admin()->sGetPremiumDispatches($country->getId()); |
|
| 559 | if (empty($shippingMethods)) { |
|
| 560 | return new Shipping([ |
|
| 561 | 'isShippable' => false, |
|
| 562 | 'messages' => [ |
|
| 563 | new Message([ |
|
| 564 | 'message' => 'order_not_shippable_to_country', |
|
| 565 | 'values' => [ |
|
| 566 | 'country' => $countryIso3, |
|
| 567 | ] |
|
| 568 | ]) |
|
| 569 | ] |
|
| 570 | ]); |
|
| 571 | } |
|
| 572 | ||
| 573 | $shippingMethod = reset($shippingMethods); |
|
| 574 | ||