Hi Ralf, why not simply get the complete "path" and then get the part without the root-/main-category? Therefore a new function in oxcategorylist should do the trick? The tree is built early, so it should be available when you need it. But be careful: there are no full oxcategory-Objects in the tree!! I had to deal with that a few weeks ago while writing a special Head-Navigation with extensive additional functionality. If you need the full object, create it, or change oxcategorylist::_getSqlSelectFieldsForTree(...) and maybe oxcategorylist::_ppBuildTree(), to have the needed fields in the cat-objects in the tree.
Regards, Kai -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Ralf Kronen Gesendet: Donnerstag, 19. April 2012 14:00 An: [email protected] Betreff: Re: [oxid-dev-general] Subcategory from a category Hi, thank you, that's right, but i want the tree without the Maincategory. For Example: Maincategory => $myConfig->getConfigParam('sBaumusterCatId') - Sub 1 -- Sub Sub 1 -- Sub Sub 2 - Sub 2 - Sub 3 Return to the template: Sub 1 - Sub Sub 1 - Sub Sub 2 Sub 2 Sub 3 cheers ralf Am 19.04.2012 um 12:29 schrieb Ferber Sven: > Hello there, > > loading a category does not load its category tree, so _aSubCats will always > be an empty array. > Have a look at oxcategorylist->buildTree() to get the required category tree > array. > > Regards > Sven > > > Am 19.04.12 12:21 schrieb "Ralf Kronen" unter > <[email protected]>: > > Hello Marco, > > i'm sorry. I try it in english :-) i have already posted in the german > dev forum :-) > > I would like to have the tree of a certain category: > > class smx_oxviewconfig extends smx_oxviewconfig_parent { > public function getBaumuster() > { > $myConfig = $this->getConfig(); > $sCatID = $myConfig->getConfigParam('sBaumusterCatId'); > > $oCat = oxNew('oxcategory'); > $oCat->load($sCatID); > > $oSubCat = $oCat->getSubCats(); > > return $oSubCat; > } //function > } > > The category ist structured like this (everything is ok with the > Subcats and the articles) > > Maincategory => $myConfig->getConfigParam('sBaumusterCatId') > - Sub 1 > -- Sub Sub 1 > -- Sub Sub 2 > - Sub 2 > - Sub 3 > > But $oCat->getSubCats() returns a empty array. Is anything need after > $oCat->load($sCatID)? > > This is the $oCat Object: > > smx_oxcategory Object > ( > [_aSubCats:protected] => Array > ( > ) > > [_aContentCats:protected] => Array > ( > ) > > [_sClassName:protected] => oxcategory > [_iNrOfArticles:protected] => > [_blIsVisible:protected] => > [_blExpanded:protected] => > [_blHasSubCats:protected] => > [_blHasVisibleSubCats:protected] => > [_blIsSeoObject:protected] => 1 > [_blUseLazyLoading:protected] => > [_sDynImageDir:protected] => > [_blTopCategory:protected] => > [_aIds:protected] => Array > ( > ) > > [_aStdUrls:protected] => Array > ( > ) > > [_aSeoUrls:protected] => Array > ( > ) > > [_iLanguage:protected] => 0 > [_blEmployMultilanguage:protected] => 1 > [_sOXID:protected] => 214e377cb795b8a7e473188a78abd024 > [_iShopId:protected] => 1 > [_blIsSimplyClonable:protected] => 1 > [_aErrors:protected] => Array > ( > ) > > [_sCoreTable:protected] => oxcategories > [_sViewTable:protected] => > [_blForceCoreTableUsage:protected] => > [_blDisableShopCheck:protected] => 1 > [_aFieldNames:protected] => Array > ( > [oxid] => 0 > [oxparentid] => 0 > [oxleft] => 0 > [oxright] => 0 > [oxrootid] => 0 > [oxsort] => 0 > [oxactive] => 1 > [oxhidden] => 0 > [oxshopid] => 0 > [oxshopincl] => 0 > [oxshopexcl] => 0 > [oxtitle] => 1 > [oxdesc] => 1 > [oxlongdesc] => 1 > [oxthumb] => 1 > [oxextlink] => 0 > [oxtemplate] => 0 > [oxdefsort] => 0 > [oxdefsortmode] => 0 > [oxpricefrom] => 0 > [oxpriceto] => 0 > [oxicon] => 0 > [oxpromoicon] => 0 > [oxvat] => 0 > [oxskipdiscounts] => 0 > [oxshowsuffix] => 0 > [smxbaumuster] => 0 > ) > > [_blIsNewCache:protected] => > [_sCacheKey:protected] => allviews_i18n > [_aSkipSaveFields:protected] => Array > ( > ) > > [_sExistKey:protected] => oxid > [_blIsDerived:protected] => > [_blReadOnly:protected] => > [_blIsInList:protected] => > [_isLoaded:protected] => 1 > [_aInnerLazyCache:protected] => > [oxcategories__oxid] => oxField Object > ( > [value] => 214e377cb795b8a7e473188a78abd024 > ) > > [oxcategories__oxparentid] => oxField Object > ( > [rawValue] => oxrootid > ) > > [oxcategories__oxleft] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxright] => oxField Object > ( > [rawValue] => 198 > ) > > [oxcategories__oxrootid] => oxField Object > ( > [rawValue] => 214e377cb795b8a7e473188a78abd024 > ) > > [oxcategories__oxsort] => oxField Object > ( > [rawValue] => -1 > ) > > [oxcategories__oxactive] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxhidden] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxshopid] => oxField Object > ( > [value] => 1 > ) > > [oxcategories__oxshopincl] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxshopexcl] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxtitle] => oxField Object > ( > [rawValue] => Baumuster > ) > > [oxcategories__oxdesc] => oxField Object > ( > [rawValue] => Sammelkategorie für Baumuster Baum > ) > > [oxcategories__oxlongdesc] => oxField Object > ( > [value] => > ) > > [oxcategories__oxthumb] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxextlink] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxtemplate] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxdefsort] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxdefsortmode] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxpricefrom] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxpriceto] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxicon] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxpromoicon] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxvat] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxskipdiscounts] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxshowsuffix] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__smxbaumuster] => oxField Object > ( > [rawValue] => 0 > ) > > ) > > Thx and cheers > ralf > > > > > Am 19.04.2012 um 12:12 schrieb Marco Steinhaeuser: > > Hello Ralf, > > nice to see you on this mailing list finally :-) Please note that we > cannot accept other languages than English here as there are a lot of > non-native Germans subscribed. Alternatively, you have the choice to post > into the German dev forum: > http://www.oxid-esales.com/forum/forumdisplay.php?f=20 > > Will you post it once again? > > Thanks for understanding. > Marco > > > ________________________________ > From: [email protected] > [[email protected]] on behalf of Ralf Kronen > [[email protected]] > Sent: Thursday, April 19, 2012 11:47 AM > To: [email protected] > Subject: [oxid-dev-general] Unterkategorie einer Kategorie > > Hallo, > > ich möchte den Baum einer bestimmten Kategorie haben: > > class smx_oxviewconfig extends smx_oxviewconfig_parent { > public function getBaumuster() > { > $myConfig = $this->getConfig(); > $sCatID = $myConfig->getConfigParam('sBaumusterCatId'); > > $oCat = oxNew('oxcategory'); > $oCat->load($sCatID); > > $oSubCat = $oCat->getSubCats(); > > return $oSubCat; > } //function > } > > Die Kategorie ist so aufgebaut (und alle korrekt angelegt mit Artikeln, aktiv > usw): > Hauptkategorie (sBaumusterCatId) > - Unter 1 > -- Unterunter 1 > -- Unterunter 2 > - Unter 2 > - Unter 3 > > Das soll auch im Template verfügbar sein über [{assign var="obm" > value=$oViewConf->getBaumuster()}]. Leider gibt das getSubCats immer ein > leeres Array zurück. Was fehlt ihm hier, was muss nach load() noch folgen? > > Das Objekt $oCat sieht auch OK aus, es fehlen nur die Subcats: > > smx_oxcategory Object > ( > [_aSubCats:protected] => Array > ( > ) > > [_aContentCats:protected] => Array > ( > ) > > [_sClassName:protected] => oxcategory > [_iNrOfArticles:protected] => > [_blIsVisible:protected] => > [_blExpanded:protected] => > [_blHasSubCats:protected] => > [_blHasVisibleSubCats:protected] => > [_blIsSeoObject:protected] => 1 > [_blUseLazyLoading:protected] => > [_sDynImageDir:protected] => > [_blTopCategory:protected] => > [_aIds:protected] => Array > ( > ) > > [_aStdUrls:protected] => Array > ( > ) > > [_aSeoUrls:protected] => Array > ( > ) > > [_iLanguage:protected] => 0 > [_blEmployMultilanguage:protected] => 1 > [_sOXID:protected] => 214e377cb795b8a7e473188a78abd024 > [_iShopId:protected] => 1 > [_blIsSimplyClonable:protected] => 1 > [_aErrors:protected] => Array > ( > ) > > [_sCoreTable:protected] => oxcategories > [_sViewTable:protected] => > [_blForceCoreTableUsage:protected] => > [_blDisableShopCheck:protected] => 1 > [_aFieldNames:protected] => Array > ( > [oxid] => 0 > [oxparentid] => 0 > [oxleft] => 0 > [oxright] => 0 > [oxrootid] => 0 > [oxsort] => 0 > [oxactive] => 1 > [oxhidden] => 0 > [oxshopid] => 0 > [oxshopincl] => 0 > [oxshopexcl] => 0 > [oxtitle] => 1 > [oxdesc] => 1 > [oxlongdesc] => 1 > [oxthumb] => 1 > [oxextlink] => 0 > [oxtemplate] => 0 > [oxdefsort] => 0 > [oxdefsortmode] => 0 > [oxpricefrom] => 0 > [oxpriceto] => 0 > [oxicon] => 0 > [oxpromoicon] => 0 > [oxvat] => 0 > [oxskipdiscounts] => 0 > [oxshowsuffix] => 0 > [smxbaumuster] => 0 > ) > > [_blIsNewCache:protected] => > [_sCacheKey:protected] => allviews_i18n > [_aSkipSaveFields:protected] => Array > ( > ) > > [_sExistKey:protected] => oxid > [_blIsDerived:protected] => > [_blReadOnly:protected] => > [_blIsInList:protected] => > [_isLoaded:protected] => 1 > [_aInnerLazyCache:protected] => > [oxcategories__oxid] => oxField Object > ( > [value] => 214e377cb795b8a7e473188a78abd024 > ) > > [oxcategories__oxparentid] => oxField Object > ( > [rawValue] => oxrootid > ) > > [oxcategories__oxleft] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxright] => oxField Object > ( > [rawValue] => 198 > ) > > [oxcategories__oxrootid] => oxField Object > ( > [rawValue] => 214e377cb795b8a7e473188a78abd024 > ) > > [oxcategories__oxsort] => oxField Object > ( > [rawValue] => -1 > ) > > [oxcategories__oxactive] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxhidden] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxshopid] => oxField Object > ( > [value] => 1 > ) > > [oxcategories__oxshopincl] => oxField Object > ( > [rawValue] => 1 > ) > > [oxcategories__oxshopexcl] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxtitle] => oxField Object > ( > [rawValue] => Baumuster > ) > > [oxcategories__oxdesc] => oxField Object > ( > [rawValue] => Sammelkategorie für Baumuster Baum > ) > > [oxcategories__oxlongdesc] => oxField Object > ( > [value] => > ) > > [oxcategories__oxthumb] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxextlink] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxtemplate] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxdefsort] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxdefsortmode] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxpricefrom] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxpriceto] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxicon] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxpromoicon] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxvat] => oxField Object > ( > [rawValue] => > ) > > [oxcategories__oxskipdiscounts] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__oxshowsuffix] => oxField Object > ( > [rawValue] => 0 > ) > > [oxcategories__smxbaumuster] => oxField Object > ( > [rawValue] => 0 > ) > > ) > > Viele Grüße > Ralf > > _______________________________________________ > dev-general mailing list > [email protected] > http://dir.gmane.org/gmane.comp.php.oxid.general > > > _______________________________________________ > dev-general mailing list > [email protected] > http://dir.gmane.org/gmane.comp.php.oxid.general _______________________________________________ dev-general mailing list [email protected] http://dir.gmane.org/gmane.comp.php.oxid.general _______________________________________________ dev-general mailing list [email protected] http://dir.gmane.org/gmane.comp.php.oxid.general
