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_INDEX;
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 = oxUBase::_addPageNrParam( $sUrl, $iPage, $iLang );
00212         }
00213         return $sUrl;
00214     }
00215 
00221     public function generatePageNavigationUrl( )
00222     {
00223         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oVendor = $this->getActVendor() ) ) ) {
00224             return $oVendor->getLink();
00225         } else {
00226             return parent::generatePageNavigationUrl( );
00227         }
00228     }
00229 
00235     public function hasVisibleSubCats()
00236     {
00237         if ( $this->_blVisibleSubCats === null ) {
00238             $this->_blVisibleSubCats = false;
00239             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00240                 if ( ( $oVendor = $this->getActVendor() ) ) {
00241                     if ( $oVendor->getId() == 'root' ) {
00242                         $this->_blVisibleSubCats = $oVendorTree->count();
00243                         $this->_oSubCatList = $oVendorTree;
00244                     }
00245                 }
00246             }
00247         }
00248         return $this->_blVisibleSubCats;
00249     }
00250 
00256     public function getSubCatList()
00257     {
00258         if ( $this->_oSubCatList === null ) {
00259             $this->_oSubCatList = array();
00260             if ( $this->hasVisibleSubCats() ) {
00261                 return $this->_oSubCatList;
00262             }
00263         }
00264         return $this->_oSubCatList;
00265     }
00266 
00272     public function getArticleList()
00273     {
00274         if ( $this->_aArticleList === null ) {
00275             $this->_aArticleList = array();
00276             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00277                 if ( ( $oVendor = $this->getActVendor() ) && ( $oVendor->getId() != 'root' ) ) {
00278                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oVendor );
00279                     if ( $this->_iAllArtCnt ) {
00280                         $this->_aArticleList = $aArticleList;
00281                     }
00282                 }
00283             }
00284         }
00285         return $this->_aArticleList;
00286     }
00287 
00293     public function getTitle()
00294     {
00295         if ( $this->_sCatTitle === null ) {
00296             $this->_sCatTitle = '';
00297             if ( $oVendorTree = $this->getVendorTree() ) {
00298                 if ( $oVendor = $this->getActVendor() ) {
00299                     $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value;
00300                 }
00301             }
00302         }
00303         return $this->_sCatTitle;
00304     }
00305 
00313     public function getTemplateLocation()
00314     {
00315         if ( $this->_sTplLocation === null ) {
00316             $this->_sTplLocation = false;
00317             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00318                 $this->_sTplLocation = $oVendorTree->getHtmlPath();
00319             }
00320         }
00321         return $this->_sTplLocation;
00322     }
00323 
00329     public function getTreePath()
00330     {
00331         if ( $oVendorTree = $this->getVendorTree() ) {
00332             return $oVendorTree->getPath();
00333         }
00334     }
00335 
00341     public function getActiveCategory()
00342     {
00343         if ( $this->_oActCategory === null ) {
00344             $this->_oActCategory = false;
00345             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00346                 if ( $oVendor = $this->getActVendor() ) {
00347                     $this->_oActCategory = $oVendor;
00348                 }
00349             }
00350         }
00351         return $this->_oActCategory;
00352     }
00353 
00359     public function getCatTreePath()
00360     {
00361         if ( $this->_sCatTreePath === null ) {
00362             $this->_sCatTreePath = false;
00363             if ( ( $oVendorTree = $this->getVendorTree() ) ) {
00364                 $this->_sCatTreePath  = $oVendorTree->getPath();
00365             }
00366         }
00367         return $this->_sCatTreePath;
00368     }
00369 
00375     public function getTitleSuffix()
00376     {
00377         if ( $this->getActVendor()->oxvendor__oxshowsuffix->value ) {
00378             return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00379         }
00380     }
00381 
00391     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00392     {
00393         return parent::_collectMetaKeyword( $sKeywords );
00394     }
00395 
00406     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00407     {
00408         return parent::_collectMetaDescription( $sMeta, $iLength, $blDescTag );
00409     }
00410 
00419     protected function _getSubject( $iLang )
00420     {
00421         return $this->getActVendor();
00422     }
00423 }

Generated on Mon Oct 26 20:07:20 2009 for OXID eShop CE by  doxygen 1.5.5