| @@ 411-420 (lines=10) @@ | ||
| 408 | ||
| 409 | public function calculateShippingCosts(Order $order) |
|
| 410 | { |
|
| 411 | if (!$order->deliveryAddress) { |
|
| 412 | return new Shipping([ |
|
| 413 | 'isShippable' => false, |
|
| 414 | 'messages' => [ |
|
| 415 | new Message([ |
|
| 416 | 'message' => 'delivery_address_empty' |
|
| 417 | ]) |
|
| 418 | ] |
|
| 419 | ]); |
|
| 420 | } |
|
| 421 | ||
| 422 | $countryIso3 = $order->deliveryAddress->country; |
|
| 423 | $country = $this->manager->getRepository('Shopware\Models\Country\Country')->findOneBy(['iso3' => $countryIso3]); |
|
| @@ 447-456 (lines=10) @@ | ||
| 444 | ||
| 445 | /* @var \Shopware\Models\Shop\Shop $shop */ |
|
| 446 | $shop = $this->manager->getRepository('Shopware\Models\Shop\Shop')->getActiveDefault(); |
|
| 447 | if (!$shop) { |
|
| 448 | return new Shipping([ |
|
| 449 | 'isShippable' => false, |
|
| 450 | 'messages' => [ |
|
| 451 | new Message([ |
|
| 452 | 'message' => 'default_shop_not_found' |
|
| 453 | ]) |
|
| 454 | ] |
|
| 455 | ]); |
|
| 456 | } |
|
| 457 | $shop->registerResources(Shopware()->Container()->get('bootstrap')); |
|
| 458 | ||
| 459 | /** @var /Enlight_Components_Session_Namespace $session */ |
|
| @@ 504-513 (lines=10) @@ | ||
| 501 | /** @var Dispatch $shipping */ |
|
| 502 | $shipping = $this->manager->getRepository(Dispatch::class)->find($shippingMethod['id']); |
|
| 503 | ||
| 504 | if (!$shipping) { |
|
| 505 | return new Shipping([ |
|
| 506 | 'isShippable' => false, |
|
| 507 | 'messages' => [ |
|
| 508 | new Message([ |
|
| 509 | 'message' => 'default_shipping_not_found' |
|
| 510 | ]) |
|
| 511 | ] |
|
| 512 | ]); |
|
| 513 | } |
|
| 514 | ||
| 515 | $session->offsetSet('sDispatch', $shipping->getId()); |
|
| 516 | ||
| @@ 518-527 (lines=10) @@ | ||
| 515 | $session->offsetSet('sDispatch', $shipping->getId()); |
|
| 516 | ||
| 517 | $result = Shopware()->Modules()->Admin()->sGetPremiumShippingcosts(['id' => $country->getId()]); |
|
| 518 | if (!is_array($result)) { |
|
| 519 | return new Shipping([ |
|
| 520 | 'isShippable' => false, |
|
| 521 | 'messages' => [ |
|
| 522 | new Message([ |
|
| 523 | 'message' => 'checkout_not_possible' |
|
| 524 | ]) |
|
| 525 | ] |
|
| 526 | ]); |
|
| 527 | } |
|
| 528 | ||
| 529 | $sql = 'DELETE FROM s_order_basket WHERE sessionID=?'; |
|
| 530 | Shopware()->Db()->executeQuery($sql, [ |
|