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_INDEX;
00067
00078 public function render()
00079 {
00080 oxUBase::render();
00081
00082
00083 if ( $this->getManufacturerTree() ) {
00084 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00085 if ( $oManufacturer->getId() != 'root' ) {
00086
00087 $this->getArticleList();
00088
00089
00090 $this->_checkRequestedPage();
00091
00092
00093 $this->_processListArticles();
00094 }
00095 }
00096 }
00097
00098 return $this->_sThisTemplate;
00099 }
00100
00106 protected function _getProductLinkType()
00107 {
00108 return OXARTICLE_LINKTYPE_MANUFACTURER;
00109 }
00110
00120 public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
00121 {
00122 parent::setItemSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer', $sSortBy, $sSortDir );
00123 }
00124
00132 public function getSorting( $sCnid )
00133 {
00134 return parent::getSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer' );
00135 }
00136
00144 protected function _loadArticles( $oManufacturer )
00145 {
00146 $sManufacturerId = $oManufacturer->getId();
00147
00148
00149 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00150 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
00151
00152 $oArtList = oxNew( 'oxarticlelist' );
00153 $oArtList->setSqlLimit( $iNrofCatArticles * $this->_getRequestPageNr(), $iNrofCatArticles );
00154 $oArtList->setCustomSorting( $this->getSortingSql( $sManufacturerId ) );
00155
00156
00157 $this->_iAllArtCnt = $oArtList->loadManufacturerArticles( $sManufacturerId, $oManufacturer );
00158
00159
00160 $this->_iCntPages = round( $this->_iAllArtCnt / $iNrofCatArticles + 0.49 );
00161
00162 return array( $oArtList, $this->_iAllArtCnt );
00163 }
00164
00170 protected function _getSeoObjectId()
00171 {
00172 $sId = null;
00173 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00174 $sId = $oManufacturer->getId();
00175 }
00176 return $sId;
00177 }
00178
00189 protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00190 {
00191 if ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) {
00192 if ( $iPage ) {
00193
00194 $sUrl = $oManufacturer->getBaseSeoLink( $iLang, $iPage );
00195 }
00196 } else {
00197 $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00198 }
00199 return $sUrl;
00200 }
00201
00207 public function generatePageNavigationUrl()
00208 {
00209 if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00210 return $oManufacturer->getLink();
00211 } else {
00212 return parent::generatePageNavigationUrl( );
00213 }
00214 }
00215
00221 public function hasVisibleSubCats()
00222 {
00223 if ( $this->_blVisibleSubCats === null ) {
00224 $this->_blVisibleSubCats = false;
00225 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00226 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00227 if ( $oManufacturer->getId() == 'root' ) {
00228 $this->_blVisibleSubCats = $oManufacturerTree->count();
00229 $this->_oSubCatList = $oManufacturerTree;
00230 }
00231 }
00232 }
00233 }
00234 return $this->_blVisibleSubCats;
00235 }
00236
00242 public function getSubCatList()
00243 {
00244 if ( $this->_oSubCatList === null ) {
00245 $this->_oSubCatList = $this->hasVisibleSubCats() ? $this->_oSubCatList : array();
00246 }
00247 return $this->_oSubCatList;
00248 }
00249
00255 public function getArticleList()
00256 {
00257 if ( $this->_aArticleList === null ) {
00258 $this->_aArticleList = array();
00259 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00260 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) && $oManufacturer->getIsVisible() ) {
00261 list( $aArticleList, $iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00262 if ( $iAllArtCnt ) {
00263 $this->_aArticleList = $aArticleList;
00264 }
00265 }
00266 }
00267 }
00268 return $this->_aArticleList;
00269 }
00270
00276 public function getTitle()
00277 {
00278 if ( $this->_sCatTitle === null ) {
00279 $this->_sCatTitle = '';
00280 if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00281 if ( $oManufacturer = $this->getActManufacturer() ) {
00282 $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00283 }
00284 }
00285 }
00286 return $this->_sCatTitle;
00287 }
00288
00294 public function getTreePath()
00295 {
00296 $aPath = null;
00297 if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00298 $aPath = $oManufacturerTree->getPath();
00299 }
00300 return $aPath;
00301 }
00302
00308 public function getActiveCategory()
00309 {
00310 if ( $this->_oActCategory === null ) {
00311 $this->_oActCategory = false;
00312 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00313 if ( $oManufacturer = $this->getActManufacturer() ) {
00314 $this->_oActCategory = $oManufacturer;
00315 }
00316 }
00317 }
00318 return $this->_oActCategory;
00319 }
00320
00326 public function getCatTreePath()
00327 {
00328 if ( $this->_sCatTreePath === null ) {
00329 $this->_sCatTreePath = false;
00330 if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00331 $this->_sCatTreePath = $oManufacturerTree->getPath();
00332 }
00333 }
00334 return $this->_sCatTreePath;
00335 }
00336
00342 public function getTitleSuffix()
00343 {
00344 $sSuffix = null;
00345 if ( $this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value ) {
00346 $sSuffix = $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00347 }
00348 return $sSuffix;
00349 }
00350
00359 protected function _prepareMetaKeyword( $aCatPath, $blRemoveDuplicatedWords = true )
00360 {
00361 return parent::_collectMetaKeyword( $aCatPath );
00362 }
00363
00376 protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00377 {
00378 return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00379 }
00380
00389 protected function _getSubject( $iLang )
00390 {
00391 return $this->getActManufacturer();
00392 }
00393
00399 public function getAddUrlParams()
00400 {
00401 $sAddParams = parent::getAddUrlParams();
00402 $sAddParams .= ($sAddParams?'&':'') . "listtype={$this->_sListType}";
00403 if ( $oManufacturer = $this->getActManufacturer() ) {
00404 $sAddParams .= "&mnid=" . $oManufacturer->getId();
00405 }
00406 return $sAddParams;
00407 }
00408
00414 public function getBreadCrumb()
00415 {
00416 $aPaths = array();
00417
00418 $oCatTree = $this->getManufacturerTree()->getPath();
00419
00420 if ( $oCatTree ) {
00421 foreach ( $oCatTree as $oCat ) {
00422 $aCatPath = array();
00423 $aCatPath['link'] = $oCat->getLink();
00424 $aCatPath['title'] = $oCat->oxmanufacturers__oxtitle->value;
00425
00426 $aPaths[] = $aCatPath;
00427 }
00428 }
00429
00430 return $aPaths;
00431 }
00432 }