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
00202 $myConfig = $this->getConfig();
00203 $oDB = oxDb::getDb();
00204 $blRet = false;
00205
00206 if ( $this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value+1) ) {
00207 $myUtilsPic = oxUtilsPic::getInstance();
00208 $sDir = $myConfig->getPictureDir(false);
00209
00210
00211
00212 $myUtilsPic->safePictureDelete( $this->oxcategories__oxthumb->value, $sDir . '/master/thumb', 'oxcategories', 'oxthumb' );
00213 $myUtilsPic->safePictureDelete( $this->oxcategories__oxicon->value, $sDir . '/master/icon', 'oxcategories', 'oxicon' );
00214 $myUtilsPic->safePictureDelete( $this->oxcategories__oxpromoicon->value, $sDir . '/master/promo_icon', 'oxcategories', 'oxpromoicon' );
00215
00216 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00217
00218 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
00219 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00220 AND OXLEFT > ".((int) $this->oxcategories__oxleft->value).$sAdd );
00221
00222 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
00223 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00224 AND OXRIGHT > ".((int) $this->oxcategories__oxright->value).$sAdd );
00225
00226
00227 $blRet = parent::delete();
00228
00229 $sOxidQuoted = $oDB->quote($this->oxcategories__oxid->value);
00230
00231 $oDB->execute( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
00232
00233
00234 $oDB->execute( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
00235
00236
00237
00238 $oDB->execute( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
00239
00240 $oDB->execute( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
00241
00242 oxSeoEncoderCategory::getInstance()->onDeleteCategory($this);
00243 }
00244 return $blRet;
00245 }
00246
00252 public function getSubCats()
00253 {
00254 return $this->_aSubCats;
00255 }
00256
00264 public function getSubCat($sKey)
00265 {
00266 return $this->_aSubCats[$sKey];
00267 }
00268
00276 public function setSubCats( $aCats )
00277 {
00278 $this->_aSubCats = $aCats;
00279
00280 foreach ( $aCats as $oCat ) {
00281
00282
00283 $oCat->setParentCategory( $this );
00284
00285 if ( $oCat->getIsVisible() ) {
00286 $this->setHasVisibleSubCats( true );
00287 }
00288 }
00289 }
00290
00300 public function setSubCat($oCat, $sKey=null, $blSkipSorting = false)
00301 {
00302 if ( $sKey ) {
00303 $this->_aSubCats[$sKey] = $oCat;
00304 } else {
00305 $this->_aSubCats[] = $oCat;
00306 }
00307
00308
00309 $oCat->setParentCategory( $this );
00310
00311 if ( $oCat->getIsVisible() ) {
00312 $this->setHasVisibleSubCats( true );
00313 }
00314 }
00315
00323 public function sortSubCats()
00324 {
00325 if ( count( $this->_aIds ) > 0 ) {
00326 uasort($this->_aSubCats, array( $this, 'cmpCat' ) );
00327 }
00328 }
00329
00341 public function cmpCat( $a,$b )
00342 {
00343 if ( count( $this->_aIds ) == 0 ) {
00344 return;
00345 }
00346
00347 $sNumA = $this->_aIds[$a->oxcategories__oxid->value];
00348 $sNumB = $this->_aIds[$b->oxcategories__oxid->value];
00349
00350 if ($sNumA < $sNumB ) {
00351 return -1;
00352 } if ( $sNumA == $sNumB) {
00353 return 0;
00354 }
00355 return 1;
00356 }
00357
00367 public function setSortingIds( $aSorIds )
00368 {
00369 $this->_aIds = $aSorIds;
00370 }
00371
00377 public function getContentCats()
00378 {
00379 return $this->_aContentCats;
00380 }
00381
00389 public function setContentCats( $aContent )
00390 {
00391 $this->_aContentCats = $aContent;
00392 }
00393
00402 public function setContentCat( $oContent, $sKey=null )
00403 {
00404 if ( $sKey ) {
00405 $this->_aContentCats[$sKey] = $oContent;
00406 } else {
00407 $this->_aContentCats[] = $oContent;
00408 }
00409 }
00410
00416 public function getNrOfArticles()
00417 {
00418 $myConfig = $this->getConfig();
00419
00420 if ( !isset($this->_iNrOfArticles)
00421 && !$this->isAdmin()
00422 && (
00423 $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' )
00424 || $myConfig->getConfigParam('blDontShowEmptyCategories')
00425 ) ) {
00426
00427 if ( $this->isPriceCategory() ) {
00428 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getPriceCatArticleCount( $this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value );
00429 } else {
00430 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getCatArticleCount( $this->getId() );
00431 }
00432 }
00433
00434 return (int)$this->_iNrOfArticles;
00435 }
00436
00444 public function setNrOfArticles( $iNum )
00445 {
00446 $this->_iNrOfArticles = $iNum;
00447 }
00448
00454 public function getIsVisible()
00455 {
00456 if (!isset( $this->_blIsVisible ) ) {
00457
00458 if ( $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00459 $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats();
00460 } else {
00461 $blEmpty = false;
00462 }
00463
00464 $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
00465 }
00466
00467 return $this->_blIsVisible;
00468 }
00469
00477 public function setIsVisible( $blVisible )
00478 {
00479 $this->_blIsVisible = $blVisible;
00480 }
00481
00487 public function getPictureUrl()
00488 {
00489 if ( $this->_sDynImageDir === null ) {
00490 $sThisShop = $this->oxcategories__oxshopid->value;
00491 $this->_sDynImageDir = $this->getConfig()->getPictureUrl( null, false, null, null, $sThisShop);
00492 }
00493 return $this->_sDynImageDir;
00494 }
00495
00504 public function getBaseSeoLink( $iLang, $iPage = 0 )
00505 {
00506 $oEncoder = oxSeoEncoderCategory::getInstance();
00507 if ( !$iPage ) {
00508 return $oEncoder->getCategoryUrl( $this, $iLang );
00509 }
00510 return $oEncoder->getCategoryPageUrl( $this, $iPage, $iLang );
00511 }
00512
00520 public function getLink( $iLang = null )
00521 {
00522 if ( !oxUtils::getInstance()->seoIsActive() ||
00523 ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) ) {
00524 return $this->getStdLink( $iLang );
00525 }
00526
00527 if ( $iLang === null ) {
00528 $iLang = $this->getLanguage();
00529 }
00530
00531 if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
00532 $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
00533 }
00534 return $this->_aSeoUrls[$iLang];
00535 }
00536
00544 public function setLink( $sLink )
00545 {
00546 $iLang = $this->getLanguage();
00547 if ( oxUtils::getInstance()->seoIsActive() ) {
00548 $this->_aSeoUrls[$iLang] = $sLink;
00549 } else {
00550 $this->_aStdUrls[$iLang] = $sLink;
00551 }
00552 }
00553
00561 public function getSqlActiveSnippet( $blForceCoreTable = null )
00562 {
00563 $sQ = parent::getSqlActiveSnippet( $blForceCoreTable );
00564
00565 $sTable = $this->getViewName($blForceCoreTable);
00566 $sQ .= ( strlen( $sQ )? ' and ' : '' ) . " $sTable.oxhidden = '0' ";
00567
00568
00569 return "( $sQ ) ";
00570 }
00571
00581 public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
00582 {
00583 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00584 return $this->oxcategories__oxextlink->value;
00585 }
00586
00587 $sUrl = '';
00588 if ( $blFull ) {
00589
00590 $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
00591 }
00592
00593
00594 return $sUrl . "index.php?cl=alist" . ( $blAddId ? "&cnid=".$this->getId() : "" );
00595 }
00596
00605 public function getStdLink( $iLang = null, $aParams = array() )
00606 {
00607 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00608 return oxUtilsUrl::getInstance()->processUrl( $this->oxcategories__oxextlink->value, false );
00609 }
00610
00611 if ( $iLang === null ) {
00612 $iLang = $this->getLanguage();
00613 }
00614
00615 if ( !isset( $this->_aStdUrls[$iLang] ) ) {
00616 $this->_aStdUrls[$iLang] = $this->getBaseStdLink( $iLang );
00617 }
00618
00619 return oxUtilsUrl::getInstance()->processUrl( $this->_aStdUrls[$iLang], true, $aParams, $iLang );
00620 }
00621
00627 public function getExpanded()
00628 {
00629 if ( !isset( $this->_blExpanded ) ) {
00630 $myConfig = $this->getConfig();
00631 $this->_blExpanded = ( $myConfig->getConfigParam( 'blLoadFullTree' ) && !$myConfig->getConfigParam( 'blTopNaviLayout' ) );
00632 }
00633
00634 return $this->_blExpanded;
00635 }
00636
00644 public function setExpanded( $blExpanded )
00645 {
00646 $this->_blExpanded = $blExpanded;
00647 }
00648
00654 public function getHasSubCats()
00655 {
00656 if ( !isset( $this->_blHasSubCats ) ) {
00657 $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1 ;
00658 }
00659
00660 return $this->_blHasSubCats;
00661 }
00662
00668 public function getHasVisibleSubCats()
00669 {
00670 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00671 $this->_blHasVisibleSubCats = false;
00672 }
00673
00674 return $this->_blHasVisibleSubCats;
00675 }
00676
00684 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00685 {
00686 if ( $blHasVisibleSubcats && !$this->_blHasVisibleSubCats ) {
00687 unset( $this->_blIsVisible );
00688 if ($this->_oParent instanceof oxCategory) {
00689 $this->_oParent->setHasVisibleSubCats( true );
00690 }
00691 }
00692 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00693 }
00694
00700 public function getAttributes()
00701 {
00702 $sActCat = $this->getId();
00703
00704 $sKey = md5( $sActCat . serialize( oxSession::getVar( 'session_attrfilter' ) ) );
00705 if ( !isset( self::$_aCatAttributes[$sKey] ) ) {
00706 $oAttrList = oxNew( "oxAttributeList" );
00707 $oAttrList->getCategoryAttributes( $sActCat, $this->getLanguage() );
00708 self::$_aCatAttributes[$sKey] = $oAttrList;
00709 }
00710
00711 return self::$_aCatAttributes[$sKey];
00712 }
00713
00721 public function getCatInLang( $oActCategory = null )
00722 {
00723 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00724 if ( $this->isPriceCategory() ) {
00725
00726 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00727 $oCategoryInDefaultLanguage->loadInLang( 0, $this->getId());
00728 } else {
00729 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00730 $oCategoryInDefaultLanguage->loadInLang( 0, $oActCategory->getId());
00731 }
00732 return $oCategoryInDefaultLanguage;
00733 }
00734
00742 public function setParentCategory( $oCategory )
00743 {
00744 $this->_oParent = $oCategory;
00745 }
00746
00752 public function getParentCategory()
00753 {
00754 $oCat = null;
00755
00756
00757 if ( $this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid' ) {
00758
00759
00760 if ( $this->_oParent ) {
00761 $oCat = $this->_oParent;
00762 } else {
00763 $oCat = oxNew( 'oxcategory' );
00764 if ( !$oCat->loadInLang( $this->getLanguage(), $this->oxcategories__oxparentid->value ) ) {
00765 $oCat = null;
00766 }
00767 }
00768 }
00769 return $oCat;
00770 }
00771
00779 public static function getRootId($sCategoryId)
00780 {
00781 if ( !isset( $sCategoryId ) ) {
00782 return;
00783 }
00784
00785 return oxDb::getDb()->getOne( 'select oxrootid from '.getViewName('oxcategories').' where oxid = ?', array( $sCategoryId ) );
00786 }
00787
00788
00796 public function assignViewableRecord($sSelect)
00797 {
00798 if ( $this->assignRecord( $sSelect ) ) {
00799 return true;
00800 }
00801
00802
00803 return false;
00804 }
00805
00811 protected function _insert()
00812 {
00813
00814
00815 if ( $this->oxcategories__oxparentid->value != "oxrootid") {
00816
00817
00818 $oParent = oxNew( "oxcategory" );
00819
00820 if ( !$oParent->load( $this->oxcategories__oxparentid->value) ) {
00821 return false;
00822 }
00823
00824 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00825
00826
00827 $oDB = oxDb::getDb();
00828 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT + 2
00829 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00830 AND OXLEFT > ".((int) $oParent->oxcategories__oxright->value)."
00831 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd);
00832
00833
00834 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2
00835 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00836 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd );
00837
00838
00839
00840
00841
00842 if ( !$this->getId() ) {
00843 $this->setId();
00844 }
00845
00846 $this->oxcategories__oxrootid = new oxField($oParent->oxcategories__oxrootid->value, oxField::T_RAW);
00847 $this->oxcategories__oxleft = new oxField($oParent->oxcategories__oxright->value, oxField::T_RAW);
00848 $this->oxcategories__oxright = new oxField($oParent->oxcategories__oxright->value + 1, oxField::T_RAW);
00849 return parent::_insert();
00850 } else {
00851
00852 if ( !$this->getId() ) {
00853 $this->setId();
00854 }
00855
00856 $this->oxcategories__oxrootid = new oxField($this->getId(), oxField::T_RAW);
00857 $this->oxcategories__oxleft = new oxField(1, oxField::T_RAW);
00858 $this->oxcategories__oxright = new oxField(2, oxField::T_RAW);
00859 return parent::_insert();
00860 }
00861 }
00862
00868 protected function _update()
00869 {
00870
00871 $oDB = oxDb::getDb();
00872
00873 $sOldParentID = $oDB->getOne( "select oxparentid from oxcategories where oxid = '".$this->getId()."'");
00874
00875 if ( $this->_blIsSeoObject && $this->isAdmin() ) {
00876 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00877 }
00878
00879 $blRes = parent::_update();
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890 if ( $this->oxcategories__oxparentid->value != $sOldParentID) {
00891 $sOldParentLeft = $this->oxcategories__oxleft->value;
00892 $sOldParentRight = $this->oxcategories__oxright->value;
00893
00894 $iTreeSize = $sOldParentRight-$sOldParentLeft+1;
00895
00896 $sNewRootID = $oDB->getOne( "select oxrootid from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00897
00898
00899 if ( $sNewRootID == "") {
00900
00901 $sNewRootID = $this->getId();
00902 }
00903
00904 $sNewParentLeft = $oDB->getOne( "select oxleft from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00905
00906
00907
00908
00909
00910
00911 $iMoveAfter = $sNewParentLeft+1;
00912
00913
00914
00915 if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
00916
00917
00918
00919 $sRestoreOld = "UPDATE oxcategories SET OXPARENTID = ".$oDB->quote($sOldParentID)." WHERE oxid = '".$this->getId()."'";
00920 $oDB->execute( $sRestoreOld );
00921 return false;
00922 }
00923
00924
00925 if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
00926 $sOldParentLeft += $iTreeSize;
00927 $sOldParentRight += $iTreeSize;
00928 }
00929
00930 $iDelta = $iMoveAfter-$sOldParentLeft;
00931
00932
00933
00934 $sAddOld = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value).";";
00935 $sAddNew = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($sNewRootID).";";
00936
00937
00938 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iTreeSize.") WHERE OXLEFT >= ".$iMoveAfter.$sAddNew );
00939 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT + ".$iTreeSize.") WHERE OXRIGHT >= ".$iMoveAfter.$sAddNew );
00940
00941
00942 $sChangeRootID = "";
00943 if ($this->oxcategories__oxrootid->value != $sNewRootID) {
00944
00945 $sChangeRootID = ", OXROOTID=".$oDB->quote($sNewRootID);
00946 }
00947
00948
00949 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iDelta."), OXRIGHT = (OXRIGHT + ".$iDelta.") ".$sChangeRootID." WHERE OXLEFT >= ".$sOldParentLeft." AND OXRIGHT <= ".$sOldParentRight.$sAddOld );
00950
00951
00952
00953 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT - ".$iTreeSize.") WHERE OXLEFT >= ".($sOldParentRight+1).$sAddOld );
00954 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT - ".$iTreeSize.") WHERE OXRIGHT >= ".($sOldParentRight+1).$sAddOld );
00955
00956 }
00957
00958 if ( $blRes && $this->_blIsSeoObject && $this->isAdmin() ) {
00959 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00960 }
00961
00962 return $blRes;
00963 }
00964
00974 protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00975 {
00976
00977 if ($sFieldName[2] == 'l' || $sFieldName[2] == 'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 'l' || $sFieldName[16] == 'L') ) ) {
00978 if ('oxlongdesc' === strtolower($sFieldName) || 'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
00979 $iDataType = oxField::T_RAW;
00980 }
00981 }
00982 return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00983 }
00984
00985
00991 public function getIconUrl()
00992 {
00993 if ( ( $sIcon = $this->oxcategories__oxicon->value ) ) {
00994 $oConfig = $this->getConfig();
00995 $sSize = $oConfig->getConfigParam( 'sCatIconsize' );
00996 if ( !isset( $sSize ) ) {
00997 $sSize = $oConfig->getConfigParam( 'sIconsize' );
00998 }
00999
01000 return oxPictureHandler::getInstance()->getPicUrl( "category/icon/", $sIcon, $sSize );
01001 }
01002 }
01003
01009 public function getThumbUrl()
01010 {
01011 if ( ( $sIcon = $this->oxcategories__oxthumb->value ) ) {
01012 $sSize = $this->getConfig()->getConfigParam( 'sCatThumbnailsize' );
01013 return oxPictureHandler::getInstance()->getPicUrl( "category/thumb/", $sIcon, $sSize );
01014 }
01015 }
01016
01022 public function getPromotionIconUrl()
01023 {
01024 if ( ( $sIcon = $this->oxcategories__oxpromoicon->value ) ) {
01025 $sSize = $this->getConfig()->getConfigParam( 'sCatPromotionsize' );
01026 return oxPictureHandler::getInstance()->getPicUrl( "category/promo_icon/", $sIcon, $sSize );
01027 }
01028 }
01029
01038 public function getPictureUrlForType( $sPicName, $sPicType )
01039 {
01040 if ( $sPicName ) {
01041 return $this->getPictureUrl() . $sPicType . '/' . $sPicName;
01042 } else {
01043 return false;
01044 }
01045 }
01046
01052 public function isTopCategory()
01053 {
01054 if ( $this->_blTopCategory == null ) {
01055 $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
01056 }
01057 return $this->_blTopCategory;
01058 }
01059
01065 public function isPriceCategory()
01066 {
01067 return (bool) ( $this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value );
01068 }
01069
01076 public function getLongDesc()
01077 {
01078 return oxUtilsView::getInstance()->parseThroughSmarty( $this->oxcategories__oxlongdesc->getRawValue(), $this->getId().$this->getLanguage() );
01079 }
01080
01086 public function getTitle()
01087 {
01088 return $this->oxcategories__oxtitle->value;
01089 }
01090 }