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 
00121     protected function _getProductLinkType()
00122     {
00123         return OXARTICLE_LINKTYPE_MANUFACTURER;
00124     }
00125 
00135     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
00136     {
00137         parent::setItemSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer', $sSortBy, $sSortDir );
00138     }
00139 
00147     public function getSorting( $sCnid )
00148     {
00149         return parent::getSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer' );
00150     }
00151 
00159     protected function _loadArticles( $oManufacturer )
00160     {
00161         $sManufacturerId = $oManufacturer->getId();
00162 
00163         // load only articles which we show on screen
00164         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00165         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00166 
00167         $oArtList = oxNew( 'oxarticlelist' );
00168         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00169         $oArtList->setCustomSorting( $this->getSortingSql( $sManufacturerId ) );
00170 
00171         // load the articles
00172         $iArtCnt = $oArtList->loadManufacturerArticles( $sManufacturerId, $oManufacturer );
00173 
00174         return array( $oArtList, $iArtCnt );
00175     }
00176 
00182     protected function _getSeoObjectId()
00183     {
00184         if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00185             return $oManufacturer->getId();
00186         }
00187     }
00188 
00199     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00200     {
00201         if ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) {
00202             if ( $iPage ) { // only if page number > 0
00203                 $sUrl = oxSeoEncoderManufacturer::getInstance()->getManufacturerPageUrl( $oManufacturer, $iPage, $iLang, $this->_isFixedUrl( $oManufacturer ) );
00204             }
00205         } else {
00206             $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00207         }
00208 
00209         return $sUrl;
00210     }
00211 
00217     public function generatePageNavigationUrl( )
00218     {
00219         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00220             return $oManufacturer->getLink();
00221         } else {
00222             return parent::generatePageNavigationUrl( );
00223         }
00224     }
00225 
00231     public function hasVisibleSubCats()
00232     {
00233         if ( $this->_blVisibleSubCats === null ) {
00234             $this->_blVisibleSubCats = false;
00235             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00236                 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00237                     if ( $oManufacturer->getId() == 'root' ) {
00238                         $this->_blVisibleSubCats = $oManufacturerTree->count();
00239                         $this->_oSubCatList = $oManufacturerTree;
00240                     }
00241                 }
00242             }
00243         }
00244         return $this->_blVisibleSubCats;
00245     }
00246 
00252     public function getSubCatList()
00253     {
00254         if ( $this->_oSubCatList === null ) {
00255             $this->_oSubCatList = array();
00256             if ( $this->hasVisibleSubCats() ) {
00257                 return $this->_oSubCatList;
00258             }
00259         }
00260         return $this->_oSubCatList;
00261     }
00262 
00268     public function getArticleList()
00269     {
00270         if ( $this->_aArticleList === null ) {
00271             $this->_aArticleList = array();
00272             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00273                 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) ) {
00274                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00275                     if ( $this->_iAllArtCnt ) {
00276                         $this->_aArticleList = $aArticleList;
00277                     }
00278                 }
00279             }
00280         }
00281         return $this->_aArticleList;
00282     }
00283 
00289     public function getTitle()
00290     {
00291         if ( $this->_sCatTitle === null ) {
00292             $this->_sCatTitle = '';
00293             if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00294                 if ( $oManufacturer = $this->getActManufacturer() ) {
00295                     $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00296                 }
00297             }
00298         }
00299         return $this->_sCatTitle;
00300     }
00301 
00307     public function getTemplateLocation()
00308     {
00309         if ( $this->_sTplLocation === null ) {
00310             $this->_sTplLocation = false;
00311             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00312                 $this->_sTplLocation = $oManufacturerTree->getHtmlPath();
00313             }
00314         }
00315         return $this->_sTplLocation;
00316     }
00317 
00323     public function getActiveCategory()
00324     {
00325         if ( $this->_oActCategory === null ) {
00326             $this->_oActCategory = false;
00327             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00328                 if ( $oManufacturer = $this->getActManufacturer() ) {
00329                     $this->_oActCategory = $oManufacturer;
00330                 }
00331             }
00332         }
00333         return $this->_oActCategory;
00334     }
00335 
00341     public function getCatTreePath()
00342     {
00343         if ( $this->_sCatTreePath === null ) {
00344             $this->_sCatTreePath = false;
00345             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00346                 $this->_sCatTreePath  = $oManufacturerTree->getPath();
00347             }
00348         }
00349         return $this->_sCatTreePath;
00350     }
00351 
00357     public function getTitleSuffix()
00358     {
00359         if ( $this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value ) {
00360             return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00361         }
00362     }
00363 
00372     protected function _prepareMetaKeyword( $aCatPath, $blRemoveDuplicatedWords = true )
00373     {
00374         return parent::_collectMetaKeyword( $aCatPath );
00375     }
00376 
00389     protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00390     {
00391         return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00392     }
00393 }

Generated on Tue Aug 18 09:21:08 2009 for OXID eShop CE by  doxygen 1.5.5