manufacturerlist.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class ManufacturerList extends aList
00010 {
00015     protected $_sListType = 'manufacturer';
00016 
00021     protected $_blVisibleSubCats = null;
00022 
00027     protected $_oSubCatList = null;
00028 
00033     protected $_oRecommList = null;
00034 
00040     protected $_sTplLocation = null;
00041 
00047     protected $_sCatTitle = null;
00048 
00053     protected $_oPageNavigation = null;
00054 
00059     protected $_blShowSorting = true;
00060 
00066     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
00067 
00082     public function render()
00083     {
00084         oxUBase::render();
00085 
00086         $myConfig = $this->getConfig();
00087 
00088         // load Manufacturer
00089         if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00090             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00091                 if ( $oManufacturer->getId() != 'root' ) {
00092                     // load only articles which we show on screen
00093                     $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00094                     $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
00095 
00096                     // load the articles
00097                     $this->getArticleList();
00098                     $this->_iCntPages  = round( $this->_iAllArtCnt / $iNrofCatArticles + 0.49 );
00099 
00100                 }
00101             }
00102         }
00103 
00104         $this->_aViewData['pageNavigation'] = $this->getPageNavigation();
00105 
00106         // processing list articles
00107         $this->_processListArticles();
00108 
00109         // generating meta info
00110         $this->setMetaDescription( null );
00111         $this->setMetaKeywords( null );
00112 
00113         return $this->_sThisTemplate;
00114     }
00115 
00123     protected function _processListArticles()
00124     {
00125         if ( $aArtList = $this->getArticleList() ) {
00126             foreach ( $aArtList as $oArticle ) {
00127                 // forcing to generate Manufacturer URLs by getLink
00128                 $oArticle->setLinkType( OXARTICLE_LINKTYPE_MANUFACTURER );
00129             }
00130         }
00131     }
00132 
00142     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
00143     {
00144         parent::setItemSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer', $sSortBy, $sSortDir );
00145     }
00146 
00154     public function getSorting( $sCnid )
00155     {
00156         return parent::getSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer' );
00157     }
00158 
00166     protected function _loadArticles( $oManufacturer )
00167     {
00168         $sManufacturerId = $oManufacturer->getId();
00169 
00170         // load only articles which we show on screen
00171         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00172         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00173 
00174         $oArtList = oxNew( 'oxarticlelist' );
00175         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00176         $oArtList->setCustomSorting( $this->getSortingSql( $sManufacturerId ) );
00177 
00178         // load the articles
00179         $iArtCnt = $oArtList->loadManufacturerArticles( $sManufacturerId, $oManufacturer );
00180 
00181         return array( $oArtList, $iArtCnt );
00182     }
00183 
00189     protected function _getSeoObjectId()
00190     {
00191         if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00192             return $oManufacturer->getId();
00193         }
00194     }
00195 
00205     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00206     {
00207         if ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) {
00208             if ( $iPage ) { // only if page number > 0
00209                 $sUrl = oxSeoEncoderManufacturer::getInstance()->getManufacturerPageUrl( $oManufacturer, $iPage, $iLang, $this->_isFixedUrl( $oManufacturer ) );
00210             }
00211         } else {
00212             $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00213         }
00214 
00215         return $sUrl;
00216     }
00217 
00223     public function generatePageNavigationUrl( )
00224     {
00225         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00226             return $oManufacturer->getLink();
00227         } else {
00228             return parent::generatePageNavigationUrl( );
00229         }
00230     }
00231 
00237     public function hasVisibleSubCats()
00238     {
00239          if ( $this->_blVisibleSubCats === null ) {
00240              $this->_blVisibleSubCats = false;
00241              if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00242                 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00243                     if ( $oManufacturer->getId() == 'root' ) {
00244                         $this->_blVisibleSubCats = $oManufacturerTree->count();
00245                         $this->_oSubCatList = $oManufacturerTree;
00246                     }
00247                 }
00248             }
00249         }
00250         return $this->_blVisibleSubCats;
00251     }
00252 
00258     public function getSubCatList()
00259     {
00260         if ( $this->_oSubCatList === null ) {
00261             $this->_oSubCatList = array();
00262             if ( $this->hasVisibleSubCats() ) {
00263                 return $this->_oSubCatList;
00264             }
00265         }
00266         return $this->_oSubCatList;
00267     }
00268 
00274     public function getArticleList()
00275     {
00276          if ( $this->_aArticleList === null ) {
00277              $this->_aArticleList = array();
00278              if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00279                 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) ) {
00280                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00281                     if ( $this->_iAllArtCnt ) {
00282                         $this->_aArticleList = $aArticleList;
00283                     }
00284                 }
00285 
00286             }
00287         }
00288         return $this->_aArticleList;
00289     }
00290 
00296     public function getTitle()
00297     {
00298         if ( $this->_sCatTitle === null ) {
00299             $this->_sCatTitle = '';
00300             if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00301                 if ( $oManufacturer = $this->getActManufacturer() ) {
00302                     $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00303                 }
00304             }
00305         }
00306         return $this->_sCatTitle;
00307     }
00308 
00314     public function getTemplateLocation()
00315     {
00316         if ( $this->_sTplLocation === null ) {
00317             $this->_sTplLocation = false;
00318             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00319                 $this->_sTplLocation = $oManufacturerTree->getHtmlPath();
00320             }
00321         }
00322         return $this->_sTplLocation;
00323     }
00324 
00330     public function getActiveCategory()
00331     {
00332         if ( $this->_oActCategory === null ) {
00333             $this->_oActCategory = false;
00334             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00335                 if ( $oManufacturer = $this->getActManufacturer() ) {
00336                     $this->_oActCategory = $oManufacturer;
00337                 }
00338             }
00339         }
00340         return $this->_oActCategory;
00341     }
00342 
00348     public function getCatTreePath()
00349     {
00350         if ( $this->_sCatTreePath === null ) {
00351             $this->_sCatTreePath = false;
00352             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00353                 $this->_sCatTreePath  = $oManufacturerTree->getPath();
00354             }
00355         }
00356         return $this->_sCatTreePath;
00357     }
00358 
00364     public function getTitleSuffix()
00365     {
00366         if ( $this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value ) {
00367            return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00368         }
00369     }
00370 
00378     protected function _prepareMetaKeyword( $aCatPath )
00379     {
00380         return parent::_collectMetaKeyword( $aCatPath );
00381     }
00382 
00395     protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00396     {
00397         return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00398     }
00399 }

Generated on Tue Apr 21 15:45:45 2009 for OXID eShop CE by  doxygen 1.5.5