/** * @param ShopgateOrder $order * * @return mixed */ public function getCarrierIdByApiOrder($order) { switch ($order->getShippingType()) { case self::DEFAULT_PLUGIN_API_KEY: if ($order->getShippingInfos() && $order->getShippingInfos()->getName()) { return $order->getShippingInfos()->getName(); } break; default: /** * use always shopgate carrier if shipping cost uses. */ if ($order->getShippingInfos()->getAmount() > 0) { return Configuration::get('SG_CARRIER_ID'); } if ($order->getShippingGroup()) { $carrierMapping = $this->getCarrierMapping(); if (is_array($carrierMapping)) { foreach ($carrierMapping as $key => $value) { if ($order->getShippingGroup() == $key) { return $value; } } } break; } } return Configuration::get('SG_CARRIER_ID'); }