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
00126 protected $_oParent = null;
00127
00131 public function __construct()
00132 {
00133 parent::__construct();
00134 $this->init( 'oxcategories' );
00135 }
00136
00144 public function __get( $sName )
00145 {
00146 switch ( $sName ) {
00147 case 'aSubCats':
00148 return $this->_aSubCats;
00149 break;
00150 case 'aContent':
00151 return $this->_aContentCats;
00152 break;
00153 case 'iArtCnt':
00154 return $this->getNrOfArticles();
00155 break;
00156 case 'isVisible':
00157 return $this->getIsVisible();
00158 break;
00159 case 'expanded':
00160 return $this->getExpanded();
00161 break;
00162 case 'hasSubCats':
00163 return $this->getHasSubCats();
00164 break;
00165 case 'hasVisibleSubCats':
00166 return $this->getHasVisibleSubCats();
00167 break;
00168 case 'openlink':
00169 case 'closelink':
00170 case 'link':
00171
00172
00173 return $this->getLink();
00174 break;
00175 case 'dimagedir':
00176 return $this->getPictureUrl();
00177 break;
00178 }
00179 return parent::__get($sName);
00180 }
00181
00189 public function assign( $dbRecord )
00190 {
00191 $this->_iNrOfArticles = null;
00192 return parent::assign( $dbRecord );
00193 }
00194
00202 public function delete( $sOXID = null)
00203 {
00204 if ( !$this->getId() ) {
00205 $this->load( $sOXID );
00206 }
00207
00208 $sOXID = isset( $sOXID ) ? $sOXID : $this->getId();
00209
00210
00211 $myConfig = $this->getConfig();
00212 $oDB = oxDb::getDb();
00213 $blRet = false;
00214
00215 if ( $this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value+1) ) {
00216 $myUtilsPic = oxUtilsPic::getInstance();
00217 $sDir = $myConfig->getPictureDir(false);
00218
00219
00220
00221 $myUtilsPic->safePictureDelete( $this->oxcategories__oxthumb->value, $sDir . '/master/thumb', 'oxcategories', 'oxthumb' );
00222 $myUtilsPic->safePictureDelete( $this->oxcategories__oxicon->value, $sDir . '/master/icon', 'oxcategories', 'oxicon' );
00223 $myUtilsPic->safePictureDelete( $this->oxcategories__oxpromoicon->value, $sDir . '/master/promo_icon', 'oxcategories', 'oxpromoicon' );
00224
00225 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00226
00227 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
00228 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00229 AND OXLEFT > ".((int) $this->oxcategories__oxleft->value).$sAdd );
00230
00231 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
00232 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00233 AND OXRIGHT > ".((int) $this->oxcategories__oxright->value).$sAdd );
00234
00235
00236 $blRet = parent::delete( $sOXID );
00237
00238 $sOxidQuoted = $oDB->quote( $sOXID );
00239
00240 $oDB->execute( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
00241
00242
00243 $oDB->execute( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
00244
00245
00246
00247 $oDB->execute( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
00248
00249 $oDB->execute( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
00250
00251 oxSeoEncoderCategory::getInstance()->onDeleteCategory($this);
00252 }
00253 return $blRet;
00254 }
00255
00261 public function getSubCats()
00262 {
00263 return $this->_aSubCats;
00264 }
00265
00273 public function getSubCat($sKey)
00274 {
00275 return $this->_aSubCats[$sKey];
00276 }
00277
00285 public function setSubCats( $aCats )
00286 {
00287 $this->_aSubCats = $aCats;
00288
00289 foreach ( $aCats as $oCat ) {
00290
00291
00292 $oCat->setParentCategory( $this );
00293
00294 if ( $oCat->getIsVisible() ) {
00295 $this->setHasVisibleSubCats( true );
00296 }
00297 }
00298 }
00299
00309 public function setSubCat($oCat, $sKey=null, $blSkipSorting = false)
00310 {
00311 if ( $sKey ) {
00312 $this->_aSubCats[$sKey] = $oCat;
00313 } else {
00314 $this->_aSubCats[] = $oCat;
00315 }
00316
00317
00318 $oCat->setParentCategory( $this );
00319
00320 if ( $oCat->getIsVisible() ) {
00321 $this->setHasVisibleSubCats( true );
00322 }
00323 }
00324
00332 public function sortSubCats()
00333 {
00334 if ( count( $this->_aIds ) > 0 ) {
00335 uasort($this->_aSubCats, array( $this, 'cmpCat' ) );
00336 }
00337 }
00338
00350 public function cmpCat( $a,$b )
00351 {
00352 if ( count( $this->_aIds ) == 0 ) {
00353 return;
00354 }
00355
00356 $sNumA = $this->_aIds[$a->oxcategories__oxid->value];
00357 $sNumB = $this->_aIds[$b->oxcategories__oxid->value];
00358
00359 if ($sNumA < $sNumB ) {
00360 return -1;
00361 } if ( $sNumA == $sNumB) {
00362 return 0;
00363 }
00364 return 1;
00365 }
00366
00376 public function setSortingIds( $aSorIds )
00377 {
00378 $this->_aIds = $aSorIds;
00379 }
00380
00386 public function getContentCats()
00387 {
00388 return $this->_aContentCats;
00389 }
00390
00398 public function setContentCats( $aContent )
00399 {
00400 $this->_aContentCats = $aContent;
00401 }
00402
00411 public function setContentCat( $oContent, $sKey=null )
00412 {
00413 if ( $sKey ) {
00414 $this->_aContentCats[$sKey] = $oContent;
00415 } else {
00416 $this->_aContentCats[] = $oContent;
00417 }
00418 }
00419
00425 public function getNrOfArticles()
00426 {
00427 $myConfig = $this->getConfig();
00428
00429 if ( !isset($this->_iNrOfArticles)
00430 && !$this->isAdmin()
00431 && (
00432 $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' )
00433 || $myConfig->getConfigParam('blDontShowEmptyCategories')
00434 ) ) {
00435
00436 if ( $this->isPriceCategory() ) {
00437 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getPriceCatArticleCount( $this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value );
00438 } else {
00439 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getCatArticleCount( $this->getId() );
00440 }
00441 }
00442
00443 return (int)$this->_iNrOfArticles;
00444 }
00445
00453 public function setNrOfArticles( $iNum )
00454 {
00455 $this->_iNrOfArticles = $iNum;
00456 }
00457
00463 public function getIsVisible()
00464 {
00465 if (!isset( $this->_blIsVisible ) ) {
00466
00467 if ( $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00468 $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats();
00469 } else {
00470 $blEmpty = false;
00471 }
00472
00473 $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
00474 }
00475
00476 return $this->_blIsVisible;
00477 }
00478
00486 public function setIsVisible( $blVisible )
00487 {
00488 $this->_blIsVisible = $blVisible;
00489 }
00490
00496 public function getPictureUrl()
00497 {
00498 if ( $this->_sDynImageDir === null ) {
00499 $sThisShop = $this->oxcategories__oxshopid->value;
00500 $this->_sDynImageDir = $this->getConfig()->getPictureUrl( null, false, null, null, $sThisShop);
00501 }
00502 return $this->_sDynImageDir;
00503 }
00504
00513 public function getBaseSeoLink( $iLang, $iPage = 0 )
00514 {
00515 $oEncoder = oxSeoEncoderCategory::getInstance();
00516 if ( !$iPage ) {
00517 return $oEncoder->getCategoryUrl( $this, $iLang );
00518 }
00519 return $oEncoder->getCategoryPageUrl( $this, $iPage, $iLang );
00520 }
00521
00529 public function getLink( $iLang = null )
00530 {
00531 if ( !oxUtils::getInstance()->seoIsActive() ||
00532 ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) ) {
00533 return $this->getStdLink( $iLang );
00534 }
00535
00536 if ( $iLang === null ) {
00537 $iLang = $this->getLanguage();
00538 }
00539
00540 if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
00541 $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
00542 }
00543 return $this->_aSeoUrls[$iLang];
00544 }
00545
00553 public function setLink( $sLink )
00554 {
00555 $iLang = $this->getLanguage();
00556 if ( oxUtils::getInstance()->seoIsActive() ) {
00557 $this->_aSeoUrls[$iLang] = $sLink;
00558 } else {
00559 $this->_aStdUrls[$iLang] = $sLink;
00560 }
00561 }
00562
00570 public function getSqlActiveSnippet( $blForceCoreTable = null )
00571 {
00572 $sQ = parent::getSqlActiveSnippet( $blForceCoreTable );
00573
00574 $sTable = $this->getViewName($blForceCoreTable);
00575 $sQ .= ( strlen( $sQ )? ' and ' : '' ) . " $sTable.oxhidden = '0' ";
00576
00577
00578 return "( $sQ ) ";
00579 }
00580
00590 public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
00591 {
00592 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00593 return $this->oxcategories__oxextlink->value;
00594 }
00595
00596 $sUrl = '';
00597 if ( $blFull ) {
00598
00599 $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
00600 }
00601
00602
00603 return $sUrl . "index.php?cl=alist" . ( $blAddId ? "&cnid=".$this->getId() : "" );
00604 }
00605
00614 public function getStdLink( $iLang = null, $aParams = array() )
00615 {
00616 if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
00617 return oxUtilsUrl::getInstance()->processUrl( $this->oxcategories__oxextlink->value, false );
00618 }
00619
00620 if ( $iLang === null ) {
00621 $iLang = $this->getLanguage();
00622 }
00623
00624 if ( !isset( $this->_aStdUrls[$iLang] ) ) {
00625 $this->_aStdUrls[$iLang] = $this->getBaseStdLink( $iLang );
00626 }
00627
00628 return oxUtilsUrl::getInstance()->processUrl( $this->_aStdUrls[$iLang], true, $aParams, $iLang );
00629 }
00630
00636 public function getExpanded()
00637 {
00638 if ( !isset( $this->_blExpanded ) ) {
00639 $myConfig = $this->getConfig();
00640 $this->_blExpanded = ( $myConfig->getConfigParam( 'blLoadFullTree' ) && !$myConfig->getConfigParam( 'blTopNaviLayout' ) );
00641 }
00642
00643 return $this->_blExpanded;
00644 }
00645
00653 public function setExpanded( $blExpanded )
00654 {
00655 $this->_blExpanded = $blExpanded;
00656 }
00657
00663 public function getHasSubCats()
00664 {
00665 if ( !isset( $this->_blHasSubCats ) ) {
00666 $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1 ;
00667 }
00668
00669 return $this->_blHasSubCats;
00670 }
00671
00677 public function getHasVisibleSubCats()
00678 {
00679 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00680 $this->_blHasVisibleSubCats = false;
00681 }
00682
00683 return $this->_blHasVisibleSubCats;
00684 }
00685
00693 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00694 {
00695 if ( $blHasVisibleSubcats && !$this->_blHasVisibleSubCats ) {
00696 unset( $this->_blIsVisible );
00697 if ($this->_oParent instanceof oxCategory) {
00698 $this->_oParent->setHasVisibleSubCats( true );
00699 }
00700 }
00701 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00702 }
00703
00709 public function getAttributes()
00710 {
00711 $sActCat = $this->getId();
00712
00713 $sKey = md5( $sActCat . serialize( oxSession::getVar( 'session_attrfilter' ) ) );
00714 if ( !isset( self::$_aCatAttributes[$sKey] ) ) {
00715 $oAttrList = oxNew( "oxAttributeList" );
00716 $oAttrList->getCategoryAttributes( $sActCat, $this->getLanguage() );
00717 self::$_aCatAttributes[$sKey] = $oAttrList;
00718 }
00719
00720 return self::$_aCatAttributes[$sKey];
00721 }
00722
00730 public function getCatInLang( $oActCategory = null )
00731 {
00732 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00733 if ( $this->isPriceCategory() ) {
00734
00735 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00736 $oCategoryInDefaultLanguage->loadInLang( 0, $this->getId());
00737 } else {
00738 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00739 $oCategoryInDefaultLanguage->loadInLang( 0, $oActCategory->getId());
00740 }
00741 return $oCategoryInDefaultLanguage;
00742 }
00743
00751 public function setParentCategory( $oCategory )
00752 {
00753 $this->_oParent = $oCategory;
00754 }
00755
00761 public function getParentCategory()
00762 {
00763 $oCat = null;
00764
00765
00766 if ( $this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid' ) {
00767
00768
00769 if ( $this->_oParent ) {
00770 $oCat = $this->_oParent;
00771 } else {
00772 $oCat = oxNew( 'oxcategory' );
00773 if ( !$oCat->loadInLang( $this->getLanguage(), $this->oxcategories__oxparentid->value ) ) {
00774 $oCat = null;
00775 } else {
00776 $this->_oParent = $oCat;
00777 }
00778 }
00779 }
00780 return $oCat;
00781 }
00782
00790 public static function getRootId($sCategoryId)
00791 {
00792 if ( !isset( $sCategoryId ) ) {
00793 return;
00794 }
00795
00796 return oxDb::getDb()->getOne( 'select oxrootid from '.getViewName('oxcategories').' where oxid = ?', array( $sCategoryId ) );
00797 }
00798
00799
00807 public function assignViewableRecord($sSelect)
00808 {
00809 if ( $this->assignRecord( $sSelect ) ) {
00810 return true;
00811 }
00812
00813
00814 return false;
00815 }
00816
00822 protected function _insert()
00823 {
00824
00825
00826 if ( $this->oxcategories__oxparentid->value != "oxrootid") {
00827
00828
00829 $oParent = oxNew( "oxcategory" );
00830
00831 if ( !$oParent->load( $this->oxcategories__oxparentid->value) ) {
00832 return false;
00833 }
00834
00835 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00836
00837
00838 $oDB = oxDb::getDb();
00839 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT + 2
00840 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00841 AND OXLEFT > ".((int) $oParent->oxcategories__oxright->value)."
00842 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd);
00843
00844
00845 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2
00846 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00847 AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd );
00848
00849
00850
00851
00852
00853 if ( !$this->getId() ) {
00854 $this->setId();
00855 }
00856
00857 $this->oxcategories__oxrootid = new oxField($oParent->oxcategories__oxrootid->value, oxField::T_RAW);
00858 $this->oxcategories__oxleft = new oxField($oParent->oxcategories__oxright->value, oxField::T_RAW);
00859 $this->oxcategories__oxright = new oxField($oParent->oxcategories__oxright->value + 1, oxField::T_RAW);
00860 return parent::_insert();
00861 } else {
00862
00863 if ( !$this->getId() ) {
00864 $this->setId();
00865 }
00866
00867 $this->oxcategories__oxrootid = new oxField($this->getId(), oxField::T_RAW);
00868 $this->oxcategories__oxleft = new oxField(1, oxField::T_RAW);
00869 $this->oxcategories__oxright = new oxField(2, oxField::T_RAW);
00870 return parent::_insert();
00871 }
00872 }
00873
00879 protected function _update()
00880 {
00881
00882 $oDB = oxDb::getDb();
00883
00884 $sOldParentID = $oDB->getOne( "select oxparentid from oxcategories where oxid = ".$oDB->quote( $this->getId() ));
00885
00886 if ( $this->_blIsSeoObject && $this->isAdmin() ) {
00887 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00888 }
00889
00890 $blRes = parent::_update();
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901 if ( $this->oxcategories__oxparentid->value != $sOldParentID) {
00902 $sOldParentLeft = $this->oxcategories__oxleft->value;
00903 $sOldParentRight = $this->oxcategories__oxright->value;
00904
00905 $iTreeSize = $sOldParentRight-$sOldParentLeft+1;
00906
00907 $sNewRootID = $oDB->getOne( "select oxrootid from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00908
00909
00910 if ( $sNewRootID == "") {
00911
00912 $sNewRootID = $this->getId();
00913 }
00914
00915 $sNewParentLeft = $oDB->getOne( "select oxleft from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00916
00917
00918
00919
00920
00921
00922 $iMoveAfter = $sNewParentLeft+1;
00923
00924
00925
00926 if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
00927
00928
00929
00930 $sRestoreOld = "UPDATE oxcategories SET OXPARENTID = ".$oDB->quote($sOldParentID)." WHERE oxid = ".$oDB->quote($this->getId());
00931 $oDB->execute( $sRestoreOld );
00932 return false;
00933 }
00934
00935
00936 if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
00937 $sOldParentLeft += $iTreeSize;
00938 $sOldParentRight += $iTreeSize;
00939 }
00940
00941 $iDelta = $iMoveAfter-$sOldParentLeft;
00942
00943
00944
00945 $sAddOld = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value).";";
00946 $sAddNew = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($sNewRootID).";";
00947
00948
00949 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iTreeSize.") WHERE OXLEFT >= ".$iMoveAfter.$sAddNew );
00950 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT + ".$iTreeSize.") WHERE OXRIGHT >= ".$iMoveAfter.$sAddNew );
00951
00952
00953 $sChangeRootID = "";
00954 if ($this->oxcategories__oxrootid->value != $sNewRootID) {
00955
00956 $sChangeRootID = ", OXROOTID=".$oDB->quote($sNewRootID);
00957 }
00958
00959
00960 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iDelta."), OXRIGHT = (OXRIGHT + ".$iDelta.") ".$sChangeRootID." WHERE OXLEFT >= ".$sOldParentLeft." AND OXRIGHT <= ".$sOldParentRight.$sAddOld );
00961
00962
00963
00964 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT - ".$iTreeSize.") WHERE OXLEFT >= ".($sOldParentRight+1).$sAddOld );
00965 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT - ".$iTreeSize.") WHERE OXRIGHT >= ".($sOldParentRight+1).$sAddOld );
00966
00967 }
00968
00969 if ( $blRes && $this->_blIsSeoObject && $this->isAdmin() ) {
00970 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00971 }
00972
00973 return $blRes;
00974 }
00975
00985 protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00986 {
00987
00988 if ($sFieldName[2] == 'l' || $sFieldName[2] == 'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 'l' || $sFieldName[16] == 'L') ) ) {
00989 if ('oxlongdesc' === strtolower($sFieldName) || 'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
00990 $iDataType = oxField::T_RAW;
00991 }
00992 }
00993 return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00994 }
00995
00996
01002 public function getIconUrl()
01003 {
01004 if ( ( $sIcon = $this->oxcategories__oxicon->value ) ) {
01005 $oConfig = $this->getConfig();
01006 $sSize = $oConfig->getConfigParam( 'sCatIconsize' );
01007 if ( !isset( $sSize ) ) {
01008 $sSize = $oConfig->getConfigParam( 'sIconsize' );
01009 }
01010
01011 return oxPictureHandler::getInstance()->getPicUrl( "category/icon/", $sIcon, $sSize );
01012 }
01013 }
01014
01020 public function getThumbUrl()
01021 {
01022 if ( ( $sIcon = $this->oxcategories__oxthumb->value ) ) {
01023 $sSize = $this->getConfig()->getConfigParam( 'sCatThumbnailsize' );
01024 return oxPictureHandler::getInstance()->getPicUrl( "category/thumb/", $sIcon, $sSize );
01025 }
01026 }
01027
01033 public function getPromotionIconUrl()
01034 {
01035 if ( ( $sIcon = $this->oxcategories__oxpromoicon->value ) ) {
01036 $sSize = $this->getConfig()->getConfigParam( 'sCatPromotionsize' );
01037 return oxPictureHandler::getInstance()->getPicUrl( "category/promo_icon/", $sIcon, $sSize );
01038 }
01039 }
01040
01049 public function getPictureUrlForType( $sPicName, $sPicType )
01050 {
01051 if ( $sPicName ) {
01052 return $this->getPictureUrl() . $sPicType . '/' . $sPicName;
01053 } else {
01054 return false;
01055 }
01056 }
01057
01063 public function isTopCategory()
01064 {
01065 if ( $this->_blTopCategory == null ) {
01066 $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
01067 }
01068 return $this->_blTopCategory;
01069 }
01070
01076 public function isPriceCategory()
01077 {
01078 return (bool) ( $this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value );
01079 }
01080
01087 public function getLongDesc()
01088 {
01089 if ( isset( $this->oxcategories__oxlongdesc ) && $this->oxcategories__oxlongdesc instanceof oxField ) {
01090 return oxUtilsView::getInstance()->parseThroughSmarty( $this->oxcategories__oxlongdesc->getRawValue(), $this->getId().$this->getLanguage() );
01091 }
01092 }
01093
01099 public function getTitle()
01100 {
01101 return $this->oxcategories__oxtitle->value;
01102 }
01103 }