controller/frontend/src/Controller/Frontend/Basket/Standard.php
public function store()
	{
		$total = 0;
		$context = $this->getContext();
		$config = $context->getConfig();

		/** controller/frontend/basket/limit-count
		 * Maximum number of orders within the time frame
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. The number of orders created within the time frame
		 * configured by "controller/frontend/basket/limit-seconds" are counted
		 * before a new order of the same user (either logged in or identified
		 * by the IP address) is created. If the number of orders is higher than
		 * the configured value, an error message will be shown to the user
		 * instead of creating a new order.
		 *
		 * @param integer Number of orders allowed within the time frame
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-seconds
		 */
		$count = $config->get( 'controller/frontend/basket/limit-count', 5 );

		/** controller/frontend/basket/limit-seconds
		 * Order limitation time frame in seconds
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. Within the configured time frame, only a limited
		 * number of orders can be created. All orders of the current user
		 * (either logged in or identified by the IP address) within the last X
		 * seconds are counted. If the total value is higher then the number
		 * configured in "controller/frontend/basket/limit-count", an error
		 * message will be shown to the user instead of creating a new order.
		 *
		 * @param integer Number of seconds to check orders within
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-count
		 */
		$seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 );

		$search = $this->manager->createSearch();
		$expr = [
			$search->compare( '==', 'order.base.editor', $context->getEditor() ),
			$search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
		];
		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSlice( 0, 0 );

		$this->manager->searchItems( $search, [], $total );

		if( $total > $count )
		{
			$msg = $context->getI18n()->dt( 'controller/frontend', 'Temporary order limit reached' );
			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
		}


		$basket = $this->get()->finish();
		$basket->setCustomerId( (string) $context->getUserId() );

		$this->manager->begin();
		$this->manager->store( $basket );
		$this->manager->commit();

		$this->save(); // for reusing unpaid orders, might have side effects (!)
		$this->createSubscriptions( $basket );

		return $basket;
	}
public function store()
	{
		$total = 0;
		$context = $this->getContext();
		$config = $context->getConfig();

		/** controller/frontend/basket/limit-count
		 * Maximum number of orders within the time frame
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. The number of orders created within the time frame
		 * configured by "controller/frontend/basket/limit-seconds" are counted
		 * before a new order of the same user (either logged in or identified
		 * by the IP address) is created. If the number of orders is higher than
		 * the configured value, an error message will be shown to the user
		 * instead of creating a new order.
		 *
		 * @param integer Number of orders allowed within the time frame
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-seconds
		 */
		$count = $config->get( 'controller/frontend/basket/limit-count', 5 );

		/** controller/frontend/basket/limit-seconds
		 * Order limitation time frame in seconds
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. Within the configured time frame, only a limited
		 * number of orders can be created. All orders of the current user
		 * (either logged in or identified by the IP address) within the last X
		 * seconds are counted. If the total value is higher then the number
		 * configured in "controller/frontend/basket/limit-count", an error
		 * message will be shown to the user instead of creating a new order.
		 *
		 * @param integer Number of seconds to check orders within
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-count
		 */
		$seconds = $config->get( 'controller/frontend/basket/limit-seconds', 300 );

		$search = $this->manager->createSearch();
		$expr = [
			$search->compare( '==', 'order.base.editor', $context->getEditor() ),
			$search->compare( '>=', 'order.base.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
		];
		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSlice( 0, 0 );

		$this->manager->searchItems( $search, [], $total );

		if( $total > $count )
		{
			$msg = $context->getI18n()->dt( 'controller/frontend', 'Temporary order limit reached' );
			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
		}


		$basket = $this->get()->finish();
		$basket->setCustomerId( (string) $context->getUserId() );

		$this->manager->begin();
		$this->manager->store( $basket );
		$this->manager->commit();

		$this->save(); // for reusing unpaid orders, might have side effects (!)
		$this->createSubscriptions( $basket );

		return $basket;
	}
public function store ( ) { $ total = 0 ; $ context = $ this -> getContext ( ) ; $ config = $ context -> getConfig ( ) ; /** controller/frontend/basket/limit-count
		 * Maximum number of orders within the time frame
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. The number of orders created within the time frame
		 * configured by "controller/frontend/basket/limit-seconds" are counted
		 * before a new order of the same user (either logged in or identified
		 * by the IP address) is created. If the number of orders is higher than
		 * the configured value, an error message will be shown to the user
		 * instead of creating a new order.
		 *
		 * @param integer Number of orders allowed within the time frame
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-seconds
		 */ $ count = $ config -> get ( 'controller/frontend/basket/limit-count' , 5 ) ; /** controller/frontend/basket/limit-seconds
		 * Order limitation time frame in seconds
		 *
		 * Creating new orders is limited to avoid abuse and mitigate denial of
		 * service attacks. Within the configured time frame, only a limited
		 * number of orders can be created. All orders of the current user
		 * (either logged in or identified by the IP address) within the last X
		 * seconds are counted. If the total value is higher then the number
		 * configured in "controller/frontend/basket/limit-count", an error
		 * message will be shown to the user instead of creating a new order.
		 *
		 * @param integer Number of seconds to check orders within
		 * @since 2017.05
		 * @category Developer
		 * @see controller/frontend/basket/limit-count
		 */ $ seconds = $ config -> get ( 'controller/frontend/basket/limit-seconds' , 300 ) ; $ search = $ this -> manager -> createSearch ( ) ; $ expr = [ $ search -> compare ( '==' , 'order.base.editor' , $ context -> getEditor ( ) ) , $ search -> compare ( '>=' , 'order.base.ctime' , date ( 'Y-m-d H:i:s' , time ( ) - $ seconds ) ) , ] ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ search -> setSlice ( 0 , 0 ) ; $ this -> manager -> searchItems ( $ search , [ ] , $ total ) ; if ( $ total > $ count ) { $ msg = $ context -> getI18n ( ) -> dt ( 'controller/frontend' , 'Temporary order limit reached' ) ; throw new \ Aimeos \ Controller \ Frontend \ Basket \ Exception ( $ msg ) ; } $ basket = $ this -> get ( ) -> finish ( ) ; $ basket -> setCustomerId ( ( string ) $ context -> getUserId ( ) ) ; $ this -> manager -> begin ( ) ; $ this -> manager -> store ( $ basket ) ; $ this -> manager -> commit ( ) ; $ this -> save ( ) ; // for reusing unpaid orders, might have side effects (!) $ this -> createSubscriptions ( $ basket ) ; return $ basket ; }
Creates a new order base object from the current basket

@return \Aimeos\MShop\Order\Item\Base\Iface Order base object including products, addresses and services
Creates a new order base object from the current basket