src/ShopBundle/objects/db/TShopArticle.class.php
public function &GetPrimaryCategory()
    {
        $oCategory = null;
        // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child
        if (!empty($this->fieldShopCategoryId)) {
            $oCategory = &$this->GetFieldShopCategory();
            if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) {
                $oCategory = null;
            }
        }

        if (is_null($oCategory)) {
            $oCategories = &$this->GetFieldShopCategoryList();
            $oCategories->GoToStart();
            if ($oCategories->Length() > 0) {
                $oCategory = &$oCategories->Current();
            }
        }
        if (is_null($oCategory) && $this->IsVariant()) {
            $oParent = &$this->GetFieldVariantParent();
            $oCategory = &$oParent->GetPrimaryCategory();
        }

        return $oCategory;
    }
public function &GetPrimaryCategory()
    {
        $oCategory = null;
        // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child
        if (!empty($this->fieldShopCategoryId)) {
            $oCategory = &$this->GetFieldShopCategory();
            if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) {
                $oCategory = null;
            }
        }

        if (is_null($oCategory)) {
            $oCategories = &$this->GetFieldShopCategoryList();
            $oCategories->GoToStart();
            if ($oCategories->Length() > 0) {
                $oCategory = &$oCategories->Current();
            }
        }
        if (is_null($oCategory) && $this->IsVariant()) {
            $oParent = &$this->GetFieldVariantParent();
            $oCategory = &$oParent->GetPrimaryCategory();
        }

        return $oCategory;
    }
public function & GetPrimaryCategory ( ) { $ oCategory = null ; // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child if ( ! empty ( $ this -> fieldShopCategoryId ) ) { $ oCategory = & $ this -> GetFieldShopCategory ( ) ; if ( ! is_null ( $ oCategory ) && false == $ oCategory -> AllowDisplayInShop ( ) ) { $ oCategory = null ; } } if ( is_null ( $ oCategory ) ) { $ oCategories = & $ this -> GetFieldShopCategoryList ( ) ; $ oCategories -> GoToStart ( ) ; if ( $ oCategories -> Length ( ) > 0 ) { $ oCategory = & $ oCategories -> Current ( ) ; } } if ( is_null ( $ oCategory ) && $ this -> IsVariant ( ) ) { $ oParent = & $ this -> GetFieldVariantParent ( ) ; $ oCategory = & $ oParent -> GetPrimaryCategory ( ) ; } return $ oCategory ; }
return the primary category of the article (usually just the first one found.

@return TdbShopCategory
return the primary category of the article ( usually just the first one found .