src/ShopBundle/objects/db/TShopShippingType.class.php
public function ArticleAffected(TShopBasketArticle &$oArticle)
    {
        $shopShippingTypeDataAccess = $this->getShopShippingTypeDataAccess();
        $bAffected = false;
        $oArticleShippingType = &$oArticle->GetActingShippingType();
        // if the article is already marked with this shipping type, then we keep it
        if (!is_null($oArticleShippingType) && $oArticleShippingType->id == $this->id) {
            $bAffected = true;
        } elseif (is_null($oArticleShippingType)) {
            // article has no shipping type yet...
            // check article groups
            $bArticleGroupValid = false;
            $aGroupRestriction = $shopShippingTypeDataAccess->getPermittedArticleGroupIds($this->id);
            if (!is_array($aGroupRestriction) || count($aGroupRestriction) < 1) {
                $bArticleGroupValid = true;
            } else {
                $bArticleGroupValid = $oArticle->IsInArticleGroups($aGroupRestriction);
            }

            // check product categories
            $bArticleCategoryValid = false;
            if ($bArticleGroupValid) {
                $aCategoryRestriction = $shopShippingTypeDataAccess->getPermittedCategoryIds($this->id);
                if (!is_array($aCategoryRestriction) || count($aCategoryRestriction) < 1) {
                    $bArticleCategoryValid = true;
                } else {
                    $bArticleCategoryValid = $oArticle->IsInCategory($aCategoryRestriction);
                }
            }

            // check articles
            $bArticleValid = false;
            if ($bArticleGroupValid && $bArticleCategoryValid) {
                $aArticleRestriction = $shopShippingTypeDataAccess->getPermittedArticleIds($this->id);
                if (!is_array($aArticleRestriction) || count($aArticleRestriction) < 1) {
                    $bArticleValid = true;
                } else {
                    if (in_array($oArticle->id, $aArticleRestriction)) {
                        $bArticleValid = true;
                    }
                }
            }

            $bAffected = ($bArticleGroupValid && $bArticleCategoryValid && $bArticleValid);
        }

        return $bAffected;
    }
public function ArticleAffected(TShopBasketArticle &$oArticle)
    {
        $shopShippingTypeDataAccess = $this->getShopShippingTypeDataAccess();
        $bAffected = false;
        $oArticleShippingType = &$oArticle->GetActingShippingType();
        // if the article is already marked with this shipping type, then we keep it
        if (!is_null($oArticleShippingType) && $oArticleShippingType->id == $this->id) {
            $bAffected = true;
        } elseif (is_null($oArticleShippingType)) {
            // article has no shipping type yet...
            // check article groups
            $bArticleGroupValid = false;
            $aGroupRestriction = $shopShippingTypeDataAccess->getPermittedArticleGroupIds($this->id);
            if (!is_array($aGroupRestriction) || count($aGroupRestriction) < 1) {
                $bArticleGroupValid = true;
            } else {
                $bArticleGroupValid = $oArticle->IsInArticleGroups($aGroupRestriction);
            }

            // check product categories
            $bArticleCategoryValid = false;
            if ($bArticleGroupValid) {
                $aCategoryRestriction = $shopShippingTypeDataAccess->getPermittedCategoryIds($this->id);
                if (!is_array($aCategoryRestriction) || count($aCategoryRestriction) < 1) {
                    $bArticleCategoryValid = true;
                } else {
                    $bArticleCategoryValid = $oArticle->IsInCategory($aCategoryRestriction);
                }
            }

            // check articles
            $bArticleValid = false;
            if ($bArticleGroupValid && $bArticleCategoryValid) {
                $aArticleRestriction = $shopShippingTypeDataAccess->getPermittedArticleIds($this->id);
                if (!is_array($aArticleRestriction) || count($aArticleRestriction) < 1) {
                    $bArticleValid = true;
                } else {
                    if (in_array($oArticle->id, $aArticleRestriction)) {
                        $bArticleValid = true;
                    }
                }
            }

            $bAffected = ($bArticleGroupValid && $bArticleCategoryValid && $bArticleValid);
        }

        return $bAffected;
    }
public function ArticleAffected ( TShopBasketArticle & $ oArticle ) { $ shopShippingTypeDataAccess = $ this -> getShopShippingTypeDataAccess ( ) ; $ bAffected = false ; $ oArticleShippingType = & $ oArticle -> GetActingShippingType ( ) ; // if the article is already marked with this shipping type, then we keep it if ( ! is_null ( $ oArticleShippingType ) && $ oArticleShippingType -> id == $ this -> id ) { $ bAffected = true ; } elseif ( is_null ( $ oArticleShippingType ) ) { // article has no shipping type yet... // check article groups $ bArticleGroupValid = false ; $ aGroupRestriction = $ shopShippingTypeDataAccess -> getPermittedArticleGroupIds ( $ this -> id ) ; if ( ! is_array ( $ aGroupRestriction ) || count ( $ aGroupRestriction ) < 1 ) { $ bArticleGroupValid = true ; } else { $ bArticleGroupValid = $ oArticle -> IsInArticleGroups ( $ aGroupRestriction ) ; } // check product categories $ bArticleCategoryValid = false ; if ( $ bArticleGroupValid ) { $ aCategoryRestriction = $ shopShippingTypeDataAccess -> getPermittedCategoryIds ( $ this -> id ) ; if ( ! is_array ( $ aCategoryRestriction ) || count ( $ aCategoryRestriction ) < 1 ) { $ bArticleCategoryValid = true ; } else { $ bArticleCategoryValid = $ oArticle -> IsInCategory ( $ aCategoryRestriction ) ; } } // check articles $ bArticleValid = false ; if ( $ bArticleGroupValid && $ bArticleCategoryValid ) { $ aArticleRestriction = $ shopShippingTypeDataAccess -> getPermittedArticleIds ( $ this -> id ) ; if ( ! is_array ( $ aArticleRestriction ) || count ( $ aArticleRestriction ) < 1 ) { $ bArticleValid = true ; } else { if ( in_array ( $ oArticle -> id , $ aArticleRestriction ) ) { $ bArticleValid = true ; } } } $ bAffected = ( $ bArticleGroupValid && $ bArticleCategoryValid && $ bArticleValid ) ; } return $ bAffected ; }
checks if a basket article should be affected by this shipping type
this can only happen if the article is not affected by any other shipping type.

@param TShopBasketArticle $oArticle

@return bool
checks if a basket article should be affected by this shipping type this can only happen if the article is not affected by any other shipping type .