controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context,
		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services )
	{
		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;

		if( isset( $services[$type] ) )
		{
			foreach( $services[$type] as $orderService ) {
				$newBasket->addService( $orderService, $type );
			}
		}

		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY;

		$serviceManager = \Aimeos\MShop::create( $context, 'service' );
		$orderServiceManager = \Aimeos\MShop::create( $context, 'order/base/service' );

		$search = $serviceManager->createSearch( true );
		$search->setSortations( [$search->sort( '+', 'service.position' )] );
		$search->setConditions( $search->compare( '==', 'service.type', $type ) );

		foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item )
		{
			$provider = $serviceManager->getProvider( $item, $item->getType() );

			if( $provider->isAvailable( $newBasket ) === true )
			{
				$orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item );
				return $newBasket->addService( $orderServiceItem, $type );
			}
		}

		return $newBasket;
	}
protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context,
		\Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services )
	{
		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;

		if( isset( $services[$type] ) )
		{
			foreach( $services[$type] as $orderService ) {
				$newBasket->addService( $orderService, $type );
			}
		}

		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY;

		$serviceManager = \Aimeos\MShop::create( $context, 'service' );
		$orderServiceManager = \Aimeos\MShop::create( $context, 'order/base/service' );

		$search = $serviceManager->createSearch( true );
		$search->setSortations( [$search->sort( '+', 'service.position' )] );
		$search->setConditions( $search->compare( '==', 'service.type', $type ) );

		foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item )
		{
			$provider = $serviceManager->getProvider( $item, $item->getType() );

			if( $provider->isAvailable( $newBasket ) === true )
			{
				$orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item );
				return $newBasket->addService( $orderServiceItem, $type );
			}
		}

		return $newBasket;
	}
protected function addBasketServices ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , \ Aimeos \ MShop \ Order \ Item \ Base \ Iface $ newBasket , array $ services ) { $ type = \ Aimeos \ MShop \ Order \ Item \ Base \ Service \ Base :: TYPE_PAYMENT ; if ( isset ( $ services [ $ type ] ) ) { foreach ( $ services [ $ type ] as $ orderService ) { $ newBasket -> addService ( $ orderService , $ type ) ; } } $ type = \ Aimeos \ MShop \ Order \ Item \ Base \ Service \ Base :: TYPE_DELIVERY ; $ serviceManager = \ Aimeos \ MShop :: create ( $ context , 'service' ) ; $ orderServiceManager = \ Aimeos \ MShop :: create ( $ context , 'order/base/service' ) ; $ search = $ serviceManager -> createSearch ( true ) ; $ search -> setSortations ( [ $ search -> sort ( '+' , 'service.position' ) ] ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'service.type' , $ type ) ) ; foreach ( $ serviceManager -> searchItems ( $ search , [ 'media' , 'price' , 'text' ] ) as $ item ) { $ provider = $ serviceManager -> getProvider ( $ item , $ item -> getType ( ) ) ; if ( $ provider -> isAvailable ( $ newBasket ) === true ) { $ orderServiceItem = $ orderServiceManager -> createItem ( ) -> copyFrom ( $ item ) ; return $ newBasket -> addService ( $ orderServiceItem , $ type ) ; } } return $ newBasket ; }
Adds a matching delivery and payment service to the basket

@param \Aimeos\MShop\Context\Item\Iface Context object
@param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the services to
@param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values
@return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added
Adds a matching delivery and payment service to the basket