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_INDEX;
00067
00082 public function render()
00083 {
00084 oxUBase::render();
00085
00086 $myConfig = $this->getConfig();
00087
00088
00089 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00090 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00091 if ( $oManufacturer->getId() != 'root' ) {
00092
00093 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00094 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
00095
00096
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
00107 $this->_processListArticles();
00108
00109
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
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
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 ) {
00203 $sUrl = oxSeoEncoderManufacturer::getInstance()->getManufacturerPageUrl( $oManufacturer, $iPage, $iLang, $this->_isFixedUrl( $oManufacturer ) );
00204 }
00205 } else {
00206 $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00207 }
00208 return $sUrl;
00209 }
00210
00216 public function generatePageNavigationUrl( )
00217 {
00218 if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00219 return $oManufacturer->getLink();
00220 } else {
00221 return parent::generatePageNavigationUrl( );
00222 }
00223 }
00224
00230 public function hasVisibleSubCats()
00231 {
00232 if ( $this->_blVisibleSubCats === null ) {
00233 $this->_blVisibleSubCats = false;
00234 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00235 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00236 if ( $oManufacturer->getId() == 'root' ) {
00237 $this->_blVisibleSubCats = $oManufacturerTree->count();
00238 $this->_oSubCatList = $oManufacturerTree;
00239 }
00240 }
00241 }
00242 }
00243 return $this->_blVisibleSubCats;
00244 }
00245
00251 public function getSubCatList()
00252 {
00253 if ( $this->_oSubCatList === null ) {
00254 $this->_oSubCatList = array();
00255 if ( $this->hasVisibleSubCats() ) {
00256 return $this->_oSubCatList;
00257 }
00258 }
00259 return $this->_oSubCatList;
00260 }
00261
00267 public function getArticleList()
00268 {
00269 if ( $this->_aArticleList === null ) {
00270 $this->_aArticleList = array();
00271 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00272 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) ) {
00273 list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00274 if ( $this->_iAllArtCnt ) {
00275 $this->_aArticleList = $aArticleList;
00276 }
00277 }
00278 }
00279 }
00280 return $this->_aArticleList;
00281 }
00282
00288 public function getTitle()
00289 {
00290 if ( $this->_sCatTitle === null ) {
00291 $this->_sCatTitle = '';
00292 if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00293 if ( $oManufacturer = $this->getActManufacturer() ) {
00294 $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00295 }
00296 }
00297 }
00298 return $this->_sCatTitle;
00299 }
00300
00308 public function getTemplateLocation()
00309 {
00310 if ( $this->_sTplLocation === null ) {
00311 $this->_sTplLocation = false;
00312 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00313 $this->_sTplLocation = $oManufacturerTree->getHtmlPath();
00314 }
00315 }
00316 return $this->_sTplLocation;
00317 }
00318
00324 public function getTreePath()
00325 {
00326 if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00327 return $oManufacturerTree->getPath();
00328 }
00329 }
00330
00336 public function getActiveCategory()
00337 {
00338 if ( $this->_oActCategory === null ) {
00339 $this->_oActCategory = false;
00340 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00341 if ( $oManufacturer = $this->getActManufacturer() ) {
00342 $this->_oActCategory = $oManufacturer;
00343 }
00344 }
00345 }
00346 return $this->_oActCategory;
00347 }
00348
00354 public function getCatTreePath()
00355 {
00356 if ( $this->_sCatTreePath === null ) {
00357 $this->_sCatTreePath = false;
00358 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00359 $this->_sCatTreePath = $oManufacturerTree->getPath();
00360 }
00361 }
00362 return $this->_sCatTreePath;
00363 }
00364
00370 public function getTitleSuffix()
00371 {
00372 if ( $this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value ) {
00373 return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00374 }
00375 }
00376
00385 protected function _prepareMetaKeyword( $aCatPath, $blRemoveDuplicatedWords = true )
00386 {
00387 return parent::_collectMetaKeyword( $aCatPath );
00388 }
00389
00402 protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00403 {
00404 return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00405 }
00406
00415 protected function _getSubject( $iLang )
00416 {
00417 return $this->getActManufacturer();
00418 }
00419 }