manufacturerlist.php

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 
00082     public function render()
00083     {
00084         oxUBase::render();
00085 
00086         $myConfig = $this->getConfig();
00087 
00088         // load Manufacturer
00089         if ( $this->getManufacturerTree() ) {
00090             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00091                 if ( $oManufacturer->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 
00104         $this->_aViewData['pageNavigation'] = $this->getPageNavigation();
00105 
00106         // processing list articles
00107         $this->_processListArticles();
00108 
00109         // generating meta info
00110         $this->setMetaDescription( null );
00111         $this->setMetaKeywords( null );
00112 
00113         return $this->_sThisTemplate;
00114     }
00115 
00121     protected function _getProductLinkType()
00122     {
00123         return OXARTICLE_LINKTYPE_MANUFACTURER;
00124     }
00125 
00135     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
00136     {
00137         parent::setItemSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer', $sSortBy, $sSortDir );
00138     }
00139 
00147     public function getSorting( $sCnid )
00148     {
00149         return parent::getSorting( oxConfig::getParameter( 'mnid' ) .':manufacturer' );
00150     }
00151 
00159     protected function _loadArticles( $oManufacturer )
00160     {
00161         $sManufacturerId = $oManufacturer->getId();
00162 
00163         // load only articles which we show on screen
00164         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00165         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00166 
00167         $oArtList = oxNew( 'oxarticlelist' );
00168         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00169         $oArtList->setCustomSorting( $this->getSortingSql( $sManufacturerId ) );
00170 
00171         // load the articles
00172         $iArtCnt = $oArtList->loadManufacturerArticles( $sManufacturerId, $oManufacturer );
00173 
00174         return array( $oArtList, $iArtCnt );
00175     }
00176 
00182     protected function _getSeoObjectId()
00183     {
00184         $sId = null;
00185         if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00186             $sId = $oManufacturer->getId();
00187         }
00188         return $sId;
00189     }
00190 
00201     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00202     {
00203         if ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) {
00204             if ( $iPage ) {
00205                 // only if page number > 0
00206                 $sUrl = oxSeoEncoderManufacturer::getInstance()->getManufacturerPageUrl( $oManufacturer, $iPage, $iLang );
00207             }
00208         } else {
00209             $sUrl = parent::_addPageNrParam( $sUrl, $iPage, $iLang );
00210         }
00211         return $sUrl;
00212     }
00213 
00219     public function generatePageNavigationUrl()
00220     {
00221         if ( ( oxUtils::getInstance()->seoIsActive() && ( $oManufacturer = $this->getActManufacturer() ) ) ) {
00222             return $oManufacturer->getLink();
00223         } else {
00224             return parent::generatePageNavigationUrl( );
00225         }
00226     }
00227 
00233     public function hasVisibleSubCats()
00234     {
00235         if ( $this->_blVisibleSubCats === null ) {
00236             $this->_blVisibleSubCats = false;
00237             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00238                 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
00239                     if ( $oManufacturer->getId() == 'root' ) {
00240                         $this->_blVisibleSubCats = $oManufacturerTree->count();
00241                         $this->_oSubCatList = $oManufacturerTree;
00242                     }
00243                 }
00244             }
00245         }
00246         return $this->_blVisibleSubCats;
00247     }
00248 
00254     public function getSubCatList()
00255     {
00256         if ( $this->_oSubCatList === null ) {
00257             $this->_oSubCatList = $this->hasVisibleSubCats() ? $this->_oSubCatList : array();
00258         }
00259         return $this->_oSubCatList;
00260     }
00261 
00267     public function getArticleList()
00268     {
00269         if ( $this->_aArticleList === null ) {
00270             $this->_aArticleList = array();
00271             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00272                 if ( ( $oManufacturer = $this->getActManufacturer() ) && ( $oManufacturer->getId() != 'root' ) ) {
00273                     list( $aArticleList, $this->_iAllArtCnt ) = $this->_loadArticles( $oManufacturer );
00274                     if ( $this->_iAllArtCnt ) {
00275                         $this->_aArticleList = $aArticleList;
00276                     }
00277                 }
00278             }
00279         }
00280         return $this->_aArticleList;
00281     }
00282 
00288     public function getTitle()
00289     {
00290         if ( $this->_sCatTitle === null ) {
00291             $this->_sCatTitle = '';
00292             if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00293                 if ( $oManufacturer = $this->getActManufacturer() ) {
00294                     $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
00295                 }
00296             }
00297         }
00298         return $this->_sCatTitle;
00299     }
00300 
00308     public function getTemplateLocation()
00309     {
00310         if ( $this->_sTplLocation === null ) {
00311             $this->_sTplLocation = false;
00312             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00313                 $this->_sTplLocation = $oManufacturerTree->getHtmlPath();
00314             }
00315         }
00316         return $this->_sTplLocation;
00317     }
00318 
00324     public function getTreePath()
00325     {
00326         $aPath = null;
00327         if ( $oManufacturerTree = $this->getManufacturerTree() ) {
00328             $aPath = $oManufacturerTree->getPath();
00329         }
00330         return $aPath;
00331     }
00332 
00338     public function getActiveCategory()
00339     {
00340         if ( $this->_oActCategory === null ) {
00341             $this->_oActCategory = false;
00342             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00343                 if ( $oManufacturer = $this->getActManufacturer() ) {
00344                     $this->_oActCategory = $oManufacturer;
00345                 }
00346             }
00347         }
00348         return $this->_oActCategory;
00349     }
00350 
00356     public function getCatTreePath()
00357     {
00358         if ( $this->_sCatTreePath === null ) {
00359             $this->_sCatTreePath = false;
00360             if ( ( $oManufacturerTree = $this->getManufacturerTree() ) ) {
00361                 $this->_sCatTreePath  = $oManufacturerTree->getPath();
00362             }
00363         }
00364         return $this->_sCatTreePath;
00365     }
00366 
00372     public function getTitleSuffix()
00373     {
00374         $sSuffix = null;
00375         if ( $this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value ) {
00376             $sSuffix = $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
00377         }
00378         return $sSuffix;
00379     }
00380 
00389     protected function _prepareMetaKeyword( $aCatPath, $blRemoveDuplicatedWords = true )
00390     {
00391         return parent::_collectMetaKeyword( $aCatPath );
00392     }
00393 
00406     protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00407     {
00408         return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00409     }
00410 
00419     protected function _getSubject( $iLang )
00420     {
00421         return $this->getActManufacturer();
00422     }
00423 
00429     public function getAddUrlParams()
00430     {
00431         $sAddParams  = parent::getAddUrlParams();
00432         $sAddParams .= ($sAddParams?'&amp;':'') . "listtype={$this->_sListType}";
00433         if ( $oManufacturer = $this->getActManufacturer() ) {
00434             $sAddParams .= "&amp;mnid=" . $oManufacturer->getId();
00435         }
00436         return $sAddParams;
00437     }
00438 }

Generated by  doxygen 1.6.2