Adds the coupon specified by the view parameters from the basket.

@param \Aimeos\MW\View\Iface $view View object
189256
protected function addCoupon( \Aimeos\MW\View\Iface $view )
	{
		if( ( $coupon = $view->param( 'b_coupon' ) ) != '' )
		{
			\Aimeos\Controller\Frontend::create( $this->getContext(), 'basket' )->addCoupon( $coupon );
			$this->clearCached();
		}
	}
403899
protected function addViewData( \Aimeos\MW\View\Iface $view )
	{
		$context = $this->getContext();

		$priceTypeManager = \Aimeos\MShop::create( $context, 'price/type' );
		$listTypeManager = \Aimeos\MShop::create( $context, 'service/lists/type' );
		$currencyManager = \Aimeos\MShop::create( $context, 'locale/currency' );

		$search = $priceTypeManager->createSearch( true )->setSlice( 0, 10000 );
		$search->setConditions( $search->compare( '==', 'price.type.domain', 'service' ) );
		$search->setSortations( [$search->sort( '+', 'price.type.position' )] );

		$listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 10000 );
		$listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'price' ) );
		$listSearch->setSortations( [$listSearch->sort( '+', 'service.lists.type.position' )] );

		$view->priceTypes = $this->map( $priceTypeManager->searchItems( $search ) );
		$view->priceListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) );
		$view->priceCurrencies = $currencyManager->searchItems( $currencyManager->createSearch( true )->setSlice( 0, 10000 ) );

		if( $view->priceCurrencies === [] ) {
			throw new \Aimeos\Admin\JQAdm\Exception( 'No currencies available. Please enable at least one currency' );
		}

		return $view;
	}
1368540
public function setView(ViewComponentInterface $view = null)
    {
        if ($view === $this->view) {
            return $this;
        }
        $this->view && $this->view->detach();
        $view && $view->attachTo($this);
        $this->view = $view;
        return $this;
    }
113260
protected function getParts( \Aimeos\MW\View\Iface $view )
	{
		$available = array(
			'basket/address' => \Aimeos\MShop\Order\Item\Base\Base::PARTS_ADDRESS,
			'basket/coupon' => \Aimeos\MShop\Order\Item\Base\Base::PARTS_COUPON,
			'basket/product' => \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT,
			'basket/service' => \Aimeos\MShop\Order\Item\Base\Base::PARTS_SERVICE,
		);

		$included = explode( ',', $view->param( 'included', 'basket/address,basket/coupon,basket/product,basket/service' ) );

		$parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_NONE;
		foreach( $included as $type )
		{
			if( isset( $available[$type] ) ) {
				$parts |= $available[$type];
			}
		}

		return $parts;
	}
731748
protected static function addSession( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Session\Iface $session )
	{
		$helper = new \Aimeos\MW\View\Helper\Session\Standard( $view, $session );
		$view->addHelper( 'session', $helper );

		return $view;
	}
226039
protected static function addAccess( \Aimeos\MW\View\Iface $view )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_access'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_access'] ) )
		) {
			return $fcn( $view );
		}

		if( TYPO3_MODE === 'BE' )
		{
			if( $GLOBALS['BE_USER']->isAdmin() === false )
			{
				$groups = array();
				foreach( (array) $GLOBALS['BE_USER']->userGroups as $entry ) {
					$groups[] = $entry['title'];
				}
				$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $groups );
			}
			else
			{
				$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
			}
		}
		else
		{
			if( $GLOBALS['TSFE']->loginUser == 1 ) {
				$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $GLOBALS['TSFE']->fe_user->groupData['title'] );
			} else {
				$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, array() );
			}
		}

		$view->addHelper( 'access', $helper );

		return $view;
	}
1094259
protected function _addProducts( MW_View_Interface $view, array $options )
	{
		$this->_clearCached();
		$products = (array) $view->param( 'b-prod', array() );
		$controller = Controller_Frontend_Factory::createController( $this->_getContext(), 'basket' );

		if( ( $prodid = $view->param( 'b-prod-id', null ) ) !== null )
		{
			$products[] = array(
				'prod-id' => $prodid,
				'quantity' => $view->param( 'b-quantity', 1 ),
				'attrvar-id' => array_filter( (array) $view->param( 'b-attrvar-id', array() ) ),
				'attrconf-id' => array_filter( (array) $view->param( 'b-attrconf-id', array() ) ),
				'attrhide-id' => array_filter( (array) $view->param( 'b-attrhide-id', array() ) ),
				'warehouse' => $view->param( 'b-warehouse', 'default' ),
			);
		}

		foreach( $products as $values ) {
			$this->_addProduct( $controller, $values, $options );
		}
	}
994311
protected function getController( \Aimeos\MW\View\Iface $view )
	{
		$context = $this->getContext();
		$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' );

		/** client/jsonapi/product/levels
		 * Include products of sub-categories in the product list of the current category
		 *
		 * Sometimes it may be useful to show products of sub-categories in the
		 * current category product list, e.g. if the current category contains
		 * no products at all or if there are only a few products in all categories.
		 *
		 * Possible constant values for this setting are:
		 * * 1 : Only products from the current category
		 * * 2 : Products from the current category and the direct child categories
		 * * 3 : Products from the current category and the whole category sub-tree
		 *
		 * Caution: Please keep in mind that displaying products of sub-categories
		 * can slow down your shop, especially if it contains more than a few
		 * products! You have no real control over the positions of the products
		 * in the result list too because all products from different categories
		 * with the same position value are placed randomly.
		 *
		 * Usually, a better way is to associate products to all categories they
		 * should be listed in. This can be done manually if there are only a few
		 * ones or during the product import automatically.
		 *
		 * @param integer Tree level constant
		 * @since 2017.03
		 * @category Developer
		 */
		$level = $context->getConfig()->get( 'client/jsonapi/product/levels', \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );

		foreach( (array) $view->param( 'filter/f_oneid', [] ) as $list ) {
			$cntl->oneOf( $list );
		}

		$cntl->allOf( $view->param( 'filter/f_attrid', [] ) )
			->oneOf( $view->param( 'filter/f_optid', [] ) )
			->text( $view->param( 'filter/f_search' ) )
			->supplier( $view->param( 'filter/f_supid', [] ), $view->param( 'filter/f_listtype', 'default' ) )
			->category( $view->param( 'filter/f_catid' ), $view->param( 'filter/f_listtype', 'default' ), $level );

		$params = (array) $view->param( 'filter', [] );

		unset( $params['f_supid'], $params['f_search'] );
		unset( $params['f_catid'], $params['f_listtype'] );
		unset( $params['f_attrid'], $params['f_optid'], $params['f_oneid'] );

		return $cntl->parse( $params )
			->sort( $view->param( 'sort', 'relevance' ) )
			->slice( $view->param( 'page/offset', 0 ), $view->param( 'page/limit', 48 ) );
	}
564017
protected function addParam( \Aimeos\MW\View\Iface $view )
	{
		$params = ( Route::current() ? Route::current()->parameters() : array() ) + Input::all();
		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
		$view->addHelper( 'param', $helper );

		return $view;
	}
25362
public function attachTrackerView($view)
    {
        if ( ! $this->trackerViews->contains($view->getKey()))
        {
            return $this->trackerViews()->attach($view);
        }
    }
338182
protected function addUrl( \Aimeos\MW\View\Iface $view )
	{
		$fixed = array();
		$request = $this->requestStack->getMasterRequest();

		if( $request !== null )
		{
			$attr = $request->attributes;

			if( ( $site = $attr->get( 'site' ) ) !== null ) {
				$fixed['site'] = $site;
			}

			if( ( $lang = $attr->get( 'locale' ) ) !== null ) {
				$fixed['locale'] = $lang;
			}

			if( ( $currency = $attr->get( 'currency' ) ) !== null ) {
				$fixed['currency'] = $currency;
			}
		}

		$helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed );
		$view->addHelper( 'url', $helper );

		return $view;
	}
421564
protected function addUrl( \Aimeos\MW\View\Iface $view )
	{
		$fixed = array();

		if( Route::current() )
		{
			if( ( $value = Route::input( 'site' ) ) !== null ) {
				$fixed['site'] = $value;
			}

			if( ( $value = Route::input( 'locale' ) ) !== null ) {
				$fixed['locale'] = $value;
			}

			if( ( $value = Route::input( 'currency' ) ) !== null ) {
				$fixed['currency'] = $value;
			}
		}

		$helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed );
		$view->addHelper( 'url', $helper );

		return $view;
	}
368177
public function compose(View $view)
    {

        $view->with('esi_status', EsiStatus::latest()->first());
        $view->with('is_rate_limited', $this->isEsiRateLimited());
        $view->with('rate_limit_ttl', $this->getRateLimitKeyTtl());
    }
427088
protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$session = new \Aimeos\MW\Session\Laravel5( $this->session );

		return $context->setSession( $session );
	}
1294047
protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale )
	{
		if( $locale !== null )
		{
			$i18n = $this->container->get( 'aimeos.i18n' )->get( array( $locale ) );
			$translation = $i18n[$locale];
		}
		else
		{
			$translation = new \Aimeos\MW\Translation\None( 'en' );
		}

		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation );
		$view->addHelper( 'translate', $helper );

		return $view;
	}
866334
public function addData( \Aimeos\MW\View\Iface $view, array &$tags = [], &$expire = null )
	{
		$context = $this->getContext();
		$config = $context->getConfig();

		/** client/html/catalog/count/tree/aggregate
		 * Enables or disables generating product counts for the category catalog filter
		 *
		 * This configuration option allows shop owners to enable or disable product counts
		 * for the tree section of the catalog filter HTML client.
		 *
		 * @param boolean Disabled if "0", enabled if "1"
		 * @since 2014.03
		 * @see client/html/catalog/count/limit
		 */
		if( $config->get( 'client/html/catalog/count/tree/aggregate', true ) == true )
		{
			/** client/html/catalog/count/limit
			 * @see client/html/catalog/count/tree/aggregate
			 */
			$limit = $config->get( 'client/html/catalog/count/limit', 10000 );
			$startid = $view->config( 'client/html/catalog/filter/tree/startid' );
			$level = $view->config( 'client/html/catalog/lists/levels', \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );

			$cntl = \Aimeos\Controller\Frontend::create( $context, 'catalog' )->root( $startid );
			$root = $cntl->getTree( \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );

			if( ( $catId = $view->param( 'f_catid', $root->getId() ) ) != null && $catId != $root->getId() ) {
				$cntl->visible( array_keys( $cntl->getPath( $catId ) ) );
			} elseif( $level !== \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ) {
				$cntl->visible( [$root->getId()] );
			}

			$tree = $cntl->getTree();
			$view->treeCountList = \Aimeos\Controller\Frontend::create( $context, 'product' )
				->category( array_keys( $tree->toList() ) )->slice( 0, $limit )->sort()
				->aggregate( 'index.catalog.id' );

			if( $level === \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ) {
				$view->treeCountList = $this->counts( $this->traverse( $tree, $view->treeCountList ) );
			}
		}

		return parent::addData( $view, $tags, $expire );
	}
7330
public function setView($view, $variables = [])
    {
        if (!empty($variables)) {
            $this->with($variables);
        }

        $this->view = $view;
    }