vendorlist.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class VendorList extends aList
00010 {
00015     protected $_sListType = 'vendor';
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 vendor
00089         if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00090             if ( ( $oVendor = $this->getActVendor() ) ) {
00091                 if ( $oVendor->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         $this->_aViewData['hasVisibleSubCats'] = $this->hasVisibleSubCats();
00104         $this->_aViewData['subcatlist']        = $this->getSubCatList();
00105         $this->_aViewData['articlelist']       = $this->getArticleList();
00106         $this->_aViewData['similarrecommlist'] = $this->getSimilarRecommLists();
00107 
00108         $this->_aViewData['title']             = $this->getTitle();
00109         $this->_aViewData['template_location'] = $this->getTemplateLocation();
00110         $this->_aViewData['actCategory']       = $this->getActiveCategory();
00111         $this->_aViewData['actCatpath']        = $this->getCatTreePath();
00112 
00113         $this->_aViewData['pageNavigation'] = $this->getPageNavigation();
00114 
00115         // processing list articles
00116         $this->_processListArticles();
00117 
00118         return $this->_sThisTemplate;
00119     }
00120 
00126     protected function _getProductLinkType()
00127     {
00128         return OXARTICLE_LINKTYPE_VENDOR;
00129     }
00130 
00140     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
00141     {
00142         parent::setItemSorting( str_replace( 'v_', '', $sCnid ).':vendor', $sSortBy, $sSortDir );
00143     }
00144 
00152     public function getSorting( $sCnid )
00153     {
00154         return parent::getSorting( str_replace( 'v_', '', $sCnid ).':vendor' );
00155     }
00156 
00164     protected function _loadArticles( $oVendor )
00165     {
00166         $sVendorId = $oVendor->getId();
00167 
00168         // load only articles which we show on screen
00169         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00170         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00171 
00172         $oArtList = oxNew( 'oxarticlelist' );
00173         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00174         $oArtList->setCustomSorting( $this->getSortingSql( $sVendorId ) );
00175 
00176         // load the articles
00177         $iArtCnt = $oArtList->loadVendorArticles( $sVendorId, $oVendor );
00178 
00179         return array( $oArtList, $iArtCnt );
00180     }
00181 
00187     protected function _getSeoObjectId()
00188     {
00189         if ( ( $oVendor = $this->getActVendor() ) ) {
00190             return $oVendor->getId();
00191         }
00192     }
00193 
00204     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00205     {
00206         if ( oxUtils::getInstance()->seoIsActive() && ( $oVendor = $this->getActVendor() ) ) {
00207             if ( $iPage ) { // only if page number > 0
00208                 $sUrl = oxSeoEncoderVendor::getInstance()->getVendorPageUrl( $oVendor, $iPage, $iLang, $this->_isFixedUrl( $oVendor ) );
00209             }
00210         } else {
00211             $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00212         }
00213 
00214         return $sUrl;
00215     }
00216 
00222     public function generatePageNavigationUrl( )
00223     {
00224         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oVendor = $this->getActVendor() ) ) ) {
00225             return $oVendor->getLink();
00226         } else {
00227             return parent::generatePageNavigationUrl( );
00228         }
00229     }
00230 
00236     public function hasVisibleSubCats()
00237     {
00238         if ( $this->_blVisibleSubCats === null ) {
00239             $this->_blVisibleSubCats = false;
00240             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00241                 if ( ( $oVendor = $this->getActVendor() ) ) {
00242                     if ( $oVendor->getId() == 'root' ) {
00243                         $this->_blVisibleSubCats = $oVendorTree->count();
00244                         $this->_oSubCatList = $oVendorTree;
00245                     }
00246                 }
00247             }
00248         }
00249         return $this->_blVisibleSubCats;
00250     }
00251 
00257     public function getSubCatList()
00258     {
00259         if ( $this->_oSubCatList === null ) {
00260             $this->_oSubCatList = array();
00261             if ( $this->hasVisibleSubCats() ) {
00262                 return $this->_oSubCatList;
00263             }
00264         }
00265         return $this->_oSubCatList;
00266     }
00267 
00273     public function getArticleList()
00274     {
00275         if ( $this->_aArticleList === null ) {
00276             $this->_aArticleList = array();
00277             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00278                 if ( ( $oVendor = $this->getActVendor() ) && ( $oVendor->getId() != 'root' ) ) {
00279                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oVendor );
00280                     if ( $this->_iAllArtCnt ) {
00281                         $this->_aArticleList = $aArticleList;
00282                     }
00283                 }
00284             }
00285         }
00286         return $this->_aArticleList;
00287     }
00288 
00294     public function getTitle()
00295     {
00296         if ( $this->_sCatTitle === null ) {
00297             $this->_sCatTitle = '';
00298             if ( $oVendorTree = $this->getVendorTree() ) {
00299                 if ( $oVendor = $this->getActVendor() ) {
00300                     $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value;
00301                 }
00302             }
00303         }
00304         return $this->_sCatTitle;
00305     }
00306 
00312     public function getTemplateLocation()
00313     {
00314         if ( $this->_sTplLocation === null ) {
00315             $this->_sTplLocation = false;
00316             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00317                 $this->_sTplLocation = $oVendorTree->getHtmlPath();
00318             }
00319         }
00320         return $this->_sTplLocation;
00321     }
00322 
00328     public function getActiveCategory()
00329     {
00330         if ( $this->_oActCategory === null ) {
00331             $this->_oActCategory = false;
00332             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00333                 if ( $oVendor = $this->getActVendor() ) {
00334                     $this->_oActCategory = $oVendor;
00335                 }
00336             }
00337         }
00338         return $this->_oActCategory;
00339     }
00340 
00346     public function getCatTreePath()
00347     {
00348         if ( $this->_sCatTreePath === null ) {
00349             $this->_sCatTreePath = false;
00350             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00351                 $this->_sCatTreePath  = $oVendorTree->getPath();
00352             }
00353         }
00354         return $this->_sCatTreePath;
00355     }
00356 
00362     public function getTitleSuffix()
00363     {
00364         if ( $this->getActVendor()->oxvendor__oxshowsuffix->value ) {
00365             return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00366         }
00367     }
00368 
00378     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00379     {
00380         return parent::_collectMetaKeyword( $sKeywords );
00381     }
00382 
00393     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00394     {
00395         return parent::_collectMetaDescription( $sMeta, $iLength, $blDescTag );
00396     }
00397 }

Generated on Tue Sep 29 16:45:16 2009 for OXID eShop CE by  doxygen 1.5.5