Go to the documentation of this file.00001 <?php
00002
00009 class ManufacturerList extends aList
00010 {
00011
00017 protected $_sListType = 'manufacturer';
00018
00024 protected $_blVisibleSubCats = null;
00025
00031 protected $_oSubCatList = null;
00032
00038 protected $_oRecommList = null;
00039
00045 protected $_sTplLocation = null;
00046
00052 protected $_sCatTitle = null;
00053
00059 protected $_oPageNavigation = null;
00060
00066 protected $_blShowSorting = true;
00067
00073 protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00074
00085 public function render()
00086 {
00087 oxUBase::render();
00088
00089
00090 if ($this->getManufacturerTree()) {
00091 if (($oManufacturer = $this->getActManufacturer())) {
00092 if ($oManufacturer->getId() != 'root') {
00093
00094 $this->getArticleList();
00095
00096
00097 $this->_checkRequestedPage();
00098
00099
00100 $this->_processListArticles();
00101 }
00102 }
00103 }
00104
00105 return $this->_sThisTemplate;
00106 }
00107
00113 protected function _getProductLinkType()
00114 {
00115 return OXARTICLE_LINKTYPE_MANUFACTURER;
00116 }
00117
00125 protected function _loadArticles($oManufacturer)
00126 {
00127 $sManufacturerId = $oManufacturer->getId();
00128
00129
00130 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
00131 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
00132
00133 $oArtList = oxNew('oxarticlelist');
00134 $oArtList->setSqlLimit($iNrofCatArticles * $this->_getRequestPageNr(), $iNrofCatArticles);
00135 $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent()));
00136
00137
00138 $this->_iAllArtCnt = $oArtList->loadManufacturerArticles($sManufacturerId, $oManufacturer);
00139
00140
00141 $this->_iCntPages = round($this->_iAllArtCnt / $iNrofCatArticles + 0.49);
00142
00143 return array($oArtList, $this->_iAllArtCnt);
00144 }
00145
00151 protected function _getSeoObjectId()
00152 {
00153 $sId = null;
00154 if (($oManufacturer = $this->getActManufacturer())) {
00155 $sId = $oManufacturer->getId();
00156 }
00157
00158 return $sId;
00159 }
00160
00171 protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
00172 {
00173 if (oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer())) {
00174 if ($iPage) {
00175
00176 $sUrl = $oManufacturer->getBaseSeoLink($iLang, $iPage);
00177 }
00178 } else {
00179 $sUrl = parent::_addPageNrParam($sUrl, $iPage, $iLang);
00180 }
00181
00182 return $sUrl;
00183 }
00184
00190 public function generatePageNavigationUrl()
00191 {
00192 if ((oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer()))) {
00193 return $oManufacturer->getLink();
00194 } else {
00195 return parent::generatePageNavigationUrl();
00196 }
00197 }
00198
00204 public function hasVisibleSubCats()
00205 {
00206 if ($this->_blVisibleSubCats === null) {
00207 $this->_blVisibleSubCats = false;
00208 if (($oManufacturerTree = $this->getManufacturerTree())) {
00209 if (($oManufacturer = $this->getActManufacturer())) {
00210 if ($oManufacturer->getId() == 'root') {
00211 $this->_blVisibleSubCats = $oManufacturerTree->count();
00212 $this->_oSubCatList = $oManufacturerTree;
00213 }
00214 }
00215 }
00216 }
00217
00218 return $this->_blVisibleSubCats;
00219 }
00220
00226 public function getSubCatList()
00227 {
00228 if ($this->_oSubCatList === null) {
00229 $this->_oSubCatList = $this->hasVisibleSubCats() ? $this->_oSubCatList : array();
00230 }
00231
00232 return $this->_oSubCatList;
00233 }
00234
00240 public function getArticleList()
00241 {
00242 if ($this->_aArticleList === null) {
00243 $this->_aArticleList = array();
00244 if (($oManufacturerTree = $this->getManufacturerTree())) {
00245 $oManufacturer = $this->getActManufacturer();
00246 if ($oManufacturer && ($oManufacturer->getId() != 'root') && $oManufacturer->getIsVisible()) {
00247 list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oManufacturer);
00248 if ($iAllArtCnt) {
00249 $this->_aArticleList = $aArticleList;
00250 }
00251 }
00252 }
00253 }
00254
00255 return $this->_aArticleList;
00256 }
00257
00263 public function getTitle()
00264 {
00265 if ($this->_sCatTitle === null) {
00266 $this->_sCatTitle = '';
00267 if ($oManufacturerTree = $this->getManufacturerTree()) {
00268 if ($oManufacturer = $this->getActManufacturer()) {
00269 $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00270 }
00271 }
00272 }
00273
00274 return $this->_sCatTitle;
00275 }
00276
00282 public function getTreePath()
00283 {
00284 $aPath = null;
00285 if ($oManufacturerTree = $this->getManufacturerTree()) {
00286 $aPath = $oManufacturerTree->getPath();
00287 }
00288
00289 return $aPath;
00290 }
00291
00297 public function getActiveCategory()
00298 {
00299 if ($this->_oActCategory === null) {
00300 $this->_oActCategory = false;
00301 if (($oManufacturerTree = $this->getManufacturerTree())) {
00302 if ($oManufacturer = $this->getActManufacturer()) {
00303 $this->_oActCategory = $oManufacturer;
00304 }
00305 }
00306 }
00307
00308 return $this->_oActCategory;
00309 }
00310
00316 public function getCatTreePath()
00317 {
00318 if ($this->_sCatTreePath === null) {
00319 $this->_sCatTreePath = false;
00320 if (($oManufacturerTree = $this->getManufacturerTree())) {
00321 $this->_sCatTreePath = $oManufacturerTree->getPath();
00322 }
00323 }
00324
00325 return $this->_sCatTreePath;
00326 }
00327
00333 public function getTitleSuffix()
00334 {
00335 $sSuffix = null;
00336 if ($this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value) {
00337 $sSuffix = $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00338 }
00339
00340 return $sSuffix;
00341 }
00342
00351 protected function _prepareMetaKeyword($aCatPath, $blRemoveDuplicatedWords = true)
00352 {
00353 return parent::_collectMetaKeyword($aCatPath);
00354 }
00355
00368 protected function _prepareMetaDescription($aCatPath, $iLength = 1024, $blDescTag = false)
00369 {
00370 return parent::_collectMetaDescription($aCatPath, $iLength, $blDescTag);
00371 }
00372
00381 protected function _getSubject($iLang)
00382 {
00383 return $this->getActManufacturer();
00384 }
00385
00391 public function getAddUrlParams()
00392 {
00393 $sAddParams = parent::getAddUrlParams();
00394 $sAddParams .= ($sAddParams ? '&' : '') . "listtype={$this->_sListType}";
00395 if ($oManufacturer = $this->getActManufacturer()) {
00396 $sAddParams .= "&mnid=" . $oManufacturer->getId();
00397 }
00398
00399 return $sAddParams;
00400 }
00401
00407 public function getBreadCrumb()
00408 {
00409 $aPaths = array();
00410
00411 $oCatTree = $this->getManufacturerTree();
00412
00413 if ($oCatTree) {
00414 foreach ($oCatTree->getPath() as $oCat) {
00415 $aCatPath = array();
00416 $aCatPath['link'] = $oCat->getLink();
00417 $aCatPath['title'] = $oCat->oxmanufacturers__oxtitle->value;
00418
00419 $aPaths[] = $aCatPath;
00420 }
00421 }
00422
00423 return $aPaths;
00424 }
00425
00432 public function getAttributes()
00433 {
00434 return null;
00435 }
00436 }