Go to the documentation of this file.00001 <?php
00002
00009 class VendorList extends aList
00010 {
00011
00017 protected $_sListType = 'vendor';
00018
00024 protected $_blVisibleSubCats = null;
00025
00031 protected $_oSubCatList = null;
00032
00038 protected $_sTplLocation = null;
00039
00045 protected $_sCatTitle = null;
00046
00052 protected $_oPageNavigation = null;
00053
00059 protected $_blShowSorting = true;
00060
00066 protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00067
00073 protected $_oVendorTree = null;
00074
00085 public function render()
00086 {
00087 oxUBase::render();
00088
00089
00090 if (($this->_getVendorId() && $this->getVendorTree())) {
00091 if (($oVendor = $this->getActVendor())) {
00092 if ($oVendor->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_VENDOR;
00116 }
00117
00125 protected function _loadArticles($oVendor)
00126 {
00127 $sVendorId = $oVendor->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->loadVendorArticles($sVendorId, $oVendor);
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 if (($oVendor = $this->getActVendor())) {
00154 return $oVendor->getId();
00155 }
00156 }
00157
00168 protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
00169 {
00170 if (oxRegistry::getUtils()->seoIsActive() && ($oVendor = $this->getActVendor())) {
00171 if ($iPage) {
00172
00173 $sUrl = $oVendor->getBaseSeoLink($iLang, $iPage);
00174 }
00175 } else {
00176 $sUrl = oxUBase::_addPageNrParam($sUrl, $iPage, $iLang);
00177 }
00178
00179 return $sUrl;
00180 }
00181
00187 public function generatePageNavigationUrl()
00188 {
00189 if ((oxRegistry::getUtils()->seoIsActive() && ($oVendor = $this->getActVendor()))) {
00190 return $oVendor->getLink();
00191 } else {
00192 return parent::generatePageNavigationUrl();
00193 }
00194 }
00195
00201 public function hasVisibleSubCats()
00202 {
00203 if ($this->_blVisibleSubCats === null) {
00204 $this->_blVisibleSubCats = false;
00205 if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) {
00206 if (($oVendor = $this->getActVendor())) {
00207 if ($oVendor->getId() == 'root') {
00208 $this->_blVisibleSubCats = $oVendorTree->count();
00209 $this->_oSubCatList = $oVendorTree;
00210 }
00211 }
00212 }
00213 }
00214
00215 return $this->_blVisibleSubCats;
00216 }
00217
00223 public function getSubCatList()
00224 {
00225 if ($this->_oSubCatList === null) {
00226 $this->_oSubCatList = array();
00227 if ($this->hasVisibleSubCats()) {
00228 return $this->_oSubCatList;
00229 }
00230 }
00231
00232 return $this->_oSubCatList;
00233 }
00234
00240 public function getArticleList()
00241 {
00242 if ($this->_aArticleList === null) {
00243 $this->_aArticleList = array();
00244 if (($oVendor = $this->getActVendor()) && ($oVendor->getId() != 'root')) {
00245 list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oVendor);
00246 if ($iAllArtCnt) {
00247 $this->_aArticleList = $aArticleList;
00248 }
00249 }
00250 }
00251
00252 return $this->_aArticleList;
00253 }
00254
00260 public function getTitle()
00261 {
00262 if ($this->_sCatTitle === null) {
00263 $this->_sCatTitle = '';
00264 if ($oVendor = $this->getActVendor()) {
00265 $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value;
00266 }
00267 }
00268
00269 return $this->_sCatTitle;
00270 }
00271
00277 public function getTreePath()
00278 {
00279 if ($this->_getVendorId() && $oVendorTree = $this->getVendorTree()) {
00280 return $oVendorTree->getPath();
00281 }
00282 }
00283
00289 protected function _getVendorId()
00290 {
00291 return oxRegistry::getConfig()->getRequestParameter('cnid');
00292 }
00293
00299 public function getActiveCategory()
00300 {
00301 if ($this->_oActCategory === null) {
00302 $this->_oActCategory = false;
00303 if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) {
00304 if ($oVendor = $this->getActVendor()) {
00305 $this->_oActCategory = $oVendor;
00306 }
00307 }
00308 }
00309
00310 return $this->_oActCategory;
00311 }
00312
00318 public function getCatTreePath()
00319 {
00320 if ($this->_sCatTreePath === null) {
00321 $this->_sCatTreePath = false;
00322 if (($oVendorTree = $this->getVendorTree())) {
00323 $this->_sCatTreePath = $oVendorTree->getPath();
00324 }
00325 }
00326
00327 return $this->_sCatTreePath;
00328 }
00329
00335 public function getTitleSuffix()
00336 {
00337 if ($this->getActVendor()->oxvendor__oxshowsuffix->value) {
00338 return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00339 }
00340 }
00341
00351 protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
00352 {
00353 return parent::_collectMetaKeyword($sKeywords);
00354 }
00355
00366 protected function _prepareMetaDescription($sMeta, $iLength = 1024, $blDescTag = false)
00367 {
00368 return parent::_collectMetaDescription($sMeta, $iLength, $blDescTag);
00369 }
00370
00379 protected function _getSubject($iLang)
00380 {
00381 return $this->getActVendor();
00382 }
00383
00389 public function getAddUrlParams()
00390 {
00391 $sAddParams = parent::getAddUrlParams();
00392 $sAddParams .= ($sAddParams ? '&' : '') . "listtype={$this->_sListType}";
00393 if ($oVendor = $this->getActVendor()) {
00394 $sAddParams .= "&cnid=v_" . $oVendor->getId();
00395 }
00396
00397 return $sAddParams;
00398 }
00399
00405 public function getBreadCrumb()
00406 {
00407 $aPaths = array();
00408 $oCatTree = $this->getVendorTree();
00409
00410 if ($oCatTree) {
00411 foreach ($oCatTree->getPath() as $oCat) {
00412 $aCatPath = array();
00413
00414 $aCatPath['link'] = $oCat->getLink();
00415 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
00416
00417 $aPaths[] = $aCatPath;
00418 }
00419 }
00420
00421 return $aPaths;
00422 }
00423
00424
00430 public function getVendorTree()
00431 {
00432 if ($this->_getVendorId() && $this->_oVendorTree === null) {
00434 $oVendorTree = oxNew('oxVendorList');
00435 $oVendorTree->buildVendorTree(
00436 'vendorlist',
00437 $this->getActVendor()->getId(),
00438 $this->getConfig()->getShopHomeURL()
00439 );
00440 $this->_oVendorTree = $oVendorTree;
00441 }
00442
00443 return $this->_oVendorTree;
00444 }
00445
00451 public function setVendorTree($oVendorTree)
00452 {
00453 $this->_oVendorTree = $oVendorTree;
00454 }
00455
00462 public function getAttributes()
00463 {
00464 return null;
00465 }
00466 }