| @@ 485-494 (lines=10) @@ | ||
| 482 | ||
| 483 | public function calculateShippingCosts(Order $order) |
|
| 484 | { |
|
| 485 | if (!$order->deliveryAddress) { |
|
| 486 | return new Shipping([ |
|
| 487 | 'isShippable' => false, |
|
| 488 | 'messages' => [ |
|
| 489 | new Message([ |
|
| 490 | 'message' => 'delivery_address_empty' |
|
| 491 | ]) |
|
| 492 | ] |
|
| 493 | ]); |
|
| 494 | } |
|
| 495 | ||
| 496 | $countryIso3 = $order->deliveryAddress->country; |
|
| 497 | $country = $this->manager->getRepository('Shopware\Models\Country\Country')->findOneBy(['iso3' => $countryIso3]); |
|
| @@ 521-530 (lines=10) @@ | ||
| 518 | ||
| 519 | /* @var \Shopware\Models\Shop\Shop $shop */ |
|
| 520 | $shop = $this->manager->getRepository('Shopware\Models\Shop\Shop')->getActiveDefault(); |
|
| 521 | if (!$shop) { |
|
| 522 | return new Shipping([ |
|
| 523 | 'isShippable' => false, |
|
| 524 | 'messages' => [ |
|
| 525 | new Message([ |
|
| 526 | 'message' => 'default_shop_not_found' |
|
| 527 | ]) |
|
| 528 | ] |
|
| 529 | ]); |
|
| 530 | } |
|
| 531 | $shop->registerResources(Shopware()->Container()->get('bootstrap')); |
|
| 532 | ||
| 533 | /** @var /Enlight_Components_Session_Namespace $session */ |
|
| @@ 578-587 (lines=10) @@ | ||
| 575 | /** @var Dispatch $shipping */ |
|
| 576 | $shipping = $this->manager->getRepository(Dispatch::class)->find($shippingMethod['id']); |
|
| 577 | ||
| 578 | if (!$shipping) { |
|
| 579 | return new Shipping([ |
|
| 580 | 'isShippable' => false, |
|
| 581 | 'messages' => [ |
|
| 582 | new Message([ |
|
| 583 | 'message' => 'default_shipping_not_found' |
|
| 584 | ]) |
|
| 585 | ] |
|
| 586 | ]); |
|
| 587 | } |
|
| 588 | ||
| 589 | $session->offsetSet('sDispatch', $shipping->getId()); |
|
| 590 | ||
| @@ 592-601 (lines=10) @@ | ||
| 589 | $session->offsetSet('sDispatch', $shipping->getId()); |
|
| 590 | ||
| 591 | $result = Shopware()->Modules()->Admin()->sGetPremiumShippingcosts(['id' => $country->getId()]); |
|
| 592 | if (!is_array($result)) { |
|
| 593 | return new Shipping([ |
|
| 594 | 'isShippable' => false, |
|
| 595 | 'messages' => [ |
|
| 596 | new Message([ |
|
| 597 | 'message' => 'checkout_not_possible' |
|
| 598 | ]) |
|
| 599 | ] |
|
| 600 | ]); |
|
| 601 | } |
|
| 602 | ||
| 603 | $sql = 'DELETE FROM s_order_basket WHERE sessionID=?'; |
|
| 604 | Shopware()->Db()->executeQuery($sql, [ |
|