OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
oxcategory.php
Go to the documentation of this file.
1 <?php
2 
9 class oxCategory extends oxI18n implements oxIUrl
10 {
15  protected $_aSubCats = array();
16 
21  protected $_aContentCats = array();
22 
28  protected $_sClassName = 'oxcategory';
29 
35  protected $_iNrOfArticles;
36 
42  protected $_blIsVisible;
43 
49  protected $_blExpanded;
50 
56  protected $_blHasSubCats;
57 
64 
70  protected $_blIsSeoObject = true;
71 
77  protected $_blUseLazyLoading = false;
78 
84  protected $_sDynImageDir = null;
85 
91  protected $_blTopCategory = null;
92 
98  protected $_aStdUrls = array();
99 
105  protected $_aSeoUrls = array();
106 
111  protected static $_aCatAttributes = array();
112 
118  protected $_oParent = null;
119 
123  public function __construct()
124  {
126  $this->init( 'oxcategories' );
127  }
128 
134  public function getDefaultSorting()
135  {
136  return $this->oxcategories__oxdefsort->value;
137  }
138 
144  public function getDefaultSortingMode()
145  {
146  return $this->oxcategories__oxdefsortmode->value;
147  }
148 
156  public function __get( $sName )
157  {
158  switch ( $sName ) {
159  case 'aSubCats':
160  return $this->_aSubCats;
161  break;
162  case 'aContent':
163  return $this->_aContentCats;
164  break;
165  case 'iArtCnt':
166  return $this->getNrOfArticles();
167  break;
168  case 'isVisible':
169  return $this->getIsVisible();
170  break;
171  case 'expanded':
172  return $this->getExpanded();
173  break;
174  case 'hasSubCats':
175  return $this->getHasSubCats();
176  break;
177  case 'hasVisibleSubCats':
178  return $this->getHasVisibleSubCats();
179  break;
180  case 'openlink':
181  case 'closelink':
182  case 'link':
183  //case 'toListLink':
184  //case 'noparamlink':
185  return $this->getLink();
186  break;
187  case 'dimagedir':
188  return $this->getPictureUrl();
189  break;
190  }
191  return parent::__get($sName);
192  }
193 
194 
202  protected function _loadFromDb( $sOXID )
203  {
204  $sSelect = $this->buildSelectString( array( $this->getViewName().".oxid" => $sOXID ));
205  $aData = oxDb::getDb( oxDb::FETCH_MODE_ASSOC )->getRow( $sSelect );
206  return $aData;
207  }
208 
216  public function load( $sOXID )
217  {
218 
219  $aData = $this->_loadFromDb( $sOXID );
220 
221  if ( $aData ) {
222  $this->assign( $aData );
223  return true;
224  }
225 
226  return false;
227  }
228 
229 
237  public function assign( $dbRecord )
238  {
239  $this->_iNrOfArticles = null;
240  return parent::assign( $dbRecord );
241  }
242 
250  public function delete( $sOXID = null )
251  {
252  if ( !$this->getId() ) {
253  $this->load( $sOXID );
254  }
255 
256  $sOXID = isset( $sOXID ) ? $sOXID : $this->getId();
257 
258 
259  $myConfig = $this->getConfig();
260  $oDb = oxDb::getDb();
261  $blRet = false;
262 
263  if ( $this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value+1) ) {
264  $myUtilsPic = oxRegistry::get("oxUtilsPic");
265  $sDir = $myConfig->getPictureDir(false);
266 
267  // only delete empty categories
268  // #1173M - not all pic are deleted, after article is removed
269  $myUtilsPic->safePictureDelete( $this->oxcategories__oxthumb->value, $sDir . oxRegistry::get("oxUtilsFile")->getImageDirByType('TC'), 'oxcategories', 'oxthumb' );
270  $myUtilsPic->safePictureDelete( $this->oxcategories__oxicon->value, $sDir . oxRegistry::get("oxUtilsFile")->getImageDirByType('CICO'), 'oxcategories', 'oxicon' );
271  $myUtilsPic->safePictureDelete( $this->oxcategories__oxpromoicon->value, $sDir . oxRegistry::get("oxUtilsFile")->getImageDirByType('PICO'), 'oxcategories', 'oxpromoicon' );
272 
273  $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
274 
275  $oDb->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
276  WHERE OXROOTID = ".$oDb->quote($this->oxcategories__oxrootid->value)."
277  AND OXLEFT > ".((int) $this->oxcategories__oxleft->value).$sAdd );
278 
279  $oDb->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
280  WHERE OXROOTID = ".$oDb->quote($this->oxcategories__oxrootid->value)."
281  AND OXRIGHT > ".((int) $this->oxcategories__oxright->value).$sAdd );
282 
283  // delete entry
284  $blRet = parent::delete( $sOXID );
285 
286  $sOxidQuoted = $oDb->quote( $sOXID );
287  // delete links to articles
288  $oDb->execute( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");
289 
290  // #657 ADDITIONAL delete links to attributes
291  $oDb->execute( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");
292 
293  // A. removing assigned:
294  // - deliveries
295  $oDb->execute( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
296  // - discounts
297  $oDb->execute( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");
298 
299  oxRegistry::get("oxSeoEncoderCategory")->onDeleteCategory($this);
300  }
301 
302  return $blRet;
303  }
304 
310  public function getSubCats()
311  {
312  return $this->_aSubCats;
313  }
314 
322  public function getSubCat($sKey)
323  {
324  return $this->_aSubCats[$sKey];
325  }
326 
334  public function setSubCats( $aCats )
335  {
336  $this->_aSubCats = $aCats;
337 
338  foreach ( $aCats as $oCat ) {
339 
340  // keeping ref. to parent
341  $oCat->setParentCategory( $this );
342 
343  if ( $oCat->getIsVisible() ) {
344  $this->setHasVisibleSubCats( true );
345  }
346  }
347  }
348 
357  public function setSubCat( $oCat, $sKey=null )
358  {
359  if ( $sKey ) {
360  $this->_aSubCats[$sKey] = $oCat;
361  } else {
362  $this->_aSubCats[] = $oCat;
363  }
364 
365  // keeping ref. to parent
366  $oCat->setParentCategory( $this );
367 
368  if ( $oCat->getIsVisible() ) {
369  $this->setHasVisibleSubCats( true );
370  }
371  }
372 
378  public function getContentCats()
379  {
380  return $this->_aContentCats;
381  }
382 
390  public function setContentCats( $aContent )
391  {
392  $this->_aContentCats = $aContent;
393  }
394 
403  public function setContentCat( $oContent, $sKey=null )
404  {
405  if ( $sKey ) {
406  $this->_aContentCats[$sKey] = $oContent;
407  } else {
408  $this->_aContentCats[] = $oContent;
409  }
410  }
411 
417  public function getNrOfArticles()
418  {
419  $myConfig = $this->getConfig();
420 
421  if ( !isset($this->_iNrOfArticles)
422  && !$this->isAdmin()
423  && (
424  $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' )
425  || $myConfig->getConfigParam('blDontShowEmptyCategories')
426  ) ) {
427 
428  if ( $this->isPriceCategory() ) {
429  $this->_iNrOfArticles = oxRegistry::get("oxUtilsCount")->getPriceCatArticleCount( $this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value );
430  } else {
431  $this->_iNrOfArticles = oxRegistry::get("oxUtilsCount")->getCatArticleCount( $this->getId() );
432  }
433  }
434 
435  return (int)$this->_iNrOfArticles;
436  }
437 
445  public function setNrOfArticles( $iNum )
446  {
447  $this->_iNrOfArticles = $iNum;
448  }
449 
455  public function getIsVisible()
456  {
457  if (!isset( $this->_blIsVisible ) ) {
458 
459  if ( $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
460  $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats();
461  } else {
462  $blEmpty = false;
463  }
464 
465  $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value);
466  }
467 
468  return $this->_blIsVisible;
469  }
470 
478  public function setIsVisible( $blVisible )
479  {
480  $this->_blIsVisible = $blVisible;
481  }
482 
488  public function getPictureUrl()
489  {
490  if ( $this->_sDynImageDir === null ) {
491  $sThisShop = $this->oxcategories__oxshopid->value;
492  $this->_sDynImageDir = $this->getConfig()->getPictureUrl( null, false, null, null, $sThisShop);
493  }
494  return $this->_sDynImageDir;
495  }
496 
505  public function getBaseSeoLink( $iLang, $iPage = 0 )
506  {
507  $oEncoder = oxRegistry::get("oxSeoEncoderCategory");
508  if ( !$iPage ) {
509  return $oEncoder->getCategoryUrl( $this, $iLang );
510  }
511  return $oEncoder->getCategoryPageUrl( $this, $iPage, $iLang );
512  }
513 
521  public function getLink( $iLang = null )
522  {
523  if ( !oxRegistry::getUtils()->seoIsActive() ||
524  ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) ) {
525  return $this->getStdLink( $iLang );
526  }
527 
528  if ( $iLang === null ) {
529  $iLang = $this->getLanguage();
530  }
531 
532  if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
533  $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
534  }
535  return $this->_aSeoUrls[$iLang];
536  }
537 
545  public function setLink( $sLink )
546  {
547  $iLang = $this->getLanguage();
548  if ( oxRegistry::getUtils()->seoIsActive() ) {
549  $this->_aSeoUrls[$iLang] = $sLink;
550  } else {
551  $this->_aStdUrls[$iLang] = $sLink;
552  }
553  }
554 
562  public function getSqlActiveSnippet( $blForceCoreTable = null )
563  {
564  $sQ = parent::getSqlActiveSnippet( $blForceCoreTable );
565 
566  $sTable = $this->getViewName($blForceCoreTable);
567  $sQ .= ( strlen( $sQ )? ' and ' : '' ) . " $sTable.oxhidden = '0' ";
568 
569 
570  return "( $sQ ) ";
571  }
572 
582  public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
583  {
584  if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
585  return $this->oxcategories__oxextlink->value;
586  }
587 
588  $sUrl = '';
589  if ( $blFull ) {
590  //always returns shop url, not admin
591  $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
592  }
593 
594  //always returns shop url, not admin
595  return $sUrl . "index.php?cl=alist" . ( $blAddId ? "&amp;cnid=".$this->getId() : "" );
596  }
597 
606  public function getStdLink( $iLang = null, $aParams = array() )
607  {
608  if ( isset( $this->oxcategories__oxextlink ) && $this->oxcategories__oxextlink->value ) {
609  return oxRegistry::get("oxUtilsUrl")->processUrl( $this->oxcategories__oxextlink->value, false );
610  }
611 
612  if ( $iLang === null ) {
613  $iLang = $this->getLanguage();
614  }
615 
616  if ( !isset( $this->_aStdUrls[$iLang] ) ) {
617  $this->_aStdUrls[$iLang] = $this->getBaseStdLink( $iLang );
618  }
619 
620  return oxRegistry::get("oxUtilsUrl")->processUrl( $this->_aStdUrls[$iLang], true, $aParams, $iLang );
621  }
622 
628  public function getExpanded()
629  {
630  return $this->_blExpanded;
631  }
632 
640  public function setExpanded( $blExpanded )
641  {
642  $this->_blExpanded = $blExpanded;
643  }
644 
650  public function getHasSubCats()
651  {
652  if ( !isset( $this->_blHasSubCats ) ) {
653  $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1 ;
654  }
655 
656  return $this->_blHasSubCats;
657  }
658 
664  public function getHasVisibleSubCats()
665  {
666  if ( !isset( $this->_blHasVisibleSubCats ) ) {
667  $this->_blHasVisibleSubCats = false;
668  }
669 
671  }
672 
680  public function setHasVisibleSubCats( $blHasVisibleSubcats )
681  {
682  if ( $blHasVisibleSubcats && !$this->_blHasVisibleSubCats ) {
683  unset( $this->_blIsVisible );
684  if ($this->_oParent instanceof oxCategory) {
685  $this->_oParent->setHasVisibleSubCats( true );
686  }
687  }
688  $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
689  }
690 
696  public function getAttributes()
697  {
698  $sActCat = $this->getId();
699 
700  $sKey = md5( $sActCat . serialize( oxSession::getVar( 'session_attrfilter' ) ) );
701  if ( !isset( self::$_aCatAttributes[$sKey] ) ) {
702  $oAttrList = oxNew( "oxAttributeList" );
703  $oAttrList->getCategoryAttributes( $sActCat, $this->getLanguage() );
704  self::$_aCatAttributes[$sKey] = $oAttrList;
705  }
706 
707  return self::$_aCatAttributes[$sKey];
708  }
709 
717  public function getCatInLang( $oActCategory = null )
718  {
719  $oCategoryInDefaultLanguage= oxNew( "oxCategory" );
720  if ( $this->isPriceCategory() ) {
721  // get it in base language
722  $oCategoryInDefaultLanguage= oxNew( "oxCategory" );
723  $oCategoryInDefaultLanguage->loadInLang( 0, $this->getId());
724  } else {
725  $oCategoryInDefaultLanguage= oxNew( "oxCategory" );
726  $oCategoryInDefaultLanguage->loadInLang( 0, $oActCategory->getId());
727  }
728  return $oCategoryInDefaultLanguage;
729  }
730 
738  public function setParentCategory( $oCategory )
739  {
740  $this->_oParent = $oCategory;
741  }
742 
748  public function getParentCategory()
749  {
750  $oCat = null;
751 
752  // loading only if parent id is not rootid
753  if ( $this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid' ) {
754 
755  // checking if object itself has ref to parent
756  if ( $this->_oParent ) {
757  $oCat = $this->_oParent;
758  } else {
759  $oCat = oxNew( 'oxCategory' );
760  if ( !$oCat->load( $this->oxcategories__oxparentid->value ) ) {
761  $oCat = null;
762  } else {
763  $this->_oParent = $oCat;
764  }
765  }
766  }
767  return $oCat;
768  }
769 
777  public static function getRootId($sCategoryId)
778  {
779  if ( !isset( $sCategoryId ) ) {
780  return;
781  }
782  $oDb = oxDb::getDb();
783 
784  return $oDb->getOne( 'select oxrootid from '.getViewName('oxcategories').' where oxid = ' . $oDb->quote( $sCategoryId ) );
785  }
786 
787 
795  public function assignViewableRecord($sSelect)
796  {
797  if ( $this->assignRecord( $sSelect ) ) {
798  return true;
799  }
800 
801 
802  return false;
803  }
804 
810  protected function _insert()
811  {
812 
813 
814 
815  if ( $this->oxcategories__oxparentid->value != "oxrootid") {
816  // load parent
817  $oParent = oxNew( "oxCategory" );
818  //#M317 check if parent is loaded
819  if ( !$oParent->load( $this->oxcategories__oxparentid->value) ) {
820  return false;
821  }
822 
823  $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";
824 
825  // update existing nodes
826  $oDb = oxDb::getDb();
827  $oDb->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT + 2
828  WHERE OXROOTID = ".$oDb->quote($oParent->oxcategories__oxrootid->value)."
829  AND OXLEFT > ".((int) $oParent->oxcategories__oxright->value)."
830  AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd);
831 
832 
833  $oDb->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT + 2
834  WHERE OXROOTID = ".$oDb->quote($oParent->oxcategories__oxrootid->value)."
835  AND OXRIGHT >= ".((int) $oParent->oxcategories__oxright->value).$sAdd );
836 
837  if ( !$this->getId() ) {
838  $this->setId();
839  }
840 
841  $this->oxcategories__oxrootid = new oxField($oParent->oxcategories__oxrootid->value, oxField::T_RAW);
842  $this->oxcategories__oxleft = new oxField($oParent->oxcategories__oxright->value, oxField::T_RAW);
843  $this->oxcategories__oxright = new oxField($oParent->oxcategories__oxright->value + 1, oxField::T_RAW);
844  return parent::_insert();
845  } else {
846  // root entry
847  if ( !$this->getId() ) {
848  $this->setId();
849  }
850 
851  $this->oxcategories__oxrootid = new oxField($this->getId(), oxField::T_RAW);
852  $this->oxcategories__oxleft = new oxField(1, oxField::T_RAW);
853  $this->oxcategories__oxright = new oxField(2, oxField::T_RAW);
854  return parent::_insert();
855  }
856  }
857 
863  protected function _update()
864  {
865 
866  $this->setUpdateSeo(true);
867  $this->_setUpdateSeoOnFieldChange('oxtitle');
868 
869  $oDb = oxDb::getDb();
870  $sOldParentID = $oDb->getOne( "select oxparentid from oxcategories where oxid = ".$oDb->quote( $this->getId() ), false, false );
871 
872  if ( $this->_blIsSeoObject && $this->isAdmin() ) {
873  oxRegistry::get("oxSeoEncoderCategory")->markRelatedAsExpired($this);
874  }
875 
876  $blRes = parent::_update();
877 
878  // #872C - need to update category tree oxleft and oxright values (nested sets),
879  // then sub trees are moved inside one root, or to another root.
880  // this is done in 3 basic steps
881  // 1. increase oxleft and oxright values of target root tree by $iTreeSize, where oxleft>=$iMoveAfter , oxright>=$iMoveAfter
882  // 2. modify current subtree, we want to move by adding $iDelta to it's oxleft and oxright, where oxleft>=$sOldParentLeft and oxright<=$sOldParentRight values,
883  // in this step we also modify rootid's if they were changed
884  // 3. decreasing oxleft and oxright values of current root tree, where oxleft >= $sOldParentRight+1 , oxright >= $sOldParentRight+1
885 
886  // did we change position in tree ?
887  if ( $this->oxcategories__oxparentid->value != $sOldParentID) {
888  $sOldParentLeft = $this->oxcategories__oxleft->value;
889  $sOldParentRight = $this->oxcategories__oxright->value;
890 
891  $iTreeSize = $sOldParentRight-$sOldParentLeft+1;
892 
893  $sNewRootID = $oDb->getOne( "select oxrootid from oxcategories where oxid = ".$oDb->quote($this->oxcategories__oxparentid->value), false, false);
894 
895  //If empty rootID, we set it to categorys oxid
896  if ( $sNewRootID == "") {
897  //echo "<br>* ) Creating new root tree ( {$this->_sOXID} )";
898  $sNewRootID = $this->getId();
899  }
900 
901  $sNewParentLeft = $oDb->getOne( "select oxleft from oxcategories where oxid = ".$oDb->quote($this->oxcategories__oxparentid->value), false, false);
902 
903  //if(!$sNewParentLeft){
904  //the current node has become root node, (oxrootid == "oxrootid")
905  // $sNewParentLeft = 0;
906  //}
907 
908  $iMoveAfter = $sNewParentLeft+1;
909 
910  //New parentid can not be set to it's child
911  if ($sNewParentLeft > $sOldParentLeft && $sNewParentLeft < $sOldParentRight && $this->oxcategories__oxrootid->value == $sNewRootID) {
912  //echo "<br>* ) Can't asign category to it's child";
913 
914  //Restoring old parentid, stoping further actions
915  $sRestoreOld = "UPDATE oxcategories SET OXPARENTID = ".$oDb->quote($sOldParentID)." WHERE oxid = ".$oDb->quote($this->getId());
916  $oDb->execute( $sRestoreOld );
917  return false;
918  }
919 
920  //Old parent will be shifted too, if it is in the same tree
921  if ($sOldParentLeft > $iMoveAfter && $this->oxcategories__oxrootid->value == $sNewRootID) {
922  $sOldParentLeft += $iTreeSize;
923  $sOldParentRight += $iTreeSize;
924  }
925 
926  $iDelta = $iMoveAfter-$sOldParentLeft;
927 
928  //echo "Size=$iTreeSize, NewStart=$iMoveAfter, delta=$iDelta";
929 
930  $sAddOld = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDb->quote($this->oxcategories__oxrootid->value).";";
931  $sAddNew = " and oxshopid = '" . $this->getShopId() . "' and OXROOTID = ".$oDb->quote($sNewRootID).";";
932 
933  //Updating everything after new position
934  $oDb->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iTreeSize.") WHERE OXLEFT >= ".$iMoveAfter.$sAddNew );
935  $oDb->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT + ".$iTreeSize.") WHERE OXRIGHT >= ".$iMoveAfter.$sAddNew );
936  //echo "<br>1.) + $iTreeSize, >= $iMoveAfter";
937 
938  $sChangeRootID = "";
939  if ($this->oxcategories__oxrootid->value != $sNewRootID) {
940  //echo "<br>* ) changing root IDs ( {$this->oxcategories__oxrootid->value} -> {$sNewRootID} )";
941  $sChangeRootID = ", OXROOTID=".$oDb->quote($sNewRootID);
942  }
943 
944  //Updating subtree
945  $oDb->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT + ".$iDelta."), OXRIGHT = (OXRIGHT + ".$iDelta.") ".$sChangeRootID." WHERE OXLEFT >= ".$sOldParentLeft." AND OXRIGHT <= ".$sOldParentRight.$sAddOld );
946  //echo "<br>2.) + $iDelta, >= $sOldParentLeft and <= $sOldParentRight";
947 
948  //Updating everything after old position
949  $oDb->execute( "UPDATE oxcategories SET OXLEFT = (OXLEFT - ".$iTreeSize.") WHERE OXLEFT >= ".($sOldParentRight+1).$sAddOld );
950  $oDb->execute( "UPDATE oxcategories SET OXRIGHT = (OXRIGHT - ".$iTreeSize.") WHERE OXRIGHT >= ".($sOldParentRight+1).$sAddOld );
951  //echo "<br>3.) - $iTreeSize, >= ".($sOldParentRight+1);
952  }
953 
954  if ( $blRes && $this->_blIsSeoObject && $this->isAdmin() ) {
955  oxRegistry::get("oxSeoEncoderCategory")->markRelatedAsExpired($this);
956  }
957 
958  return $blRes;
959  }
960 
970  protected function _setFieldData( $sFieldName, $sValue, $iDataType = oxField::T_TEXT)
971  {
972  //preliminary quick check saves 3% of execution time in category lists by avoiding redundant strtolower() call
973  if ($sFieldName[2] == 'l' || $sFieldName[2] == 'L' || (isset($sFieldName[16]) && ($sFieldName[16] == 'l' || $sFieldName[16] == 'L') ) ) {
974  if ('oxlongdesc' === strtolower($sFieldName) || 'oxcategories__oxlongdesc' === strtolower($sFieldName)) {
975  $iDataType = oxField::T_RAW;
976  }
977  }
978  return parent::_setFieldData($sFieldName, $sValue, $iDataType);
979  }
980 
981 
987  public function getIconUrl()
988  {
989  if ( ( $sIcon = $this->oxcategories__oxicon->value ) ) {
990  $oConfig = $this->getConfig();
991  $sSize = $oConfig->getConfigParam( 'sCatIconsize' );
992  if ( !isset( $sSize ) ) {
993  $sSize = $oConfig->getConfigParam( 'sIconsize' );
994  }
995 
996  return oxRegistry::get("oxPictureHandler")->getPicUrl( "category/icon/", $sIcon, $sSize );
997  }
998  }
999 
1005  public function getThumbUrl()
1006  {
1007  if ( ( $sIcon = $this->oxcategories__oxthumb->value ) ) {
1008  $sSize = $this->getConfig()->getConfigParam( 'sCatThumbnailsize' );
1009  return oxRegistry::get("oxPictureHandler")->getPicUrl( "category/thumb/", $sIcon, $sSize );
1010  }
1011  }
1012 
1018  public function getPromotionIconUrl()
1019  {
1020  if ( ( $sIcon = $this->oxcategories__oxpromoicon->value ) ) {
1021  $sSize = $this->getConfig()->getConfigParam( 'sCatPromotionsize' );
1022  return oxRegistry::get("oxPictureHandler")->getPicUrl( "category/promo_icon/", $sIcon, $sSize );
1023  }
1024  }
1025 
1034  public function getPictureUrlForType( $sPicName, $sPicType )
1035  {
1036  if ( $sPicName ) {
1037  return $this->getPictureUrl() . $sPicType . '/' . $sPicName;
1038  } else {
1039  return false;
1040  }
1041  }
1042 
1048  public function isTopCategory()
1049  {
1050  if ( $this->_blTopCategory == null ) {
1051  $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid';
1052  }
1053  return $this->_blTopCategory;
1054  }
1055 
1061  public function isPriceCategory()
1062  {
1063  return (bool) ( $this->oxcategories__oxpricefrom->value || $this->oxcategories__oxpriceto->value );
1064  }
1065 
1072  public function getLongDesc()
1073  {
1074  if ( isset( $this->oxcategories__oxlongdesc ) && $this->oxcategories__oxlongdesc instanceof oxField ) {
1075  return oxRegistry::get("oxUtilsView")->parseThroughSmarty( $this->oxcategories__oxlongdesc->getRawValue(), $this->getId().$this->getLanguage(), null, true );
1076  }
1077  }
1078 
1084  public function getShortDescription()
1085  {
1086  return $this->oxcategories__oxdesc->value;
1087  }
1088 
1094  public function getTitle()
1095  {
1096  return $this->oxcategories__oxtitle->value;
1097  }
1098 }