src/ShopBundle/objects/TShopBasket/TShopBasketArticleCoreList.class.php
public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType)
    {
        $oArticles = new TShopBasketArticleList();
        /** @var $oArticles TShopBasketArticleList */
        $iPointer = $this->getItemPointer();
        $this->GoToStart();
        while ($oItem = &$this->Next()) {
            if ($oShippingType->ArticleAffected($oItem)) {
                $oArticles->AddItem($oItem);
            }
        }
        if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) {
            // this shipping type should match ALL articles... so we now work with all articles
            $this->GoToStart();
            $oArticles = new TShopBasketArticleList();
            /** @var $oArticles TShopBasketArticleList */
            while ($oItem = &$this->Next()) {
                $oArticles->AddItem($oItem);
            }
        }
        // if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement
        if ($oShippingType->ArticleListValidForShippingType($oArticles)) {
            // we keep the list. we now need to mark all items in the list with that shipping type
            $oArticles->GoToStart();
            while ($oItem = &$oArticles->Next()) {
                $this->SetShippingTypeForArticle($oItem, $oShippingType);
            }
            $oArticles->GoToStart();
        } else {
            // does not match... so reset the list
            $oArticles = new TShopBasketArticleList();
            /** @var $oArticles TShopBasketArticleList */
        }

        $this->setItemPointer($iPointer);

        return $oArticles;
    }
public function &GetArticlesAffectedByShippingType(TdbShopShippingType &$oShippingType)
    {
        $oArticles = new TShopBasketArticleList();
        /** @var $oArticles TShopBasketArticleList */
        $iPointer = $this->getItemPointer();
        $this->GoToStart();
        while ($oItem = &$this->Next()) {
            if ($oShippingType->ArticleAffected($oItem)) {
                $oArticles->AddItem($oItem);
            }
        }
        if ($oArticles->Length() > 0 && $oShippingType->fieldApplyToAllProducts) {
            // this shipping type should match ALL articles... so we now work with all articles
            $this->GoToStart();
            $oArticles = new TShopBasketArticleList();
            /** @var $oArticles TShopBasketArticleList */
            while ($oItem = &$this->Next()) {
                $oArticles->AddItem($oItem);
            }
        }
        // if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement
        if ($oShippingType->ArticleListValidForShippingType($oArticles)) {
            // we keep the list. we now need to mark all items in the list with that shipping type
            $oArticles->GoToStart();
            while ($oItem = &$oArticles->Next()) {
                $this->SetShippingTypeForArticle($oItem, $oShippingType);
            }
            $oArticles->GoToStart();
        } else {
            // does not match... so reset the list
            $oArticles = new TShopBasketArticleList();
            /** @var $oArticles TShopBasketArticleList */
        }

        $this->setItemPointer($iPointer);

        return $oArticles;
    }
public function & GetArticlesAffectedByShippingType ( TdbShopShippingType & $ oShippingType ) { $ oArticles = new TShopBasketArticleList ( ) ; /** @var $oArticles TShopBasketArticleList */ $ iPointer = $ this -> getItemPointer ( ) ; $ this -> GoToStart ( ) ; while ( $ oItem = & $ this -> Next ( ) ) { if ( $ oShippingType -> ArticleAffected ( $ oItem ) ) { $ oArticles -> AddItem ( $ oItem ) ; } } if ( $ oArticles -> Length ( ) > 0 && $ oShippingType -> fieldApplyToAllProducts ) { // this shipping type should match ALL articles... so we now work with all articles $ this -> GoToStart ( ) ; $ oArticles = new TShopBasketArticleList ( ) ; /** @var $oArticles TShopBasketArticleList */ while ( $ oItem = & $ this -> Next ( ) ) { $ oArticles -> AddItem ( $ oItem ) ; } } // if at least some items matched, we now need to check if the sume of the items matches the shipping type requirement if ( $ oShippingType -> ArticleListValidForShippingType ( $ oArticles ) ) { // we keep the list. we now need to mark all items in the list with that shipping type $ oArticles -> GoToStart ( ) ; while ( $ oItem = & $ oArticles -> Next ( ) ) { $ this -> SetShippingTypeForArticle ( $ oItem , $ oShippingType ) ; } $ oArticles -> GoToStart ( ) ; } else { // does not match... so reset the list $ oArticles = new TShopBasketArticleList ( ) ; /** @var $oArticles TShopBasketArticleList */ } $ this -> setItemPointer ( $ iPointer ) ; return $ oArticles ; }
returns array with pointers to all basket articles that match the shipping type.

@param TdbShopShippingType $oShippingType

@return TShopBasketArticleList
returns array with pointers to all basket articles that match the shipping type .