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
00097 protected $_aIds = array();
00098
00102 public function __construct()
00103 {
00104 parent::__construct();
00105 $this->init( 'oxcategories' );
00106 }
00107
00115 public function __get( $sName )
00116 {
00117 switch ( $sName ) {
00118 case 'aSubCats':
00119 return $this->_aSubCats;
00120 break;
00121 case 'aContent':
00122 return $this->_aContentCats;
00123 break;
00124 case 'iArtCnt':
00125 return $this->getNrOfArticles();
00126 break;
00127 case 'isVisible':
00128 return $this->getIsVisible();
00129 break;
00130 case 'expanded':
00131 return $this->getExpanded();
00132 break;
00133 case 'hasSubCats':
00134 return $this->getHasSubCats();
00135 break;
00136 case 'hasVisibleSubCats':
00137 return $this->getHasVisibleSubCats();
00138 break;
00139 case 'openlink':
00140 case 'closelink':
00141 case 'link':
00142
00143
00144 return $this->getLink();
00145 break;
00146 case 'dimagedir':
00147 return $this->getPictureUrl();
00148 break;
00149 }
00150 return parent::__get($sName);
00151 }
00152
00160 public function assign( $dbRecord )
00161 {
00162
00163 parent::assign( $dbRecord );
00164
00165
00166 $this->oxcategories__oxlongdesc = new oxField( str_replace( '&lang=', '&lang=', $this->oxcategories__oxlongdesc->value ), oxField::T_RAW);
00167
00168 startProfile("parseThroughSmarty");
00169
00170 $myConfig = $this->getConfig();
00171 if (!$this->_isInList() && !$this->isAdmin() && $myConfig->getConfigParam( 'bl_perfParseLongDescinSmarty' ) ) {
00172 $this->oxcategories__oxlongdesc = new oxField( oxUtilsView::getInstance()->parseThroughSmarty( $this->oxcategories__oxlongdesc->value, $this->getId() ), oxField::T_RAW );
00173 }
00174
00175 if ( !$this->isAdmin() && ( $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) || $myConfig->getConfigParam('blDontShowEmptyCategories') ) ) {
00176 if ( $this->isPriceCategory() ) {
00177 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getPriceCatArticleCount( $this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value );
00178 } else {
00179 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getCatArticleCount( $this->getId() );
00180 }
00181 }
00182
00183 stopProfile("parseThroughSmarty");
00184 }
00185
00193 public function delete( $sOXID = null)
00194 {
00195 if ( !$this->getId() ) {
00196 $this->load( $sOXID);
00197 }
00198
00199
00200 $myConfig = $this->getConfig();
00201 $oDB = oxDb::getDb();
00202 $blRet = false;
00203
00204 if ( $this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value+1) ) {
00205 $myUtilsPic = oxUtilsPic::getInstance();
00206
00207
00208
00209 $myUtilsPic->safePictureDelete($this->oxcategories__oxthumb->value, $myConfig->getAbsDynImageDir().'/0', 'oxcategories', 'oxthumb' );
00210
00211 $myUtilsPic->safePictureDelete($this->oxcategories__oxicon->value, $myConfig->getAbsDynImageDir().'/icon', 'oxcategories', 'oxicon' );
00212
00213 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00214
00215 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
00216 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00217 AND OXLEFT > ".((int)$this->oxcategories__oxleft->value).$sAdd );
00218
00219 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
00220 WHERE OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value)."
00221 AND OXRIGHT > ".((int)$this->oxcategories__oxright->value).$sAdd );
00222
00223
00224 $blRet = parent::delete();
00225
00226 $sOxidQuoted = $oDB->quote($this->oxcategories__oxid->value);
00227
00228 $oDB->execute( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
00229
00230
00231 $oDB->execute( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
00232
00233
00234
00235 $oDB->execute( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
00236
00237 $oDB->execute( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
00238
00239 oxSeoEncoderCategory::getInstance()->onDeleteCategory($this);
00240 }
00241 return $blRet;
00242 }
00243
00249 public function getSubCats()
00250 {
00251 return $this->_aSubCats;
00252 }
00253
00261 public function getSubCat($sKey)
00262 {
00263 return $this->_aSubCats[$sKey];
00264 }
00265
00273 public function setSubCats( $aCats )
00274 {
00275 $this->_aSubCats = $aCats;
00276
00277 foreach ( $aCats as $oCat ) {
00278 if ( $oCat->getIsVisible() ) {
00279 $this->setHasVisibleSubCats( true );
00280 }
00281 }
00282
00283 $this->sortSubCats();
00284 }
00285
00295 public function setSubCat($oCat, $sKey=null, $blSkipSorting = false)
00296 {
00297 if ( $sKey ) {
00298 $this->_aSubCats[$sKey] = $oCat;
00299 } else {
00300 $this->_aSubCats[] = $oCat;
00301 }
00302
00303
00304 $oCat->setParentCategory( $this );
00305
00306 if ( $oCat->getIsVisible() ) {
00307 $this->setHasVisibleSubCats( true );
00308 }
00309
00310 if (!$blSkipSorting) {
00311 $this->sortSubCats();
00312 }
00313 }
00314
00320 public function sortSubCats()
00321 {
00322 if ( count( $this->_aIds ) > 0 ) {
00323 uasort($this->_aSubCats, array( $this, 'cmpCat' ) );
00324 }
00325 }
00326
00336 public function cmpCat( $a,$b )
00337 {
00338 if ( count( $this->_aIds ) == 0 ) {
00339 return;
00340 }
00341
00342 $sNumA = $this->_aIds[$a->oxcategories__oxid->value];
00343 $sNumB = $this->_aIds[$b->oxcategories__oxid->value];
00344
00345 if ($sNumA < $sNumB ) {
00346 return -1;
00347 } if ( $sNumA == $sNumB) {
00348 return 0;
00349 }
00350 return 1;
00351 }
00352
00360 public function setSortingIds( $aSorIds )
00361 {
00362 $this->_aIds = $aSorIds;
00363 }
00364
00370 public function getContentCats()
00371 {
00372 return $this->_aContentCats;
00373 }
00374
00382 public function setContentCats( $aContent )
00383 {
00384 $this->_aContentCats = $aContent;
00385 }
00386
00395 public function setContentCat( $oContent, $sKey=null )
00396 {
00397 if ( $sKey ) {
00398 $this->_aContentCats[$sKey] = $oContent;
00399 } else {
00400 $this->_aContentCats[] = $oContent;
00401 }
00402 }
00403
00409 public function getNrOfArticles()
00410 {
00411 if ( !$this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) && $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00412 return 0;
00413 }
00414
00415 return $this->_iNrOfArticles;
00416 }
00417
00425 public function setNrOfArticles( $iNum )
00426 {
00427 $this->_iNrOfArticles = $iNum;
00428 }
00429
00435 public function getIsVisible()
00436 {
00437 if (!isset( $this->_blIsVisible ) ) {
00438
00439 if ( $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00440 $blEmpty = ($this->_iNrOfArticles < 1) && !$this->getHasVisibleSubCats();
00441 } else {
00442 $blEmpty = false;
00443 }
00444
00445 $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
00446 }
00447
00448 return $this->_blIsVisible;
00449 }
00450
00458 public function setIsVisible( $blVisible )
00459 {
00460 $this->_blIsVisible = $blVisible;
00461 }
00462
00468 public function getPictureUrl()
00469 {
00470 if ( $this->_sDynImageDir === null ) {
00471 $sThisShop = $this->oxcategories__oxshopid->value;
00472 $this->_sDynImageDir = $this->getConfig()->getPictureUrl( null, false, null, null, $sThisShop);
00473 }
00474 return $this->_sDynImageDir;
00475 }
00476
00484 public function getLink($iLang = null)
00485 {
00486 if (isset($iLang)) {
00487 $iLang = (int) $iLang;
00488 if ($iLang == (int) $this->getLanguage()) {
00489 $iLang = null;
00490 }
00491 }
00492 if ( ($this->link === null ) || isset($iLang)) {
00493 if ( (!isset( $this->oxcategories__oxextlink->value ) || !$this->oxcategories__oxextlink->value ) &&
00494 oxUtils::getInstance()->seoIsActive() ) {
00495 $link = oxSeoEncoderCategory::getInstance()->getCategoryUrl( $this, $iLang );
00496 } else {
00497 $link = $this->getStdLink($iLang);
00498 }
00499
00500 if (isset($iLang)) {
00501 return $link;
00502 } else {
00503 $this->link = $link;
00504 }
00505 }
00506
00507 return $this->link;
00508 }
00509
00517 public function setLink( $sLink )
00518 {
00519 $this->link = $sLink;
00520 }
00521
00529 public function getSqlActiveSnippet( $blForceCoreTable = false )
00530 {
00531 $sTable = $this->getCoreTableName();
00532
00533 $sQ = parent::getSqlActiveSnippet( $blForceCoreTable );
00534 $sQ .= ( strlen( $sQ )? ' and ' : '' ) . " $sTable.oxhidden = '0' ";
00535
00536
00537 return "( $sQ ) ";
00538 }
00539
00548 public function getStdLink($iLang = null, $aParams = array() )
00549 {
00550 $sLink = '';
00551 if ( $this->oxcategories__oxextlink->value ) {
00552 return $this->getSession()->url( $this->oxcategories__oxextlink->value );
00553 } else {
00554 $sLink = $this->getConfig()->getShopHomeURL(). "cl=alist&cnid=" . $this->getId();
00555 }
00556
00557 if ( isset($iLang) && !oxUtils::getInstance()->seoIsActive() ) {
00558 $iLang = (int) $iLang;
00559 if ($iLang != (int) $this->getLanguage()) {
00560 $sLink .= "&lang={$iLang}";
00561 }
00562 }
00563
00564 foreach ($aParams as $key => $value) {
00565 if ( $value ) {
00566 $sLink .= "&$key=$value";
00567 }
00568 }
00569
00570 return $sLink;
00571 }
00572
00578 public function getExpanded()
00579 {
00580 if ( !isset( $this->_blExpanded ) ) {
00581 $myConfig = $this->getConfig();
00582 $this->_blExpanded = ( $myConfig->getConfigParam( 'blLoadFullTree' ) && !$myConfig->getConfigParam( 'blTopNaviLayout' ) );
00583 }
00584
00585 return $this->_blExpanded;
00586 }
00587
00595 public function setExpanded( $blExpanded )
00596 {
00597 $this->_blExpanded = $blExpanded;
00598 }
00599
00605 public function getHasSubCats()
00606 {
00607 if ( !isset( $this->_blHasSubCats ) ) {
00608 $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1 ;
00609 }
00610
00611 return $this->_blHasSubCats;
00612 }
00613
00619 public function getHasVisibleSubCats()
00620 {
00621 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00622 $this->_blHasVisibleSubCats = false;
00623 }
00624
00625 return $this->_blHasVisibleSubCats;
00626 }
00627
00635 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00636 {
00637 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00638 }
00639
00645 public function getAttributes()
00646 {
00647 $sActCat = $this->sOXID;
00648 $aAttributes = array();
00649 $blActiveFilter = false;
00650
00651 $aSessionFilter = oxSession::getVar( 'session_attrfilter' );
00652
00653 $oArtList = oxNew( "oxarticlelist");
00654 $oArtList->loadCategoryIDs( $sActCat, $aSessionFilter );
00655
00656
00657 if (count($oArtList) > 0 ) {
00658 $oDb = oxDb::getDb();
00659 $sArtIds = '';
00660 foreach (array_keys($oArtList->getArray()) as $sId ) {
00661 if ($sArtIds) {
00662 $sArtIds .= ',';
00663 }
00664 $sArtIds .= $oDb->quote($sId);
00665 }
00666 $sActCatQuoted = $oDb->quote($sActCat);
00667 $sAttTbl = getViewName('oxattribute');
00668 $sO2ATbl = getViewName('oxobject2attribute');
00669 $sC2ATbl = getViewName('oxcategory2attribute');
00670 $sLngSuf = oxLang::getInstance()->getLanguageTag($this->getLanguage());
00671
00672 $sSelect = "SELECT DISTINCT att.oxid, att.oxtitle{$sLngSuf}, o2a.oxvalue{$sLngSuf} ".
00673 "FROM $sAttTbl as att, $sO2ATbl as o2a ,$sC2ATbl as c2a ".
00674 "WHERE att.oxid = o2a.oxattrid AND c2a.oxobjectid = $sActCatQuoted AND c2a.oxattrid = att.oxid AND o2a.oxvalue{$sLngSuf} !='' AND o2a.oxobjectid IN ($sArtIds) ".
00675 "ORDER BY c2a.oxsort , att.oxpos, att.oxtitle{$sLngSuf}, o2a.oxvalue{$sLngSuf}";
00676
00677 $rs = $oDb->Execute( $sSelect);
00678 if ($rs != false && $rs->recordCount() > 0) {
00679 $oStr = getStr();
00680 while ( !$rs->EOF && list($sAttId,$sAttTitle, $sAttValue) = $rs->fields ) {
00681 if ( !isset( $aAttributes[$sAttId])) {
00682 $oAttribute = new stdClass();
00683 $oAttribute->title = $sAttTitle;
00684 $oAttribute->aValues = array();
00685 $aAttributes[$sAttId] = $oAttribute;
00686 }
00687 $oValue = new stdClass();
00688 $oValue->id = $oStr->htmlspecialchars( $sAttValue );
00689 $oValue->value = $oStr->htmlspecialchars( $sAttValue );
00690 $oValue->blSelected = isset($aSessionFilter[$sActCat][$sAttId]) && $aSessionFilter[$sActCat][$sAttId] == $sAttValue;
00691
00692 $sAttValueId = md5( $sAttValue );
00693
00694 $blActiveFilter = $blActiveFilter || $oValue->blSelected;
00695 $aAttributes[$sAttId]->aValues[$sAttValueId] = $oValue;
00696 $rs->moveNext();
00697 }
00698 }
00699
00700 }
00701
00702 if ( is_array($aSessionFilter[$sActCat]) && !$blActiveFilter ) {
00703 oxSession::setVar( "session_attrfilter", false);
00704 }
00705 return $aAttributes;
00706 }
00707
00715 public function getCatInLang( $oActCategory = null )
00716 {
00717 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00718 if ( $this->isPriceCategory() ) {
00719
00720 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00721 $oCategoryInDefaultLanguage->loadInLang( 0, $this->getId());
00722 } else {
00723 $oCategoryInDefaultLanguage= oxNew( "oxcategory" );
00724 $oCategoryInDefaultLanguage->loadInLang( 0, $oActCategory->getId());
00725 }
00726 return $oCategoryInDefaultLanguage;
00727 }
00728
00736 public function setParentCategory( $oCategory )
00737 {
00738 $this->_oParent = $oCategory;
00739 }
00740
00746 public function getParentCategory()
00747 {
00748 $oCat = null;
00749
00750
00751 if ( $this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid' ) {
00752
00753
00754 if ( $this->_oParent ) {
00755 $oCat = $this->_oParent;
00756 } else {
00757 $oCat = oxNew( 'oxcategory' );
00758 if ( !$oCat->loadInLang( $this->getLanguage(), $this->oxcategories__oxparentid->value ) ) {
00759 $oCat = null;
00760 }
00761 }
00762 }
00763 return $oCat;
00764 }
00765
00773 public static function getRootId($sCategoryId)
00774 {
00775 if ( !isset( $sCategoryId ) ) {
00776 return;
00777 }
00778
00779 return oxDb::getDb()->getOne( 'select oxrootid from '.getViewName('oxcategories').' where oxid = ?', array( $sCategoryId ) );
00780 }
00781
00782
00790 public function assignViewableRecord($sSelect)
00791 {
00792 if ( $this->assignRecord( $sSelect ) ) {
00793 return true;
00794 }
00795
00796
00797 return false;
00798 }
00799
00805 protected function _insert()
00806 {
00807
00808
00809 if ( $this->oxcategories__oxparentid->value != "oxrootid") {
00810
00811
00812 $oParent = oxNew( "oxcategory" );
00813
00814 if ( !$oParent->load( $this->oxcategories__oxparentid->value) ) {
00815 return false;
00816 }
00817
00818 $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
00819
00820
00821 $oDB = oxDb::getDb();
00822 $oDB->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT + 2
00823 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00824 AND OXLEFT > ".((int)$oParent->oxcategories__oxright->value)."
00825 AND OXRIGHT >= ".((int)$oParent->oxcategories__oxright->value).$sAdd);
00826
00827
00828 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2
00829 WHERE OXROOTID = ".$oDB->quote($oParent->oxcategories__oxrootid->value)."
00830 AND OXRIGHT >= ".((int)$oParent->oxcategories__oxright->value).$sAdd );
00831
00832
00833
00834
00835
00836 if ( !$this->getId() ) {
00837 $this->setId();
00838 }
00839
00840 $this->oxcategories__oxrootid = new oxField($oParent->oxcategories__oxrootid->value, oxField::T_RAW);
00841 $this->oxcategories__oxleft = new oxField($oParent->oxcategories__oxright->value, oxField::T_RAW);
00842 $this->oxcategories__oxright = new oxField($oParent->oxcategories__oxright->value + 1, oxField::T_RAW);
00843 return parent::_insert();
00844 } else {
00845
00846 if ( !$this->getId() ) {
00847 $this->setId();
00848 }
00849
00850 $this->oxcategories__oxrootid = new oxField($this->getId(), oxField::T_RAW);
00851 $this->oxcategories__oxleft = new oxField(1, oxField::T_RAW);
00852 $this->oxcategories__oxright = new oxField(2, oxField::T_RAW);
00853 return parent::_insert();
00854 }
00855 }
00856
00862 protected function _update()
00863 {
00864
00865 $oDB = oxDb::getDb();
00866
00867 $sOldParentID = $oDB->getOne( "select oxparentid from oxcategories where oxid = '".$this->getId()."'");
00868
00869 if ( $this->_blIsSeoObject && $this->isAdmin() ) {
00870 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00871 }
00872
00873 $blRes = parent::_update();
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884 if ( $this->oxcategories__oxparentid->value != $sOldParentID) {
00885 $sOldParentLeft = $this->oxcategories__oxleft->value;
00886 $sOldParentRight = $this->oxcategories__oxright->value;
00887
00888 $iTreeSize = $sOldParentRight-$sOldParentLeft+1;
00889
00890 $sNewRootID = $oDB->getOne( "select oxrootid from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00891
00892
00893 if ( $sNewRootID == "") {
00894
00895 $sNewRootID = $this->getId();
00896 }
00897
00898 $sNewParentLeft = $oDB->getOne( "select oxleft from oxcategories where oxid = ".$oDB->quote($this->oxcategories__oxparentid->value));
00899
00900
00901
00902
00903
00904
00905 $iMoveAfter = $sNewParentLeft+1;
00906
00907
00908
00909 if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
00910
00911
00912
00913 $sRestoreOld = "UPDATE oxcategories SET OXPARENTID = ".$oDB->quote($sOldParentID)." WHERE oxid = '".$this->getId()."'";
00914 $oDB->execute( $sRestoreOld );
00915 return false;
00916 }
00917
00918
00919 if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
00920 $sOldParentLeft += $iTreeSize;
00921 $sOldParentRight += $iTreeSize;
00922 }
00923
00924 $iDelta = $iMoveAfter-$sOldParentLeft;
00925
00926
00927
00928 $sAddOld = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($this->oxcategories__oxrootid->value).";";
00929 $sAddNew = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDB->quote($sNewRootID).";";
00930
00931
00932 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iTreeSize.") WHERE OXLEFT >= ".$iMoveAfter.$sAddNew );
00933 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT + ".$iTreeSize.") WHERE OXRIGHT >= ".$iMoveAfter.$sAddNew );
00934
00935
00936 $sChangeRootID = "";
00937 if ($this->oxcategories__oxrootid->value != $sNewRootID) {
00938
00939 $sChangeRootID = ", OXROOTID=".$oDB->quote($sNewRootID);
00940 }
00941
00942
00943 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iDelta."), OXRIGHT = (OXRIGHT + ".$iDelta.") ".$sChangeRootID." WHERE OXLEFT >= ".$sOldParentLeft." AND OXRIGHT <= ".$sOldParentRight.$sAddOld );
00944
00945
00946
00947 $oDB->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT - ".$iTreeSize.") WHERE OXLEFT >= ".($sOldParentRight+1).$sAddOld );
00948 $oDB->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT - ".$iTreeSize.") WHERE OXRIGHT >= ".($sOldParentRight+1).$sAddOld );
00949
00950 }
00951
00952 if ( $blRes && $this->_blIsSeoObject && $this->isAdmin() ) {
00953 oxSeoEncoderCategory::getInstance()->markRelatedAsExpired($this);
00954 }
00955
00956 return $blRes;
00957 }
00958
00968 protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
00969 {
00970
00971 if ($sFieldName[2] == 'l' || $sFieldName[2] == 'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 'l' || $sFieldName[16] == 'L') ) ) {
00972 if ('oxlongdesc' === strtolower($sFieldName) || 'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
00973 $iDataType = oxField::T_RAW;
00974 }
00975 }
00976 return parent::_setFieldData($sFieldName, $sValue, $iDataType);
00977 }
00978
00979
00985 public function getIconUrl()
00986 {
00987 return $this->getConfig()->getPictureUrl( 'icon/'.$this->oxcategories__oxicon->value );
00988 }
00989
00995 public function isTopCategory()
00996 {
00997 if ( $this->_blTopCategory == null ) {
00998 $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
00999 }
01000 return $this->_blTopCategory;
01001 }
01002
01008 public function isPriceCategory()
01009 {
01010 return (bool) ( $this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value );
01011 }
01012 }