@VirtualProperty
@SerializedName("deliveryCostFormatted")
@Groups({"Default","cart"})

@return string
348157
public function getDeliveryCostFormatted($locale = null)
    {
        $formatter = $this->getFormatter($locale);

        return $formatter->format((float)$this->entity->getDeliveryCost());
    }
698247
public function serialize()
    {
        $args = join(' ', $this->args);

        // nargs must be last and only 1

        $options = [];
        $narg = null;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                $narg = "$option ".join(' ', array_map('strval', $value));
                continue;
            }

            if (is_numeric($option)) {
                $options[] = strval($value);
            } elseif (is_bool($value)) {
                $options[] = $option;
            } else {
                $options[] = trim("$option $value");
            }
        }

        if (!is_null($narg)) {
            array_push($options, $narg);
        }

        return trim(preg_replace('/[\s]{2,}/', ' ', "{$this->binary} $args ".join(' ', $options)) ?: '');
    }
1264014
public function getShippingSetList()
    {
        // in which country we deliver
        if (!($sShipId = $this->oxorder__oxdelcountryid->value)) {
            $sShipId = $this->oxorder__oxbillcountryid->value;
        }

        $oBasket = $this->_getOrderBasket(false);

        // unsetting bundles
        $oOrderArticles = $this->getOrderArticles();
        foreach ($oOrderArticles as $sItemId => $oItem) {
            if ($oItem->isBundle()) {
                $oOrderArticles->offsetUnset($sItemId);
            }
        }

        // add this order articles to basket and recalculate basket
        $this->_addOrderArticlesToBasket($oBasket, $oOrderArticles);

        // recalculating basket
        $oBasket->calculateBasket(true);

        // load fitting deliveries list
        $oDeliveryList = oxNew(\OxidEsales\Eshop\Application\Model\DeliveryList::class, "core");
        $oDeliveryList->setCollectFittingDeliveriesSets(true);

        return $oDeliveryList->getDeliveryList($oBasket, $this->getOrderUser(), $sShipId);
    }
1039768
protected function generateEtag()
    {
        $keys      = array();
        $updatedAt = '';

        if (is_array($this->data)) {
            $keys = array_keys($this->data);

            if (isset($this->data['updated_at'])) {
                $updatedAt = $this->data->updated_at;
            }
        }

        if (is_object($this->data)) {
            $objectVars = get_object_vars($this->data);
            $keys = array_keys($objectVars);
            unset($objectVars);

            if (isset($this->data->updated_at)) {
                $updatedAt = $this->data->updated_at;
            }
        }

        $etag = '';

        if (empty($keys)) {
            return $etag;
        }

        foreach($keys as $item) {
            $etag .= $item;
        }

        $etag .= $updatedAt;

        return md5( $etag );
    }
761201
public function getData()
    {
        $awaiting = $this->getNumberOfAssessments(DeliveryExecution::STATE_AWAITING);
        $authorized = $this->getNumberOfAssessments(DeliveryExecution::STATE_AUTHORIZED);
        $paused = $this->getNumberOfAssessments(DeliveryExecution::STATE_PAUSED);
        $active = $this->getNumberOfAssessments(DeliveryExecution::STATE_ACTIVE);
        $current = $awaiting + $authorized + $paused + $active;
        $assessments = [
            self::GROUPFIELD_USER_ACTIVITY => [
                self::FIELD_ACTIVE_PROCTORS => $this->getNumberOfActiveUsers(ProctorService::ROLE_PROCTOR),
                self::FIELD_ACTIVE_TEST_TAKERS => $this->getNumberOfActiveUsers(TaoRoles::DELIVERY),
            ],
            self::FIELD_TOTAL_ASSESSMENTS => $this->getNumberOfAssessments(),
            self::FIELD_TOTAL_CURRENT_ASSESSMENTS => $current,
            self::STATE_AWAITING_ASSESSMENT => $awaiting,
            self::STATE_AUTHORIZED_BUT_NOT_STARTED_ASSESSMENTS => $authorized,
            self::STATE_PAUSED_ASSESSMENTS => $paused,
            self::STATE_IN_PROGRESS_ASSESSMENTS => $active
        ];

        return $assessments;
    }
114376
public function getOrderItem()
    {
        if (null === $this->orderItem && null !== $this->getOrderItemId()) {
            $oOrderItem = TdbShopOrderItem::GetNewInstance();
            if (false === $oOrderItem->Load($this->getOrderItemId())) {
                $sMsg = "unable to load the shop_order_item [{$this->getOrderItemId()}]";
                throw new TPkgCmsException_LogAndMessage(
                    TPkgShopPaymentTransactionManager::MESSAGE_ERROR,
                    array('sMessage' => $sMsg),
                    $sMsg,
                    array('item' => $this)
                );
            } else {
                $this->orderItem = $oOrderItem;
            }
        }

        return $this->orderItem;
    }
1284460
protected function getItemData()
    {
        $result = '';
        $items = $this->getItems();

        // If there are no items, then do not construct any of the basket.
        if (empty($items) || $items->all() === array()) {
            return $result;
        }

        $xml = new \SimpleXMLElement('<basket/>');
        $cartHasDiscounts = false;

        foreach ($items as $basketItem) {
            if ($basketItem->getPrice() < 0) {
                $cartHasDiscounts = true;
            } else {
                $vat = '0.00';
                if ($basketItem instanceof ExtendItem) {
                    $vat = $basketItem->getVat();
                }

                $total = ($basketItem->getQuantity() * ($basketItem->getPrice() + $vat));
                $item = $xml->addChild('item');
                $item->description = $this->filterItemName($basketItem->getName());
                $item->addChild('quantity', $basketItem->getQuantity());
                $item->addChild('unitNetAmount', $basketItem->getPrice());
                $item->addChild('unitTaxAmount', $vat);
                $item->addChild('unitGrossAmount', $basketItem->getPrice() + $vat);
                $item->addChild('totalGrossAmount', $total);
            }
        }

        if ($cartHasDiscounts) {
            $discounts = $xml->addChild('discounts');
            foreach ($items as $discountItem) {
                if ($discountItem->getPrice() < 0) {
                    $discount = $discounts->addChild('discount');
                    $discount->addChild('fixed', ($discountItem->getPrice() * $discountItem->getQuantity()) * -1);
                    $discount->description = $this->filterDiscountName($discountItem->getName());
                }
            }
        }

        $xmlString = $xml->asXML();

        if ($xmlString) {
            $result = $xmlString;
        }

        return $result;
    }
487943
public function getControllerObjectName()
    {
        $possibleObjectName = '@package\@subpackage\Controller\@controllerController';
        $possibleObjectName = str_replace('@package', str_replace('.', '\\', $this->controllerPackageKey), $possibleObjectName);
        $possibleObjectName = str_replace('@subpackage', $this->controllerSubpackageKey, $possibleObjectName);
        $possibleObjectName = str_replace('@controller', $this->controllerName, $possibleObjectName);
        $possibleObjectName = str_replace('\\\\', '\\', $possibleObjectName);

        $controllerObjectName = $this->objectManager->getCaseSensitiveObjectName($possibleObjectName);
        return ($controllerObjectName !== false) ? $controllerObjectName : '';
    }
958557
static public function serviceMapping () {
        return [
            BringData::PRODUCT_SERVICEPAKKE => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_SOCIAL_CONTROL],
            BringData::PRODUCT_BPAKKE_DOR_DOR => [self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_SIMPLE_DELIVERY, self::ADDITIONAL_SERVICE_DELIVERY_OPTION],
            BringData::PRODUCT_EKSPRESS09 => [self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_SATURDAY_DELIVERY],
            BringData::PRODUCT_PICKUP_PARCEL => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_OPTION],
            BringData::PRODUCT_PICKUP_PARCEL_BULK => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_OPTION],
            BringData::PRODUCT_HOME_DELIVERY_PARCEL => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION],
            BringData::PRODUCT_BUSINESS_PARCEL => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_BUSINESS_PARCEL_BULK => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_EXPRESS_NORDIC_0900_BULK => [self::ADDITIONAL_SERVICE_CASH_ON_DELIVERY, self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_BUSINESS_PALLET => [self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_BUSINESS_PARCEL_HALFPALLET => [self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_BUSINESS_PARCEL_QUARTERPALLET => [self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS],
            BringData::PRODUCT_EXPRESS_NORDIC_0900 => [self::ADDITIONAL_SERVICE_FLEX_DELIVERY, self::ADDITIONAL_SERVICE_RECIPIENT_NOTIFICATION, self::ADDITIONAL_SERVICE_PHONE_NOTIFICATION, self::ADDITIONAL_SERVICE_DELIVERY_INDOORS]
        ];
    }
549154
public function getLabel()
    {
        /** @var DeliveryFieldsService $deliveryFieldsService */
        $deliveryFieldsService = ServiceManager::getServiceManager()->get(DeliveryFieldsService::SERVICE_ID);
        $delivery = $this->getResource($this->getDeliveryId());
        $label = $deliveryFieldsService->getLabel(
            $delivery,
            $this->label
        );
        return $label;
    }
132724
public function getCurrentCart()
    {
        // Grab the session
        $session = $this->getRequest()->getSession();

        // Start with an null OrderCollection
        $orderCollection = null;

        // Check if we have a reference to the cart in the session
        if ($session->get('cart_id')) {
            $orderCollection = $this->getRepo('OrderCollection')
                ->find($session->get('cart_id'));
        }

        // If we still don't have an OrderCollection, create one and persist it
        if (!$orderCollection) {
            $orderCollection = new OrderCollection();

            // Persist new so that we get a 'cart_id'
            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($orderCollection);
            $em->flush();

            // Save new cart to session
            $session->set('cart_id', $orderCollection->getId());
        }

        // If the current User is fully authenticated, set the current Profile
        // as the Buyer. If the user is not yet fully authenticated, then the
        // Buyer will be assigned at login
        if ($this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
            $user = $this->get('security.context')->getToken()->getUser();
            $orderCollection->setBuyer($this->get('profile_handler')->getCurrent());
        }

        return $orderCollection;
    }
98845
public function jsonSerialize() {
        $ret = new \stdClass();

        $ret->maxRecipients = $this->maxRecipients;
        $ret->priority = $this->priority;

        if (is_null($this->deliveryStartDateTime) === false) {
            $ret->deliveryStartDateTime = $this->deliveryStartDateTime->format("Y-m-d\TH:i:s");
        }

        if (is_null($this->compileStartDateTime) === false) {
            $ret->compileStartDateTime = $this->compileStartDateTime->format("Y-m-d\TH:i:s");
        }

        $ret->compileBeforeDeliveryStart = $this->compileBeforeDeliveryStart;
        $ret->allowMultipleDeliveries = $this->allowMultipleDeliveries;
        $ret->deliverImmediately = $this->deliverImmediately;
        $ret->deliveryFrequency = $this->deliveryFrequency;
        $ret->obeyDeliveryLimits = $this->obeyDeliveryLimits;

        return $ret;
    }
498381
public function getFormattedWrapCost()
    {
        return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxwrapcost->value, $this->getOrderCurrency());
    }
283039
public function getDeliveryAddress()
    {
        $address = ($this->DeliveryAddress1) ? $this->DeliveryAddress1 . ",\n" : '';
        $address .= ($this->DeliveryAddress2) ? $this->DeliveryAddress2 . ",\n" : '';
        $address .= ($this->DeliveryCity) ? $this->DeliveryCity . ",\n" : '';
        $address .= ($this->DeliveryPostCode) ? $this->DeliveryPostCode . ",\n" : '';
        $address .= ($this->DeliveryCountry) ? $this->DeliveryCountry : '';

        return $address;
    }
80611
protected function _getPayload()
	{
		$aPayload = parent::_getPayload();

		$aPayload['aps']['alert'] = array();

		if (isset($this->_sText) && !isset($this->_sLocKey)) {
			$aPayload['aps']['alert']['body'] = (string)$this->_sText;
		}

		if (isset($this->_sActionLocKey)) {
			$aPayload['aps']['alert']['action-loc-key'] = $this->_sActionLocKey == '' ?
				null : (string)$this->_sActionLocKey;
		}

		if (isset($this->_sLocKey)) {
			$aPayload['aps']['alert']['loc-key'] = (string)$this->_sLocKey;
		}

		if (isset($this->_aLocArgs)) {
			$aPayload['aps']['alert']['loc-args'] = $this->_aLocArgs;
		}

		if (isset($this->_sLaunchImage)) {
			$aPayload['aps']['alert']['launch-image'] = (string)$this->_sLaunchImage;
		}

		if (isset($this->_sTitle)) {
			$aPayload['aps']['alert']['title'] = (string)$this->_sTitle;
		}
		
		if (isset($this->_sSubTitle)) {
			$aPayload['aps']['alert']['subtitle'] = (string)$this->_sSubTitle;
		}
		return $aPayload;
	}
701485
public function getDeliveryStatus()
    {
        $status = $this->entity->getDeliveryStatus();
        if ($status !== null) {
            return new DeliveryStatus($status, $this->locale);
        }

        return null;
    }
709715
public function &GetOwningBundleOrderItem()
    {
        $oOwningOrderItem = $this->GetFromInternalCache('oOwningOrderItem');
        if (is_null($oOwningOrderItem)) {
            $oOwningOrderItem = false;
            if (!is_null($this->id)) {
                $query = "SELECT `shop_order_item`.*
                      FROM `shop_order_item`
                INNER JOIN `shop_order_bundle_article` ON `shop_order_item`.`id` = `shop_order_bundle_article`.`shop_order_item_id`
                     WHERE `shop_order_bundle_article`.`bundle_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
                   ";
                if ($aOwner = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
                    $oOwningOrderItem = TdbShopOrderItem::GetNewInstance();
                    /** @var $oOwningOrderItem TdbShopOrderItem */
                    $oOwningOrderItem->LoadFromRow($aOwner);
                }
            }
            $this->SetInternalCache('oOwningOrderItem', $oOwningOrderItem);
        }

        return $oOwningOrderItem;
    }