Calculates Packages for Articles and returns Packet List.
@access		public
@param		array		$articleList		Array of Articles and their Quantities.
@return		array
518115
public function calculatePackage( $articleList )
	{
		$this->packetList	= array();																	//  reset Packet List

		foreach( $articleList as $name => $quantity )													//  iterate Article List
			if( !$quantity )																			//  and remove all Articles
				unset( $articleList[$name] );															//  without Quantity
		while( $articleList )																			//  iterate Article List
		{
			//  --  ADD FIRST PACKET  --  //
			$largestArticle	= $this->getLargestArticle( $articleList );									//  get Largest Article in List
			if( !count( $this->packetList ) )															//  no Packets yet in Packet List
			{
				$packetName	= $this->getNameOfSmallestPacketForArticle( $largestArticle );				//  get smallest Packet Type for Article
				$packet		= $this->factory->produce( $packetName, array( $largestArticle => 1 ) );	//  put Article in new Packet
				$this->packetList[]	= $packet;															//  add Packet to Packet List
				$this->removeArticleFromList( $articleList, $largestArticle );							//  remove Article from Article List
				continue;																				//  step to next Article
			}

			//  --  FILL PACKET  --  //
			$found = false;																				//  
			for( $i=0; $i<count( $this->packetList ); $i++ )											//  iterate Packets in Packet List
			{
				$packet	= $this->getPacket( $i );														//  get current Packet
				$articleVolume	= $this->volumes[$packet->getName()][$largestArticle];						//  get Article Volume in this Packet
				if( $packet->hasVolumeLeft( $articleVolume ) )											//  check if Article will fit in Packet
				{
					$packet->addArticle( $largestArticle, $articleVolume );								//  put Article in Packet
					$found	= $this->removeArticleFromList( $articleList, $largestArticle );			//  remove Article From Article List
					break;																				//  break Packet Loop
				}
			}
			if( $found )																				//  Article has been put into a Packet
				continue;																				//  step to next Article

			//  --  RESIZE PACKET  --  //
			for( $i=0; $i<count( $this->packetList ); $i++ )											//  iterate Packets in Packet List
			{
				$packet	= $this->getPacket( $i );														//  get current Packet
				while( $this->hasLargerPacket( $packet->getName() ) )									//  there is a larger Packet Type
				{
					$largerPacketName	= $this->getNameOfLargerPacket( $packet->getName() );	
					$articles			= $packet->getArticles();										//  get larger Packet
					$largerPacket		= $this->factory->produce( $largerPacketName, $articles );		//  produce new Packet and add Articles from old Packet
					$articleVolume		= $this->volumes[$largerPacketName][$largestArticle];			//  get Volume of current Article in this Packet
					if( $largerPacket->hasVolumeLeft( $articleVolume ) )
					{
						$largerPacket->addArticle( $largestArticle, $articleVolume );					//  add Article to Packet
						$this->replacePacket( $i, $largerPacket );										//  replace old Packet with new Packet
						$found	= $this->removeArticleFromList( $articleList, $largestArticle );		//  remove Article from Article List
						break;																			//  break Packet Loop
					}
				}
				if( $found )																			//  Article has been put into a Packet
					continue;																			//  break Packet Loop
			}
			if( $found )																				//  Article has been put into a Packet
				continue;																				//  step to next Article
	
			//  --  ADD NEW PACKET  --  //
			$packetName	= $this->getNameOfSmallestPacketForArticle( $largestArticle );					//  get smallest Packet Type for Article
			$packet		= $this->factory->produce( $packetName, array( $largestArticle => 1 ) );		//  produce new Packet and put Article in
				$this->packetList[]	= $packet;															//  add Packet to Packet List
			$this->removeArticleFromList( $articleList, $largestArticle );								//  remove Article from Article List
		}
		return $this->packetList;																		//  return final Packet List with Articles
	}
485320
public function &GetAffectedBasketArticles()
    {
        if (is_null($this->oAffectedBasketArticles)) {
            $this->oAffectedBasketArticles = null;
            $oBasket = TShopBasket::GetInstance();
            $this->oAffectedBasketArticles = &$oBasket->GetArticlesAffectedByShippingType($this);
        }

        return $this->oAffectedBasketArticles;
    }
683993
public static function getModuleList()
    {
        $app = \JFactory::getApplication();
        $Itemid = $app->input->getInt('Itemid');
        $groups = implode(',', \JFactory::getUser()->getAuthorisedViewLevels());
        $lang = \JFactory::getLanguage()->getTag();
        $clientId = (int) $app->getClientId();

        $db = \JFactory::getDbo();

        $query = new \stdClass;
        $query->select = array();
        $query->from = array();
        $query->join = array();
        $query->where = array();
        $query->order = array();

        $query->select[] = 'm.published, m.id, m.title, m.module, m.position, m.content, m.showtitle, m.params, mm.menuid';
        $query->from[] = '#__modules AS m';
        $query->join[] = '#__modules_menu AS mm ON mm.moduleid = m.id';
        $query->where[] = 'm.published = 1';

        $query->join[] = '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id';
        $query->where[] = 'e.enabled = 1';

        $date = \JFactory::getDate();
        $now = $date->toSql();
        $nullDate = $db->getNullDate();
        $query->where[] = '(m.publish_up = ' . $db->q($nullDate) . ' OR m.publish_up <= ' . $db->q($now) . ')';
        $query->where[] = '(m.publish_down = ' . $db->q($nullDate) . ' OR m.publish_down >= ' . $db->q($now) . ')';

        $query->where[] = 'm.access IN ('.$groups.')';
        $query->where[] = 'm.client_id = ' . $clientId;
        $query->where[] = '(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid <= 0)';

        // Filter by language
        if ($app->isSite() && $app->getLanguageFilter())
        {
            $query->where[] = 'm.language IN (' . $db->q($lang) . ',' . $db->q('*') . ')';
        }

        $query->order[] = 'm.position, m.ordering';

        // Do 3rd party stuff to change query
        $app->triggerEvent( 'onCreateModuleQuery', array( &$query ) );

        $q = $db->getQuery(true);
        // convert array object to query object
        foreach ( $query as $type => $strings )
        {
            foreach ( $strings as $string )
            {
                if ( $type == 'join' )
                {
                    $q->{$type}( 'LEFT', $string );
                }
                else
                {
                    $q->{$type}( $string );
                }
            }
        }

        // Set the query
        $db->setQuery($q);

        try
        {
            $modules = $db->loadObjectList();
        }
        catch (\RuntimeException $e)
        {
            \JLog::add(\JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), \JLog::WARNING, 'jerror');

            return array();
        }

        return $modules;
    }
137564
public function &GetFieldPkgShopWishlistArticleList()
    {
        $oWishlistItems = $this->GetFromInternalCache('oPkgShopWishlistArticleList');
        if (is_null($oWishlistItems)) {
            $oWishlistItems = TdbPkgShopWishlistArticleList::GetListForPkgShopWishlistId($this->id, $this->iLanguageId);
            $oWishlistItems->bAllowItemCache = true;
            $this->SetInternalCache('oPkgShopWishlistArticleList', $oWishlistItems);
        }
        $oWishlistItems->GoToStart();

        return $oWishlistItems;
    }
147133
public function &GetArticleList($sOrderBy = null, $aFilter = array())
    {
        $oCategoryArticles = $this->GetFromInternalCache('oArticleList');
        if (is_null($oCategoryArticles)) {
            $oCategoryArticles = &TdbShopArticleList::LoadCategoryArticleList($this->id, $sOrderBy, -1, $aFilter);
            $this->SetInternalCache('oArticleList', $oCategoryArticles);
        }

        return $oCategoryArticles;
    }
1036283
protected function _loadArticles($category)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $numberOfCategoryArticles = (int) $config->getConfigParam('iNrofCatArticles');
        $numberOfCategoryArticles = $numberOfCategoryArticles ? $numberOfCategoryArticles : 1;

        // load only articles which we show on screen
        $articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $articleList->setSqlLimit($numberOfCategoryArticles * $this->_getRequestPageNr(), $numberOfCategoryArticles);
        $articleList->setCustomSorting($this->getSortingSql($this->getSortIdent()));

        if ($category->isPriceCategory()) {
            $priceFrom = $category->oxcategories__oxpricefrom->value;
            $priceTo = $category->oxcategories__oxpriceto->value;

            $this->_iAllArtCnt = $articleList->loadPriceArticles($priceFrom, $priceTo, $category);
        } else {
            $sessionFilter = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter');

            $activeCategoryId = $category->getId();
            $this->_iAllArtCnt = $articleList->loadCategoryArticles($activeCategoryId, $sessionFilter);
        }

        $this->_iCntPages = ceil($this->_iAllArtCnt / $numberOfCategoryArticles);

        return $articleList;
    }
759652
public function fetch(array $propertiesList) {
		$data = $this->createClone();
		
		foreach ($this->_map as $key) {
			$item = $this->_data[$key];
			$itemFetched = [];
			
			foreach ($propertiesList as $property) {
				if (isset($item[$property])) {
					$itemFetched[$property] = $item[$property];
				}
			}
			
			if (! empty($itemFetched)) {
				$data->addItem($itemFetched);
			}
		}
		
		return $data;
	}
496407
public function getArticleShowPermalink(Articles $articles, $absolute = 1)
    {
        return $this->getContainer()->get('router')->generate($this->getArticleShowRoute(), $this->getArticleShowRouteParameters($articles), $absolute);
    }
151512
public function getContentModules()
    {
        return array_filter($this->getModules(), function (ModuleInterface $module) {
            return !($module instanceof AdministrationModuleInterface)
                && !($module instanceof SubmoduleInterface);
        });
    }
422008
protected function _processListArticles()
    {
        if ($articleList = $this->getArticleList()) {
            $linkType = $this->_getProductLinkType();
            $dynamicParameters = $this->getAddUrlParams();
            $seoParameters = $this->getAddSeoUrlParams();

            foreach ($articleList as $article) {
                /** @var \OxidEsales\Eshop\Application\Model\Article $article */
                $article->setLinkType($linkType);

                if ($dynamicParameters) {
                    $article->appendStdLink($dynamicParameters);
                }

                if ($seoParameters) {
                    $article->appendLink($seoParameters);
                }
            }
        }
    }
1260262
public function getArticleList()
    {
        if ($this->_aArticleList === null) {
            if ($category = $this->getActiveCategory()) {
                $articleList = $this->_loadArticles($category);
                if (count($articleList)) {
                    $this->_aArticleList = $articleList;
                }
            }
        }

        return $this->_aArticleList;
    }
677907
public function getWishList()
    {
        if ($this->_oWishList === null) {
            $this->_oWishList = false;

            // passing wishlist information
            if ($oUser = $this->getWishUser()) {
                $oWishlistBasket = $oUser->getBasket('wishlist');
                $this->_oWishList = $oWishlistBasket->getArticles();

                if (!$oWishlistBasket->isVisible()) {
                    $this->_oWishList = false;
                }
            }
        }

        return $this->_oWishList;
    }
1144494
public function hasOutOfStockArticles()
    {
        $result = false;

        $basketContents = $this->getBasket()->getContents();

        foreach ($basketContents as $basketItem) {
            $article = $basketItem->getArticle();
            if (($article->getStockAmount() - $basketItem->getAmount()) < $this->getEmptyStockLevel()) {
                $result = true;
                break;
            }
        }

        return $result;
    }
342826
public function getStats($articleId)
    {
        $query = 'SELECT * FROM `shop_article_stats` WHERE `shop_article_id` = :articleId';
        $data = $this->databaseConnection->fetchAssoc($query, array('articleId' => $articleId));
        if (is_array($data)) {
            $stats = $this->createStatsObject($data);
        } else {
            $stats = new ProductStatistics();
        }

        return $stats;
    }
494453
public function getCompArtList()
    {
        if ($this->_oArtList === null) {
            if (($aItems = $this->getCompareItems())) {
                // counts how many pages
                $oList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
                $oList->loadIds(array_keys($aItems));

                // cut page articles
                if ($this->_iArticlesPerPage > 0) {
                    $this->_iCntPages = ceil($oList->count() / $this->_iArticlesPerPage);
                    $aItems = $this->_removeArticlesFromPage($aItems, $oList);
                }

                $this->_oArtList = $this->_changeArtListOrder($aItems, $oList);
            }
        }

        return $this->_oArtList;
    }
1261112
public function getNewestArticles()
    {
        if ($this->_aNewArticleList === null) {
            $this->_aNewArticleList = [];
            if ($this->_getLoadActionsParam()) {
                // newest articles
                $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
                $oArtList->loadNewestArticles();
                if ($oArtList->count()) {
                    $this->_aNewArticleList = $oArtList;
                }
            }
        }

        return $this->_aNewArticleList;
    }
942460
public function getProductsDeliveryList()
    {
        $article = $this->getProduct();
        $deliveryList = oxNew(\OxidEsales\Eshop\Application\Model\DeliveryList::class);
        $deliveryList->loadDeliveryListForProduct($article);

        return $deliveryList;
    }