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 
00206     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00207     {
00208         if ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) {
00209             if ( $iPage ) { // only if page number > 0
00210                 $sUrl = oxSeoEncoderManufacturer::getInstance()->getManufacturerPageUrl( $oManufacturer, $iPage, $iLang, $this->_isFixedUrl( $oManufacturer ) );
00211             }
00212         } else {
00213             $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00214         }
00215 
00216         return $sUrl;
00217     }
00218 
00224     public function generatePageNavigationUrl( )
00225     {
00226         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00227             return $oManufacturer->getLink();
00228         } else {
00229             return parent::generatePageNavigationUrl( );
00230         }
00231     }
00232 
00238     public function hasVisibleSubCats()
00239     {
00240         if ( $this->_blVisibleSubCats === null ) {
00241             $this->_blVisibleSubCats = false;
00242             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00243                 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00244                     if ( $oManufacturer->getId() == 'root' ) {
00245                         $this->_blVisibleSubCats = $oManufacturerTree->count();
00246                         $this->_oSubCatList = $oManufacturerTree;
00247                     }
00248                 }
00249             }
00250         }
00251         return $this->_blVisibleSubCats;
00252     }
00253 
00259     public function getSubCatList()
00260     {
00261         if ( $this->_oSubCatList === null ) {
00262             $this->_oSubCatList = array();
00263             if ( $this->hasVisibleSubCats() ) {
00264                 return $this->_oSubCatList;
00265             }
00266         }
00267         return $this->_oSubCatList;
00268     }
00269 
00275     public function getArticleList()
00276     {
00277         if ( $this->_aArticleList === null ) {
00278             $this->_aArticleList = array();
00279             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00280                 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) ) {
00281                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00282                     if ( $this->_iAllArtCnt ) {
00283                         $this->_aArticleList = $aArticleList;
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 Wed May 13 13:25:55 2009 for OXID eShop CE by  doxygen 1.5.5