client/html/src/Client/Html/Account/Download/Standard.php
protected function checkDownload( $id )
	{
		$context = $this->getContext();

		/** client/html/account/download/maxcount
		 * Maximum number of file downloads allowed for an ordered product
		 *
		 * This configuration setting enables you to limit the number of downloads
		 * of a product download file. The count is the maximum number for each
		 * bought product and customer, i.e. setting the count to "3" allows
		 * a customer to download the bought product file up to three times.
		 *
		 * The default value of null enforces no limit.
		 *
		 * @param integer Maximum number of downloads
		 * @since 2016.02
		 * @category Developer
		 * @category User
		 */
		$maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );

		$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
		$item = $cntl->uses( ['order' => ['download']] )->get();

		if( ( $listItem = $item->getListItem( 'order', 'download', $id ) ) === null ) {
			$listItem = $cntl->createListItem()->setType( 'download' )->setRefId( $id );
		}

		$config = $listItem->getConfig();
		$count = (int) $listItem->getConfigValue( 'count', 0 );

		if( $maxcnt === null || $count < $maxcnt )
		{
			$config['count'] = $count++;
			$cntl->addListItem( 'order', $listItem->setConfig( $config ) )->store();

			return true;
		}

		return false;
	}
protected function checkDownload( $id )
	{
		$context = $this->getContext();

		/** client/html/account/download/maxcount
		 * Maximum number of file downloads allowed for an ordered product
		 *
		 * This configuration setting enables you to limit the number of downloads
		 * of a product download file. The count is the maximum number for each
		 * bought product and customer, i.e. setting the count to "3" allows
		 * a customer to download the bought product file up to three times.
		 *
		 * The default value of null enforces no limit.
		 *
		 * @param integer Maximum number of downloads
		 * @since 2016.02
		 * @category Developer
		 * @category User
		 */
		$maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );

		$cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' );
		$item = $cntl->uses( ['order' => ['download']] )->get();

		if( ( $listItem = $item->getListItem( 'order', 'download', $id ) ) === null ) {
			$listItem = $cntl->createListItem()->setType( 'download' )->setRefId( $id );
		}

		$config = $listItem->getConfig();
		$count = (int) $listItem->getConfigValue( 'count', 0 );

		if( $maxcnt === null || $count < $maxcnt )
		{
			$config['count'] = $count++;
			$cntl->addListItem( 'order', $listItem->setConfig( $config ) )->store();

			return true;
		}

		return false;
	}
protected function checkDownload ( $ id ) { $ context = $ this -> getContext ( ) ; /** client/html/account/download/maxcount
		 * Maximum number of file downloads allowed for an ordered product
		 *
		 * This configuration setting enables you to limit the number of downloads
		 * of a product download file. The count is the maximum number for each
		 * bought product and customer, i.e. setting the count to "3" allows
		 * a customer to download the bought product file up to three times.
		 *
		 * The default value of null enforces no limit.
		 *
		 * @param integer Maximum number of downloads
		 * @since 2016.02
		 * @category Developer
		 * @category User
		 */ $ maxcnt = $ context -> getConfig ( ) -> get ( 'client/html/account/download/maxcount' ) ; $ cntl = \ Aimeos \ Controller \ Frontend :: create ( $ context , 'customer' ) ; $ item = $ cntl -> uses ( [ 'order' => [ 'download' ] ] ) -> get ( ) ; if ( ( $ listItem = $ item -> getListItem ( 'order' , 'download' , $ id ) ) === null ) { $ listItem = $ cntl -> createListItem ( ) -> setType ( 'download' ) -> setRefId ( $ id ) ; } $ config = $ listItem -> getConfig ( ) ; $ count = ( int ) $ listItem -> getConfigValue ( 'count' , 0 ) ; if ( $ maxcnt === null || $ count < $ maxcnt ) { $ config [ 'count' ] = $ count ++ ; $ cntl -> addListItem ( 'order' , $ listItem -> setConfig ( $ config ) ) -> store ( ) ; return true ; } return false ; }
Updates the download counter for the downloaded file

@param string $id Unique order base product attribute ID referencing the download file
@return boolean True if download is allowed, false if not
Updates the download counter for the downloaded file