src/ShopBundle/objects/db/TShop.class.php
public static function GetActiveItemVariant($oArticle)
    {
        $aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
        if (is_array($aVariantTypeSelection)) {
            $oSet = &$oArticle->GetFieldShopVariantSet();
            if (null === $oSet) {
                return $oArticle;
            }
            $oTypes = &$oSet->GetFieldShopVariantTypeList();
            if (count($aVariantTypeSelection) == $oTypes->Length()) {
                if (!$oArticle->IsVariant()) {
                    $oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
                } else {
                    $oParentArticle = $oArticle->GetFieldVariantParent();
                    $oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
                }

                if (1 == $oVariants->Length()) {
                    $oArticle = $oVariants->Current();
                }
            }
        } elseif (!$oArticle->IsVariant()) {
            $oVariants = &$oArticle->GetFieldShopArticleVariantsList();
            if (1 == $oVariants->Length()) {
                $oArticle = $oVariants->Current();
            }
        }

        return $oArticle;
    }
public static function GetActiveItemVariant($oArticle)
    {
        $aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
        if (is_array($aVariantTypeSelection)) {
            $oSet = &$oArticle->GetFieldShopVariantSet();
            if (null === $oSet) {
                return $oArticle;
            }
            $oTypes = &$oSet->GetFieldShopVariantTypeList();
            if (count($aVariantTypeSelection) == $oTypes->Length()) {
                if (!$oArticle->IsVariant()) {
                    $oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
                } else {
                    $oParentArticle = $oArticle->GetFieldVariantParent();
                    $oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection);
                }

                if (1 == $oVariants->Length()) {
                    $oArticle = $oVariants->Current();
                }
            }
        } elseif (!$oArticle->IsVariant()) {
            $oVariants = &$oArticle->GetFieldShopArticleVariantsList();
            if (1 == $oVariants->Length()) {
                $oArticle = $oVariants->Current();
            }
        }

        return $oArticle;
    }
public static function GetActiveItemVariant ( $ oArticle ) { $ aVariantTypeSelection = TdbShopVariantDisplayHandler :: GetActiveVariantTypeSelection ( true ) ; if ( is_array ( $ aVariantTypeSelection ) ) { $ oSet = & $ oArticle -> GetFieldShopVariantSet ( ) ; if ( null === $ oSet ) { return $ oArticle ; } $ oTypes = & $ oSet -> GetFieldShopVariantTypeList ( ) ; if ( count ( $ aVariantTypeSelection ) == $ oTypes -> Length ( ) ) { if ( ! $ oArticle -> IsVariant ( ) ) { $ oVariants = & $ oArticle -> GetFieldShopArticleVariantsList ( $ aVariantTypeSelection ) ; } else { $ oParentArticle = $ oArticle -> GetFieldVariantParent ( ) ; $ oVariants = & $ oParentArticle -> GetFieldShopArticleVariantsList ( $ aVariantTypeSelection ) ; } if ( 1 == $ oVariants -> Length ( ) ) { $ oArticle = $ oVariants -> Current ( ) ; } } } elseif ( ! $ oArticle -> IsVariant ( ) ) { $ oVariants = & $ oArticle -> GetFieldShopArticleVariantsList ( ) ; if ( 1 == $ oVariants -> Length ( ) ) { $ oArticle = $ oVariants -> Current ( ) ; } } return $ oArticle ; }
Returns the active variant for given article.
If no Variant is active return given article.

@param TdbShopArticle $oArticle

@return TdbShopArticle
Returns the active variant for given article . If no Variant is active return given article .