00001 <?php
00002
00008 class oxCategory extends oxI18n implements oxIUrl
00009 {
00014 protected $_aSubCats = array();
00015
00020 protected $_aContentCats = array();
00021
00027 protected $_sClassName = 'oxcategory';
00028
00034 protected $_iNrOfArticles;
00035
00041 protected $_blIsVisible;
00042
00048 protected $_blExpanded;
00049
00055 protected $_blHasSubCats;
00056
00062 protected $_blHasVisibleSubCats;
00063
00069 protected $_blIsSeoObject = true;
00070
00076 protected $_blUseLazyLoading = false;
00077
00083 protected $_sDynImageDir = null;
00084
00090 protected $_blTopCategory = null;
00091
00099 protected $_aIds = array();
00100
00106 protected $_aStdUrls = array();
00107
00113 protected $_aSeoUrls = array();
00114
00119 protected static $_aCatAttributes = array();
00120
00124 public function __construct()
00125 {
00126 parent::__construct();
00127 $this->init( 'oxcategories' );
00128 }
00129
00137 public function __get( $sName )
00138 {
00139 switch ( $sName ) {
00140 case 'aSubCats':
00141 return $this->_aSubCats;
00142 break;
00143 case 'aContent':
00144 return $this->_aContentCats;
00145 break;
00146 case 'iArtCnt':
00147 return $this->getNrOfArticles();
00148 break;
00149 case 'isVisible':
00150 return $this->getIsVisible();
00151 break;
00152 case 'expanded':
00153 return $this->getExpanded();
00154 break;
00155 case 'hasSubCats':
00156 return $this->getHasSubCats();
00157 break;
00158 case 'hasVisibleSubCats':
00159 return $this->getHasVisibleSubCats();
00160 break;
00161 case 'openlink':
00162 case 'closelink':
00163 case 'link':
00164
00165
00166 return $this->getLink();
00167 break;
00168 case 'dimagedir':
00169 return $this->getPictureUrl();
00170 break;
00171 }
00172 return parent::__get($sName);
00173 }
00174
00182 public function assign( $dbRecord )
00183 {
00184 $this->_iNrOfArticles = null;
00185 return parent::assign( $dbRecord );
00186 }
00187
00195 public function delete( $sOXID = null)
00196 {
00197 if ( !$this->getId() ) {
00198 $this->load( $sOXID );
00199 }
00200
00201 $sOXID = isset( $sOXID ) ? $sOXID : $this->getId();
00202
00203
00204 $myConfig = $this->getConfig();
00205 $oDB = oxDb::getDb();
00206 $blRet = false;
00207
00208 if ( $this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value+1) ) {
00209 $myUtilsPic = oxUtilsPic::getInstance();
00210 $sDir = $myConfig->getPictureDir(false);
00211
00212
00213
00214 $myUtilsPic->safePictureDelete( $this->oxcategories__oxthumb->value, $sDir . '/master/thumb', 'oxcategories', 'oxthumb' );
00215 $myUtilsPic->safePictureDelete( $this->oxcategories__oxicon->value, $sDir . '/master/icon', 'oxcategories', 'oxicon' );
00216 $myUtilsPic->safePictureDelete( $this->oxcategories__oxpromoicon->value, $sDir . '/master/promo_icon', 'oxcategories', 'oxpromoicon' );
00217
00218 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00219
00220 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
00221 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00222 AND OXLEFT > ".((int) $this->oxcategories__oxleft->value).$sAdd );
00223
00224 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
00225 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00226 AND OXRIGHT > ".((int) $this->oxcategories__oxright->value).$sAdd );
00227
00228
00229 $blRet = parent::delete( $sOXID );
00230
00231 $sOxidQuoted = $oDB->quote( $sOXID );
00232
00233 $oDB->execute( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
00234
00235
00236 $oDB->execute( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
00237
00238
00239
00240 $oDB->execute( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
00241
00242 $oDB->execute( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
00243
00244 oxSeoEncoderCategory::getInstance()->onDeleteCategory($this);
00245 }
00246 return $blRet;
00247 }
00248
00254 public function getSubCats()
00255 {
00256 return $this->_aSubCats;
00257 }
00258
00266 public function getSubCat($sKey)
00267 {
00268 return $this->_aSubCats[$sKey];
00269 }
00270
00278 public function setSubCats( $aCats )
00279 {
00280 $this->_aSubCats = $aCats;
00281
00282 foreach ( $aCats as $oCat ) {
00283
00284
00285 $oCat->setParentCategory( $this );
00286
00287 if ( $oCat->getIsVisible() ) {
00288 $this->setHasVisibleSubCats( true );
00289 }
00290 }
00291 }
00292
00302 public function setSubCat($oCat, $sKey=null, $blSkipSorting = false)
00303 {
00304 if ( $sKey ) {
00305 $this->_aSubCats[$sKey] = $oCat;
00306 } else {
00307 $this->_aSubCats[] = $oCat;
00308 }
00309
00310
00311 $oCat->setParentCategory( $this );
00312
00313 if ( $oCat->getIsVisible() ) {
00314 $this->setHasVisibleSubCats( true );
00315 }
00316 }
00317
00325 public function sortSubCats()
00326 {
00327 if ( count( $this->_aIds ) > 0 ) {
00328 uasort($this->_aSubCats, array( $this, 'cmpCat' ) );
00329 }
00330 }
00331
00343 public function cmpCat( $a,$b )
00344 {
00345 if ( count( $this->_aIds ) == 0 ) {
00346 return;
00347 }
00348
00349 $sNumA = $this->_aIds[$a->oxcategories__oxid->value];
00350 $sNumB = $this->_aIds[$b->oxcategories__oxid->value];
00351
00352 if ($sNumA < $sNumB ) {
00353 return -1;
00354 } if ( $sNumA == $sNumB) {
00355 return 0;
00356 }
00357 return 1;
00358 }
00359
00369 public function setSortingIds( $aSorIds )
00370 {
00371 $this->_aIds = $aSorIds;
00372 }
00373
00379 public function getContentCats()
00380 {
00381 return $this->_aContentCats;
00382 }
00383
00391 public function setContentCats( $aContent )
00392 {
00393 $this->_aContentCats = $aContent;
00394 }
00395
00404 public function setContentCat( $oContent, $sKey=null )
00405 {
00406 if ( $sKey ) {
00407 $this->_aContentCats[$sKey] = $oContent;
00408 } else {
00409 $this->_aContentCats[] = $oContent;
00410 }
00411 }
00412
00418 public function getNrOfArticles()
00419 {
00420 $myConfig = $this->getConfig();
00421
00422 if ( !isset($this->_iNrOfArticles)
00423 && !$this->isAdmin()
00424 && (
00425 $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' )
00426 || $myConfig->getConfigParam('blDontShowEmptyCategories')
00427 ) ) {
00428
00429 if ( $this->isPriceCategory() ) {
00430 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getPriceCatArticleCount( $this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value );
00431 } else {
00432 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getCatArticleCount( $this->getId() );
00433 }
00434 }
00435
00436 return (int)$this->_iNrOfArticles;
00437 }
00438
00446 public function setNrOfArticles( $iNum )
00447 {
00448 $this->_iNrOfArticles = $iNum;
00449 }
00450
00456 public function getIsVisible()
00457 {
00458 if (!isset( $this->_blIsVisible ) ) {
00459
00460 if ( $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00461 $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats();
00462 } else {
00463 $blEmpty = false;
00464 }
00465
00466 $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
00467 }
00468
00469 return $this->_blIsVisible;
00470 }
00471
00479 public function setIsVisible( $blVisible )
00480 {
00481 $this->_blIsVisible = $blVisible;
00482 }
00483
00489 public function getPictureUrl()
00490 {
00491 if ( $this->_sDynImageDir === null ) {
00492 $sThisShop = $this->oxcategories__oxshopid->value;
00493 $this->_sDynImageDir = $this->getConfig()->getPictureUrl( null, false, null, null, $sThisShop);
00494 }
00495 return $this->_sDynImageDir;
00496 }
00497
00506 public function getBaseSeoLink( $iLang, $iPage = 0 )
00507 {
00508 $oEncoder = oxSeoEncoderCategory::getInstance();
00509 if ( !$iPage ) {
00510 return $oEncoder->getCategoryUrl( $this, $iLang );
00511 }
00512 return $oEncoder->getCategoryPageUrl( $this, $iPage, $iLang );
00513 }
00514
00522 public function getLink( $iLang = null )
00523 {
00524 if ( !oxUtils::getInstance()->seoIsActive() ||
00525 ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) ) {
00526 return $this->getStdLink( $iLang );
00527 }
00528
00529 if ( $iLang === null ) {
00530 $iLang = $this->getLanguage();
00531 }
00532
00533 if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
00534 $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
00535 }
00536 return $this->_aSeoUrls[$iLang];
00537 }
00538
00546 public function setLink( $sLink )
00547 {
00548 $iLang = $this->getLanguage();
00549 if ( oxUtils::getInstance()->seoIsActive() ) {
00550 $this->_aSeoUrls[$iLang] = $sLink;
00551 } else {
00552 $this->_aStdUrls[$iLang] = $sLink;
00553 }
00554 }
00555
00563 public function getSqlActiveSnippet( $blForceCoreTable = null )
00564 {
00565 $sQ = parent::getSqlActiveSnippet( $blForceCoreTable );
00566
00567 $sTable = $this->getViewName($blForceCoreTable);
00568 $sQ .= ( strlen( $sQ )? ' and ' : '' ) . " $sTable.oxhidden = '0' ";
00569
00570
00571 return "( $sQ ) ";
00572 }
00573
00583 public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
00584 {
00585 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00586 return $this->oxcategories__oxextlink->value;
00587 }
00588
00589 $sUrl = '';
00590 if ( $blFull ) {
00591
00592 $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
00593 }
00594
00595
00596 return $sUrl . "index.php?cl=alist" . ( $blAddId ? "&cnid=".$this->getId() : "" );
00597 }
00598
00607 public function getStdLink( $iLang = null, $aParams = array() )
00608 {
00609 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00610 return oxUtilsUrl::getInstance()->processUrl( $this->oxcategories__oxextlink->value, false );
00611 }
00612
00613 if ( $iLang === null ) {
00614 $iLang = $this->getLanguage();
00615 }
00616
00617 if ( !isset( $this->_aStdUrls[$iLang] ) ) {
00618 $this->_aStdUrls[$iLang] = $this->getBaseStdLink( $iLang );
00619 }
00620
00621 return oxUtilsUrl::getInstance()->processUrl( $this->_aStdUrls[$iLang], true, $aParams, $iLang );
00622 }
00623
00629 public function getExpanded()
00630 {
00631 if ( !isset( $this->_blExpanded ) ) {
00632 $myConfig = $this->getConfig();
00633 $this->_blExpanded = ( $myConfig->getConfigParam( 'blLoadFullTree' ) && !$myConfig->getConfigParam( 'blTopNaviLayout' ) );
00634 }
00635
00636 return $this->_blExpanded;
00637 }
00638
00646 public function setExpanded( $blExpanded )
00647 {
00648 $this->_blExpanded = $blExpanded;
00649 }
00650
00656 public function getHasSubCats()
00657 {
00658 if ( !isset( $this->_blHasSubCats ) ) {
00659 $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1 ;
00660 }
00661
00662 return $this->_blHasSubCats;
00663 }
00664
00670 public function getHasVisibleSubCats()
00671 {
00672 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00673 $this->_blHasVisibleSubCats = false;
00674 }
00675
00676 return $this->_blHasVisibleSubCats;
00677 }
00678
00686 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00687 {
00688 if ( $blHasVisibleSubcats && !$this->_blHasVisibleSubCats ) {
00689 unset( $this->_blIsVisible );
00690 if ($this->_oParent instanceof oxCategory) {
00691 $this->_oParent->setHasVisibleSubCats( true );
00692 }
00693 }
00694 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00695 }
00696
00702 public function getAttributes()
00703 {
00704 $sActCat = $this->getId();
00705
00706 $sKey = md5( $sActCat . serialize( oxSession::getVar( 'session_attrfilter' ) ) );
00707 if ( !isset( self::$_aCatAttributes[$sKey] ) ) {
00708 $oAttrList = oxNew( "oxAttributeList" );
00709 $oAttrList->getCategoryAttributes( $sActCat, $this->getLanguage() );
00710 self::$_aCatAttributes[$sKey] = $oAttrList;
00711 }
00712
00713 return self::$_aCatAttributes[$sKey];
00714 }
00715
00723 public function getCatInLang( $oActCategory = null )
00724 {
00725 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00726 if ( $this->isPriceCategory() ) {
00727
00728 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00729 $oCategoryInDefaultLanguage->loadInLang( 0, $this->getId());
00730 } else {
00731 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00732 $oCategoryInDefaultLanguage->loadInLang( 0, $oActCategory->getId());
00733 }
00734 return $oCategoryInDefaultLanguage;
00735 }
00736
00744 public function setParentCategory( $oCategory )
00745 {
00746 $this->_oParent = $oCategory;
00747 }
00748
00754 public function getParentCategory()
00755 {
00756 $oCat = null;
00757
00758
00759 if ( $this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid' ) {
00760
00761
00762 if ( $this->_oParent ) {
00763 $oCat = $this->_oParent;
00764 } else {
00765 $oCat = oxNew( 'oxcategory' );
00766 if ( !$oCat->loadInLang( $this->getLanguage(), $this->oxcategories__oxparentid->value ) ) {
00767 $oCat = null;
00768 }
00769 }
00770 }
00771 return $oCat;
00772 }
00773
00781 public static function getRootId($sCategoryId)
00782 {
00783 if ( !isset( $sCategoryId ) ) {
00784 return;
00785 }
00786
00787 return oxDb::getDb()->getOne( 'select oxrootid from '.getViewName('oxcategories').' where oxid = ?', array( $sCategoryId ) );
00788 }
00789
00790
00798 public function assignViewableRecord($sSelect)
00799 {
00800 if ( $this->assignRecord( $sSelect ) ) {
00801 return true;
00802 }
00803
00804
00805 return false;
00806 }
00807
00813 protected function _insert()
00814 {
00815
00816
00817 if ( $this->oxcategories__oxparentid->value != "oxrootid") {
00818
00819
00820 $oParent = oxNew( "oxcategory" );
00821
00822 if ( !$oParent->load( $this->oxcategories__oxparentid->value) ) {
00823 return false;
00824 }
00825
00826 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00827
00828
00829 $oDB = oxDb::getDb();
00830 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT + 2
00831 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00832 AND OXLEFT > ".((int) $oParent->oxcategories__oxright->value)."
00833 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd);
00834
00835
00836 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2
00837 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00838 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd );
00839
00840
00841
00842
00843
00844 if ( !$this->getId() ) {
00845 $this->setId();
00846 }
00847
00848 $this->oxcategories__oxrootid = new oxField($oParent->oxcategories__oxrootid->value, oxField::T_RAW);
00849 $this->oxcategories__oxleft = new oxField($oParent->oxcategories__oxright->value, oxField::T_RAW);
00850 $this->oxcategories__oxright = new oxField($oParent->oxcategories__oxright->value + 1, oxField::T_RAW);
00851 return parent::_insert();
00852 } else {
00853
00854 if ( !$this->getId() ) {
00855 $this->setId();
00856 }
00857
00858 $this->oxcategories__oxrootid = new oxField($this->getId(), oxField::T_RAW);
00859 $this->oxcategories__oxleft = new oxField(1, oxField::T_RAW);
00860 $this->oxcategories__oxright = new oxField(2, oxField::T_RAW);
00861 return parent::_insert();
00862 }
00863 }
00864
00870 protected function _update()
00871 {
00872
00873 $oDB = oxDb::getDb();
00874
00875 $sOldParentID = $oDB->getOne( "select oxparentid from oxcategories where oxid = ".$oDB->quote( $this->getId() ));
00876
00877 if ( $this->_blIsSeoObject && $this->isAdmin() ) {
00878 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00879 }
00880
00881 $blRes = parent::_update();
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892 if ( $this->oxcategories__oxparentid->value != $sOldParentID) {
00893 $sOldParentLeft = $this->oxcategories__oxleft->value;
00894 $sOldParentRight = $this->oxcategories__oxright->value;
00895
00896 $iTreeSize = $sOldParentRight-$sOldParentLeft+1;
00897
00898 $sNewRootID = $oDB->getOne( "select oxrootid from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00899
00900
00901 if ( $sNewRootID == "") {
00902
00903 $sNewRootID = $this->getId();
00904 }
00905
00906 $sNewParentLeft = $oDB->getOne( "select oxleft from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00907
00908
00909
00910
00911
00912
00913 $iMoveAfter = $sNewParentLeft+1;
00914
00915
00916
00917 if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
00918
00919
00920
00921 $sRestoreOld = "UPDATE oxcategories SET OXPARENTID = ".$oDB->quote($sOldParentID)." WHERE oxid = ".$oDB->quote($this->getId());
00922 $oDB->execute( $sRestoreOld );
00923 return false;
00924 }
00925
00926
00927 if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
00928 $sOldParentLeft += $iTreeSize;
00929 $sOldParentRight += $iTreeSize;
00930 }
00931
00932 $iDelta = $iMoveAfter-$sOldParentLeft;
00933
00934
00935
00936 $sAddOld = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value).";";
00937 $sAddNew = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($sNewRootID).";";
00938
00939
00940 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iTreeSize.") WHERE OXLEFT >= ".$iMoveAfter.$sAddNew );
00941 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT + ".$iTreeSize.") WHERE OXRIGHT >= ".$iMoveAfter.$sAddNew );
00942
00943
00944 $sChangeRootID = "";
00945 if ($this->oxcategories__oxrootid->value != $sNewRootID) {
00946
00947 $sChangeRootID = ", OXROOTID=".$oDB->quote($sNewRootID);
00948 }
00949
00950
00951 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iDelta."), OXRIGHT = (OXRIGHT + ".$iDelta.") ".$sChangeRootID." WHERE OXLEFT >= ".$sOldParentLeft." AND OXRIGHT <= ".$sOldParentRight.$sAddOld );
00952
00953
00954
00955 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT - ".$iTreeSize.") WHERE OXLEFT >= ".($sOldParentRight+1).$sAddOld );
00956 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT - ".$iTreeSize.") WHERE OXRIGHT >= ".($sOldParentRight+1).$sAddOld );
00957
00958 }
00959
00960 if ( $blRes && $this->_blIsSeoObject && $this->isAdmin() ) {
00961 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00962 }
00963
00964 return $blRes;
00965 }
00966
00976 protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00977 {
00978
00979 if ($sFieldName[2] == 'l' || $sFieldName[2] == 'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 'l' || $sFieldName[16] == 'L') ) ) {
00980 if ('oxlongdesc' === strtolower($sFieldName) || 'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
00981 $iDataType = oxField::T_RAW;
00982 }
00983 }
00984 return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00985 }
00986
00987
00993 public function getIconUrl()
00994 {
00995 if ( ( $sIcon = $this->oxcategories__oxicon->value ) ) {
00996 $oConfig = $this->getConfig();
00997 $sSize = $oConfig->getConfigParam( 'sCatIconsize' );
00998 if ( !isset( $sSize ) ) {
00999 $sSize = $oConfig->getConfigParam( 'sIconsize' );
01000 }
01001
01002 return oxPictureHandler::getInstance()->getPicUrl( "category/icon/", $sIcon, $sSize );
01003 }
01004 }
01005
01011 public function getThumbUrl()
01012 {
01013 if ( ( $sIcon = $this->oxcategories__oxthumb->value ) ) {
01014 $sSize = $this->getConfig()->getConfigParam( 'sCatThumbnailsize' );
01015 return oxPictureHandler::getInstance()->getPicUrl( "category/thumb/", $sIcon, $sSize );
01016 }
01017 }
01018
01024 public function getPromotionIconUrl()
01025 {
01026 if ( ( $sIcon = $this->oxcategories__oxpromoicon->value ) ) {
01027 $sSize = $this->getConfig()->getConfigParam( 'sCatPromotionsize' );
01028 return oxPictureHandler::getInstance()->getPicUrl( "category/promo_icon/", $sIcon, $sSize );
01029 }
01030 }
01031
01040 public function getPictureUrlForType( $sPicName, $sPicType )
01041 {
01042 if ( $sPicName ) {
01043 return $this->getPictureUrl() . $sPicType . '/' . $sPicName;
01044 } else {
01045 return false;
01046 }
01047 }
01048
01054 public function isTopCategory()
01055 {
01056 if ( $this->_blTopCategory == null ) {
01057 $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
01058 }
01059 return $this->_blTopCategory;
01060 }
01061
01067 public function isPriceCategory()
01068 {
01069 return (bool) ( $this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value );
01070 }
01071
01078 public function getLongDesc()
01079 {
01080 if ( isset( $this->oxcategories__oxlongdesc ) && $this->oxcategories__oxlongdesc instanceof oxField ) {
01081 return oxUtilsView::getInstance()->parseThroughSmarty( $this->oxcategories__oxlongdesc->getRawValue(), $this->getId().$this->getLanguage() );
01082 }
01083 }
01084
01090 public function getTitle()
01091 {
01092 return $this->oxcategories__oxtitle->value;
01093 }
01094 }