130         $this->
init(
'oxcategories');
 
  140         return $this->oxcategories__oxdefsort->value;
 
  150         return $this->oxcategories__oxdefsortmode->value;
 
  181             case 'hasVisibleSubCats':
 
  208         $sSelect = $this->
buildSelectString(array(
"`{$this->getViewName()}`.`oxid`" => $sOXID));
 
  228             $this->_isLoaded = 
true;
 
  245         $this->_iNrOfArticles = null;
 
  257     public function delete($sOXID = null)
 
  259         if (!$this->
getId()) {
 
  263         $sOXID = isset($sOXID) ? $sOXID : $this->
getId();
 
  270         if ($this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value + 1)) {
 
  276             $myUtilsPic->safePictureDelete($this->oxcategories__oxthumb->value, $sDir . 
oxRegistry::get(
"oxUtilsFile")->getImageDirByType(
'TC'), 
'oxcategories', 
'oxthumb');
 
  277             $myUtilsPic->safePictureDelete($this->oxcategories__oxicon->value, $sDir . 
oxRegistry::get(
"oxUtilsFile")->getImageDirByType(
'CICO'), 
'oxcategories', 
'oxicon');
 
  278             $myUtilsPic->safePictureDelete($this->oxcategories__oxpromoicon->value, $sDir . 
oxRegistry::get(
"oxUtilsFile")->getImageDirByType(
'PICO'), 
'oxcategories', 
'oxpromoicon');
 
  280             $sAdd = 
" and oxshopid = '" . $this->
getShopId() . 
"' ";
 
  283                 "UPDATE oxcategories SET OXLEFT = OXLEFT - 2 
  284                                            WHERE  OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . 
" 
  285                             AND OXLEFT >   " . ((int) $this->oxcategories__oxleft->value) . $sAdd
 
  289                 "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2 
  290                                            WHERE  OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . 
" 
  291                             AND OXRIGHT >   " . ((int) $this->oxcategories__oxright->value) . $sAdd
 
  297             $sOxidQuoted = $oDb->quote($sOXID);
 
  299             $oDb->execute(
"delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
 
  302             $oDb->execute(
"delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
 
  306             $oDb->execute(
"delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
 
  308             $oDb->execute(
"delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
 
  335         return $this->_aSubCats[$sKey];
 
  345         $this->_aSubCats = $aCats;
 
  347         foreach ($aCats as $oCat) {
 
  350             $oCat->setParentCategory($this);
 
  352             if ($oCat->getIsVisible()) {
 
  367             $this->_aSubCats[$sKey] = $oCat;
 
  369             $this->_aSubCats[] = $oCat;
 
  373         $oCat->setParentCategory($this);
 
  375         if ($oCat->getIsVisible()) {
 
  397         $this->_aContentCats = $aContent;
 
  409             $this->_aContentCats[$sKey] = $oContent;
 
  411             $this->_aContentCats[] = $oContent;
 
  424         if (!isset($this->_iNrOfArticles)
 
  427                 $myConfig->getConfigParam(
'bl_perfShowActionCatArticleCnt')
 
  428                 || 
$myConfig->getConfigParam(
'blDontShowEmptyCategories')
 
  433                 $this->_iNrOfArticles = 
oxRegistry::get(
"oxUtilsCount")->getPriceCatArticleCount($this->
getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value);
 
  449         $this->_iNrOfArticles = $iNum;
 
  459         if (!isset($this->_blIsVisible)) {
 
  461             if ($this->
getConfig()->getConfigParam(
'blDontShowEmptyCategories')) {
 
  467             $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
 
  480         $this->_blIsVisible = $blVisible;
 
  490         if ($this->_sDynImageDir === null) {
 
  491             $sThisShop = $this->oxcategories__oxshopid->value;
 
  492             $this->_sDynImageDir = $this->
getConfig()->getPictureUrl(null, 
false, null, null, $sThisShop);
 
  510             return $oEncoder->getCategoryUrl($this, $iLang);
 
  513         return $oEncoder->getCategoryPageUrl($this, $iPage, $iLang);
 
  526             (isset($this->oxcategories__oxextlink) && $this->oxcategories__oxextlink->value)
 
  531         if ($iLang === null) {
 
  535         if (!isset($this->_aSeoUrls[$iLang])) {
 
  539         return $this->_aSeoUrls[$iLang];
 
  551             $this->_aSeoUrls[$iLang] = $sLink;
 
  553             $this->_aStdUrls[$iLang] = $sLink;
 
  569         $sQ .= (strlen($sQ) ? 
' and ' : 
'') . 
" $sTable.oxhidden = '0' ";
 
  586         if (isset($this->oxcategories__oxextlink) && $this->oxcategories__oxextlink->value) {
 
  587             return $this->oxcategories__oxextlink->value;
 
  593             $sUrl = $this->
getConfig()->getShopUrl($iLang, 
false);
 
  597         return $sUrl . 
"index.php?cl=alist" . ($blAddId ? 
"&cnid=" . $this->
getId() : 
"");
 
  608     public function getStdLink($iLang = null, $aParams = array())
 
  610         if (isset($this->oxcategories__oxextlink) && $this->oxcategories__oxextlink->value) {
 
  611             return oxRegistry::get(
"oxUtilsUrl")->processUrl($this->oxcategories__oxextlink->value, 
false);
 
  614         if ($iLang === null) {
 
  618         if (!isset($this->_aStdUrls[$iLang])) {
 
  622         return oxRegistry::get(
"oxUtilsUrl")->processUrl($this->_aStdUrls[$iLang], 
true, $aParams, $iLang);
 
  642         $this->_blExpanded = $blExpanded;
 
  652         if (!isset($this->_blHasSubCats)) {
 
  653             $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1;
 
  666         if (!isset($this->_blHasVisibleSubCats)) {
 
  667             $this->_blHasVisibleSubCats = 
false;
 
  680         if ($blHasVisibleSubcats && !$this->_blHasVisibleSubCats) {
 
  681             unset($this->_blIsVisible);
 
  683                 $this->_oParent->setHasVisibleSubCats(
true);
 
  686         $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
 
  696         $sActCat = $this->
getId();
 
  699         if (!isset(self::$_aCatAttributes[$sKey])) {
 
  700             $oAttrList = 
oxNew(
"oxAttributeList");
 
  701             $oAttrList->getCategoryAttributes($sActCat, $this->
getLanguage());
 
  702             self::$_aCatAttributes[$sKey] = $oAttrList;
 
  705         return self::$_aCatAttributes[$sKey];
 
  717         $oCategoryInDefaultLanguage = 
oxNew(
"oxCategory");
 
  720             $oCategoryInDefaultLanguage = 
oxNew(
"oxCategory");
 
  721             $oCategoryInDefaultLanguage->loadInLang(0, $this->
getId());
 
  723             $oCategoryInDefaultLanguage = 
oxNew(
"oxCategory");
 
  724             $oCategoryInDefaultLanguage->loadInLang(0, $oActCategory->getId());
 
  727         return $oCategoryInDefaultLanguage;
 
  737         $this->_oParent = $oCategory;
 
  750         if ($this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 
'oxrootid') {
 
  753             if ($this->_oParent) {
 
  756                 $oCat = 
oxNew(
'oxCategory');
 
  757                 if (!$oCat->load($this->oxcategories__oxparentid->value)) {
 
  760                     $this->_oParent = $oCat;
 
  777         if (!isset($sCategoryId)) {
 
  782         return $oDb->getOne(
'select oxrootid from ' . 
getViewName(
'oxcategories') . 
' where oxid = ' . $oDb->quote($sCategoryId));
 
  813         if ($this->oxcategories__oxparentid->value != 
"oxrootid") {
 
  815             $oParent = 
oxNew(
"oxCategory");
 
  817             if (!$oParent->load($this->oxcategories__oxparentid->value)) {
 
  821             $sAdd = 
" and oxshopid = '" . $this->
getShopId() . 
"' ";
 
  826                 "UPDATE oxcategories SET OXLEFT = OXLEFT + 2 
  827                                            WHERE  OXROOTID = " . $oDb->quote($oParent->oxcategories__oxrootid->value) . 
" 
  828                             AND OXLEFT >   " . ((int) $oParent->oxcategories__oxright->value) . 
" 
  829                             AND OXRIGHT >= " . ((int) $oParent->oxcategories__oxright->value) . $sAdd
 
  834                 "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2 
  835                                            WHERE  OXROOTID = " . $oDb->quote($oParent->oxcategories__oxrootid->value) . 
" 
  836                             AND OXRIGHT >= " . ((int) $oParent->oxcategories__oxright->value) . $sAdd
 
  839             if (!$this->
getId()) {
 
  843             $this->oxcategories__oxrootid = 
new oxField($oParent->oxcategories__oxrootid->value, 
oxField::T_RAW);
 
  845             $this->oxcategories__oxright = 
new oxField($oParent->oxcategories__oxright->value + 1, 
oxField::T_RAW);
 
  850             if (!$this->
getId()) {
 
  874         $sOldParentID = $oDb->getOne(
"select oxparentid from oxcategories where oxid = " . $oDb->quote($this->getId()), 
false, 
false);
 
  876         if ($this->_blIsSeoObject && $this->
isAdmin()) {
 
  891         if ($this->oxcategories__oxparentid->value != $sOldParentID) {
 
  892             $sOldParentLeft = $this->oxcategories__oxleft->value;
 
  893             $sOldParentRight = $this->oxcategories__oxright->value;
 
  895             $iTreeSize = $sOldParentRight - $sOldParentLeft + 1;
 
  897             $sNewRootID = $oDb->getOne(
"select oxrootid from oxcategories where oxid = " . $oDb->quote($this->oxcategories__oxparentid->value), 
false, 
false);
 
  900             if ($sNewRootID == 
"") {
 
  902                 $sNewRootID = $this->
getId();
 
  905             $sNewParentLeft = $oDb->getOne(
"select oxleft from oxcategories where oxid = " . $oDb->quote($this->oxcategories__oxparentid->value), 
false, 
false);
 
  912             $iMoveAfter = $sNewParentLeft + 1;
 
  915             if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
 
  919                 $sRestoreOld = 
"UPDATE oxcategories SET OXPARENTID = " . $oDb->quote($sOldParentID) . 
" WHERE oxid = " . $oDb->quote($this->
getId());
 
  920                 $oDb->execute($sRestoreOld);
 
  926             if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
 
  927                 $sOldParentLeft += $iTreeSize;
 
  928                 $sOldParentRight += $iTreeSize;
 
  931             $iDelta = $iMoveAfter - $sOldParentLeft;
 
  935             $sAddOld = 
" and oxshopid = '" . $this->
getShopId() . 
"' and OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . 
";";
 
  936             $sAddNew = 
" and oxshopid = '" . $this->
getShopId() . 
"' and OXROOTID = " . $oDb->quote($sNewRootID) . 
";";
 
  939             $oDb->execute(
"UPDATE oxcategories SET OXLEFT = (OXLEFT + " . $iTreeSize . 
") WHERE OXLEFT >= " . $iMoveAfter . $sAddNew);
 
  940             $oDb->execute(
"UPDATE oxcategories SET OXRIGHT = (OXRIGHT + " . $iTreeSize . 
") WHERE OXRIGHT >= " . $iMoveAfter . $sAddNew);
 
  944             if ($this->oxcategories__oxrootid->value != $sNewRootID) {
 
  946                 $sChangeRootID = 
", OXROOTID=" . $oDb->quote($sNewRootID);
 
  950             $oDb->execute(
"UPDATE oxcategories SET OXLEFT = (OXLEFT + " . $iDelta . 
"), OXRIGHT = (OXRIGHT + " . $iDelta . 
") " . $sChangeRootID . 
" WHERE OXLEFT >= " . $sOldParentLeft . 
" AND OXRIGHT <= " . $sOldParentRight . $sAddOld);
 
  954             $oDb->execute(
"UPDATE oxcategories SET OXLEFT = (OXLEFT - " . $iTreeSize . 
") WHERE OXLEFT >=   " . ($sOldParentRight + 1) . $sAddOld);
 
  955             $oDb->execute(
"UPDATE oxcategories SET OXRIGHT = (OXRIGHT - " . $iTreeSize . 
") WHERE OXRIGHT >=   " . ($sOldParentRight + 1) . $sAddOld);
 
  959         if ($blRes && $this->_blIsSeoObject && $this->
isAdmin()) {
 
  978         if ($sFieldName[2] == 
'l' || $sFieldName[2] == 
'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 
'l' || $sFieldName[16] == 
'L'))) {
 
  979             if (
'oxlongdesc' === strtolower($sFieldName) || 
'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
 
  995         if (($sIcon = $this->oxcategories__oxicon->value)) {
 
  997             $sSize = $oConfig->getConfigParam(
'sCatIconsize');
 
  998             if (!isset($sSize)) {
 
  999                 $sSize = $oConfig->getConfigParam(
'sIconsize');
 
 1002             return oxRegistry::get(
"oxPictureHandler")->getPicUrl(
"category/icon/", $sIcon, $sSize);
 
 1013         if (($sIcon = $this->oxcategories__oxthumb->value)) {
 
 1014             $sSize = $this->
getConfig()->getConfigParam(
'sCatThumbnailsize');
 
 1016             return oxRegistry::get(
"oxPictureHandler")->getPicUrl(
"category/thumb/", $sIcon, $sSize);
 
 1027         if (($sIcon = $this->oxcategories__oxpromoicon->value)) {
 
 1028             $sSize = $this->
getConfig()->getConfigParam(
'sCatPromotionsize');
 
 1030             return oxRegistry::get(
"oxPictureHandler")->getPicUrl(
"category/promo_icon/", $sIcon, $sSize);
 
 1045             return $this->
getPictureUrl() . $sPicType . 
'/' . $sPicName;
 
 1058         if ($this->_blTopCategory == null) {
 
 1059             $this->_blTopCategory = $this->oxcategories__oxparentid->value == 
'oxrootid';
 
 1072         return (
bool) ($this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value);
 
 1083         if (isset($this->oxcategories__oxlongdesc) && $this->oxcategories__oxlongdesc instanceof 
oxField) {
 
 1086             return oxRegistry::get(
"oxUtilsView")->parseThroughSmarty($this->oxcategories__oxlongdesc->getRawValue(), $this->
getId() . $this->
getLanguage(), null, 
true);
 
 1097         return $this->oxcategories__oxdesc->value;
 
 1107         return $this->oxcategories__oxtitle->value;
 
 1122             $sOXID = $this->
getId();
 
 1129         $sField = 
"`{$sTable}`.`{$sField}`";
 
 1130         $sSql = 
"SELECT $sField FROM `{$sTable}` WHERE `OXROOTID` = ? AND `OXPARENTID` != 'oxrootid'";
 
 1131         $aResult = 
oxDb::getDb()->getCol($sSql, array($sOXID));