oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007 
00008 // view indexing state for search engines:
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00012 
00018 class oxUBase extends oxView
00019 {
00027     public function isActive( $sName )
00028     {
00029         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
00030     }
00031 
00037     protected $_oaComponents = array();
00038 
00044     protected $_blIsOrderStep = false;
00045 
00051     protected $_sListType = null;
00052 
00058     protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00059 
00065     protected $_sListDisplayType = null;
00066 
00072     protected $_oActCategory = null;
00073 
00079     protected $_oActManufacturer = null;
00080 
00086     protected $_oActVendor = null;
00087 
00092     protected $_oActiveRecommList = null;
00093 
00099     protected $_oActSearch = null;
00100 
00105     protected $_blShowSorting = false;
00106 
00111     protected $_blShowRightBasket = null;
00112 
00117     protected $_blShowTopBasket = null;
00118 
00123     protected $_blShowLeftBasket = null;
00124 
00129     protected $_blLoadCurrency = null;
00130 
00135     protected $_blLoadVendorTree = null;
00136 
00141     protected $_blLoadManufacturerTree = null;
00142 
00147     protected $_blDontShowEmptyCats = null;
00148 
00153     protected $_blLoadLanguage = null;
00154 
00159     protected $_blShowTopCatNav = null;
00160 
00165     protected $_iTopCatNavItmCnt = null;
00166 
00171     protected $_aRssLinks = null;
00172 
00177     protected $_sListOrderBy = null;
00178 
00183     protected $_sListOrderDir = null;
00184 
00189     protected $_sMetaDescription = null;
00190 
00195     protected $_sMetaKeywords = null;
00196 
00202     protected $_sMetaDescriptionIdent = null;
00203 
00209     protected $_sMetaKeywordsIdent = null;
00210 
00215     protected $_sAdditionalParams = null;
00216 
00221     protected $_oActCurrency = null;
00222 
00227     protected $_blEnabledPrivateSales = null;
00228 
00235     protected $_blCommonAdded = false;
00236 
00243     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00244 
00251     protected $_blForceNoIndex = false;
00252 
00257     protected $_sWishlistName = null;
00258 
00263     protected $_iCompItemsCnt = null;
00264 
00270     protected $_sContentId = null;
00271 
00277     protected $_oContent = null;
00278 
00284     protected $_sViewResetID = null;
00285 
00290     protected $_blActiveSorting = null;
00291 
00296     protected $_aMenueList = null;
00297 
00303     protected $_aComponentNames = array(
00304                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00305                                     'oxcmp_lang'       => 0,
00306                                     'oxcmp_cur'        => 1,
00307                                     'oxcmp_shop'       => 1,
00308                                     'oxcmp_categories' => 0,
00309                                     'oxcmp_utils'      => 1,
00310                                     'oxcmp_news'       => 0,
00311                                     'oxcmp_basket'     => 1
00312                                   );
00313 
00319     protected $_aUserComponentNames = array();
00320 
00326     protected $_oProduct = null;
00327 
00332     protected $_iActPage = null;
00333 
00338     protected $_aArticleList = null;
00339 
00344     protected $_oVendorTree  = null;
00345 
00350     protected $_oManufacturerTree  = null;
00351 
00356     protected $_oCategoryTree  = null;
00357 
00362     protected $_aTop5ArticleList  = null;
00363 
00368     protected $_aBargainArticleList  = null;
00369 
00374     protected $_blLowOrderPrice = null;
00375 
00380     protected $_sMinOrderPrice  = null;
00381 
00386     protected $_iNewsRealStatus  = null;
00387 
00392     protected $_aBlockRedirectParams = array( 'fnc' );
00393 
00398     protected $_aVendorlist = null;
00399 
00404     protected $_oRootVendor = null;
00405 
00410     protected $_sVendorId = null;
00411 
00416     protected $_aManufacturerlist = null;
00417 
00422     protected $_oRootManufacturer = null;
00423 
00428     protected $_sManufacturerId = null;
00429 
00434     protected $_aSearchCatTree = null;
00435 
00440     protected $_oCatMore = null;
00441 
00446     protected $_blNewsSubscribed = null;
00447 
00452     protected $_oDelAddress = null;
00453 
00458     protected $_sCatTreePath = null;
00459 
00464     protected $_aContents = array();
00465 
00470     protected $_blTop5Action = true;
00471 
00476     protected $_blBargainAction = false;
00477 
00483     protected $_aMustFillFields = null;
00484 
00489     protected $_blShowTagCloud = true;
00490 
00495     protected $_blRootCatChanged = false;
00496 
00501     protected $_aInvoiceAddress = null;
00502 
00507     protected $_aDeliveryAddress = null;
00508 
00513     protected $_sActiveUsername = null;
00514 
00523     protected function _processRequest()
00524     {
00525         $myUtils = oxUtils::getInstance();
00526 
00527         // non admin, request is not empty and was not processed by seo engine
00528         if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00529 
00530             // fetching standard url and looking for it in seo table
00531             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00532                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00533             } else {
00534                 // forcing to set noindex/follow meta
00535                 $this->_forceNoIndex();
00536 
00537                 $sShopId = $this->getConfig()->getShopId();
00538                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00539                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00540 
00541                 // logging "not found" url
00542                 $oDb = oxDb::getDb();
00543                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00544                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00545             }
00546         }
00547     }
00548 
00555     public function init()
00556     {
00557         $this->_processRequest();
00558 
00559         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00560             unset( $this->_aComponentNames['oxcmp_basket'] );
00561         }
00562 
00563         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00564         if ( !$this->_blCommonAdded ) {
00565             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00566             $this->_blCommonAdded = true;
00567         }
00568 
00569         // storing current view
00570         $blInit = true;
00571 
00572 
00573         // init all components if there are any
00574         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00575             // do not override initiated components
00576             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00577                 // component objects MUST be created to support user called functions
00578                 $oComponent = oxNew( $sComponentName );
00579                 $oComponent->setParent( $this );
00580                 $oComponent->setThisAction( $sComponentName );
00581                 $this->_oaComponents[$sComponentName] = $oComponent;
00582             }
00583 
00584             // do we really need to initiate them ?
00585             if ( $blInit ) {
00586                 $this->_oaComponents[$sComponentName]->init();
00587 
00588                 // executing only is view does not have action method
00589                 if ( !method_exists( $this, $this->getFncName() ) ) {
00590                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00591                 }
00592             }
00593         }
00594 
00595         parent::init();
00596 
00597         // enable sorting ?
00598         if ( $this->showSorting() ) {
00599             $this->prepareSortColumns();
00600         }
00601     }
00602 
00609     public function getViewId()
00610     {
00611         if ( $this->_sViewId ) {
00612             return $this->_sViewId;
00613         }
00614 
00615         $myConfig = $this->getConfig();
00616         $iLang = oxLang::getInstance()->getBaseLanguage();
00617         $iCur  = (int) $myConfig->getShopCurrency();
00618 
00619 
00620             $this->_sViewId =  "ox|$iLang|$iCur";
00621 
00622         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00623 
00624         return $this->_sViewId;
00625     }
00626 
00627 
00633     public function showSorting()
00634     {
00635         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00636     }
00637 
00645     public function setComponents( $aComponents = null )
00646     {
00647         $this->_oaComponents = $aComponents;
00648     }
00649 
00655     public function getComponents()
00656     {
00657         return $this->_oaComponents;
00658     }
00659 
00667     public function setIsOrderStep( $blIsOrderStep = null )
00668     {
00669         $this->_blIsOrderStep = $blIsOrderStep;
00670     }
00671 
00677     public function getIsOrderStep()
00678     {
00679         return $this->_blIsOrderStep;
00680     }
00681 
00682 
00690     public function setActiveCategory( $oCategory )
00691     {
00692         $this->_oActCategory = $oCategory;
00693     }
00694 
00700     public function getActiveCategory()
00701     {
00702         return $this->_oActCategory;
00703     }
00704 
00710     public function getListType()
00711     {
00712         if ( $this->_sListType == null ) {
00713             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00714                 $this->_sListType = $sListType;
00715             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00716                 $this->_sListType = $sListType;
00717             }
00718         }
00719         return $this->_sListType;
00720     }
00721 
00727     public function getListDisplayType()
00728     {
00729         if ( $this->_sListDisplayType == null ) {
00730             $this->_sListDisplayType = oxConfig::getParameter( 'ldtype' );
00731 
00732             if ( !$this->_sListDisplayType ) {
00733                 $this->_sListDisplayType = oxSession::getVar( 'ldtype' );
00734             }
00735 
00736             if ( !$this->_sListDisplayType ) {
00737                 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00738             }
00739 
00740             $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00741 
00742             // writing to session
00743             if ( oxConfig::getParameter( 'ldtype' ) ) {
00744                 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00745             }
00746         }
00747         return $this->_sListDisplayType;
00748     }
00749 
00757     public function setListType( $sType )
00758     {
00759         $this->_sListType = $sType;
00760         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00761     }
00762 
00768     public function showRightBasket()
00769     {
00770         if ( $this->_blShowRightBasket === null ) {
00771             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00772                 $this->_blShowRightBasket = $blShowRightBasket;
00773             }
00774         }
00775         return $this->_blShowRightBasket;
00776     }
00777 
00785     public function setShowRightBasket( $blShowBasket )
00786     {
00787         $this->_blShowRightBasket = $blShowBasket;
00788     }
00789 
00795     public function showLeftBasket()
00796     {
00797         if ( $this->_blShowLeftBasket === null ) {
00798             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00799                 $this->_blShowLeftBasket = $blShowLeftBasket;
00800             }
00801         }
00802         return $this->_blShowLeftBasket;
00803     }
00804 
00812     public function setShowLeftBasket( $blShowBasket )
00813     {
00814         $this->_blShowLeftBasket = $blShowBasket;
00815     }
00816 
00822     public function showTopBasket()
00823     {
00824         if ( $this->_blShowTopBasket === null ) {
00825             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00826                 $this->_blShowTopBasket = $blShowTopBasket;
00827             }
00828         }
00829         return $this->_blShowTopBasket;
00830     }
00831 
00839     public function setShowTopBasket( $blShowBasket )
00840     {
00841         $this->_blShowTopBasket = $blShowBasket;
00842     }
00843 
00849     public function loadCurrency()
00850     {
00851         if ( $this->_blLoadCurrency == null ) {
00852             $this->_blLoadCurrency = false;
00853             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00854                 $this->_blLoadCurrency = $blLoadCurrency;
00855             }
00856         }
00857         return $this->_blLoadCurrency;
00858     }
00859 
00865     public function loadVendorTree()
00866     {
00867         if ( $this->_blLoadVendorTree == null ) {
00868             $this->_blLoadVendorTree = false;
00869             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00870                 $this->_blLoadVendorTree = $blLoadVendorTree;
00871             }
00872         }
00873         return $this->_blLoadVendorTree;
00874     }
00875 
00881     public function loadManufacturerTree()
00882     {
00883         if ( $this->_blLoadManufacturerTree == null ) {
00884             $this->_blLoadManufacturerTree = false;
00885             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00886                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00887             }
00888         }
00889         return $this->_blLoadManufacturerTree;
00890     }
00891 
00897     public function dontShowEmptyCategories()
00898     {
00899         if ( $this->_blDontShowEmptyCats == null ) {
00900             $this->_blDontShowEmptyCats = false;
00901             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00902                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00903             }
00904         }
00905         return $this->_blDontShowEmptyCats;
00906     }
00907 
00913     public function isLanguageLoaded()
00914     {
00915         if ( $this->_blLoadLanguage == null ) {
00916             $this->_blLoadLanguage = false;
00917             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00918                 $this->_blLoadLanguage = $blLoadLanguage;
00919             }
00920         }
00921         return $this->_blLoadLanguage;
00922     }
00923 
00929     public function showTopCatNavigation()
00930     {
00931         if ( $this->_blShowTopCatNav == null ) {
00932             $this->_blShowTopCatNav = false;
00933             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00934                 $this->_blShowTopCatNav = $blShowTopCatNav;
00935             }
00936         }
00937         return $this->_blShowTopCatNav;
00938     }
00939 
00945     public function getTopNavigationCatCnt()
00946     {
00947         if ( $this->_iTopCatNavItmCnt == null ) {
00948             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00949             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00950         }
00951         return $this->_iTopCatNavItmCnt;
00952     }
00953 
00963     public function addRssFeed($sTitle, $sUrl, $key = null)
00964     {
00965         if (!is_array($this->_aRssLinks)) {
00966             $this->_aRssLinks = array();
00967         }
00968         if ($key === null) {
00969             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00970         } else {
00971             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00972         }
00973     }
00974 
00980     public function getSortOrderByParameterName()
00981     {
00982         return 'listorderby';
00983     }
00984 
00990     public function getSortOrderParameterName()
00991     {
00992         return 'listorder';
00993     }
00994 
01005     public function prepareSortColumns()
01006     {
01007         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01008         if ( count( $aSortColumns ) > 0 ) {
01009 
01010             $this->_blActiveSorting = true;
01011             $this->_aSortColumns = $aSortColumns;
01012 
01013             $sCnid = oxConfig::getParameter( 'cnid' );
01014 
01015 
01016             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01017             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01018 
01019             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
01020                 $sSortBy  = $aSorting['sortby'];
01021                 $sSortDir = $aSorting['sortdir'];
01022             }
01023 
01024             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01025                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01026 
01027                 $this->_sListOrderBy  = $sSortBy;
01028                 $this->_sListOrderDir = $sSortDir;
01029 
01030                 // caching sorting config
01031                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01032             }
01033         }
01034     }
01035 
01041     public function getListOrderBy()
01042     {
01043         //if column is with table name split it
01044         $aColums = explode('.', $this->_sListOrderBy);
01045 
01046         if ( is_array($aColums) && count($aColums) > 1 ) {
01047            return $aColums[1];
01048         }
01049 
01050         return $this->_sListOrderBy;
01051     }
01052 
01058     public function getListOrderDirection()
01059     {
01060         return $this->_sListOrderDir;
01061     }
01062 
01070     public function setMetaDescription ( $sDescription )
01071     {
01072         return $this->_sMetaDescription = $sDescription;
01073     }
01074 
01082     public function setMetaKeywords( $sKeywords )
01083     {
01084         return $this->_sMetaKeywords = $sKeywords;
01085     }
01086 
01094     protected function _getMetaFromSeo( $sDataType )
01095     {
01096         $sOxid  = $this->_getSeoObjectId();
01097         $iLang  = oxLang::getInstance()->getBaseLanguage();
01098         $sShop  = $this->getConfig()->getShopId();
01099 
01100         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01101              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01102             return $sKeywords;
01103         }
01104     }
01105 
01113     protected function _getMetaFromContent( $sMetaIdent )
01114     {
01115         if ( $sMetaIdent ) {
01116             $oContent = oxNew( 'oxcontent' );
01117             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01118                  $oContent->oxcontents__oxactive->value ) {
01119                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01120             }
01121         }
01122     }
01123 
01129     public function getMetaKeywords()
01130     {
01131         if ( $this->_sMetaKeywords === null ) {
01132             $this->_sMetaKeywords = false;
01133 
01134             // set special meta keywords ?
01135             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01136                 $this->_sMetaKeywords = $sKeywords;
01137             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01138                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01139             } else {
01140                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01141             }
01142         }
01143 
01144         return $this->_sMetaKeywords;
01145     }
01146 
01152     public function getMetaDescription()
01153     {
01154         if ( $this->_sMetaDescription === null ) {
01155             $this->_sMetaDescription = false;
01156 
01157             // set special meta description ?
01158             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01159                 $this->_sMetaDescription = $sDescription;
01160             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01161                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01162             } else {
01163                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01164             }
01165         }
01166 
01167         return $this->_sMetaDescription;
01168     }
01169 
01175     public function getActCurrency()
01176     {
01177         return $this->_oActCurrency;
01178     }
01179 
01187     public function setActCurrency( $oCur )
01188     {
01189         $this->_oActCurrency = $oCur;
01190     }
01191 
01197     public function getCompareItemsCnt()
01198     {
01199         return (int)$this->_iCompItemsCnt;
01200     }
01201 
01209     public function setCompareItemsCnt( $iCount )
01210     {
01211         $this->_iCompItemsCnt = $iCount;
01212     }
01213 
01219     public function getWishlistName()
01220     {
01221         return $this->_sWishlistName;
01222     }
01223 
01231     public function setWishlistName( $sName )
01232     {
01233         $this->_sWishlistName = $sName;
01234     }
01235 
01241     protected function _forceNoIndex()
01242     {
01243         $this->_blForceNoIndex = true;
01244     }
01245 
01252     public function noIndex()
01253     {
01254         if ( $this->_blForceNoIndex ) {
01255             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01256         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01257             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01258         } else {
01259             switch ( oxConfig::getParameter( 'fnc' ) ) {
01260                 case 'tocomparelist':
01261                 case 'tobasket':
01262                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01263                     break;
01264             }
01265         }
01266         return $this->_iViewIndexState;
01267     }
01268 
01275     public function getContentId()
01276     {
01277         if ( $this->_sContentId === null) {
01278             $oContent = oxNew( 'oxcontent' );
01279             $oContent->loadByIdent( 'oximpressum' );
01280             $this->_sContentId = $oContent->getId();
01281         }
01282 
01283         return $this->_sContentId;
01284     }
01285 
01292     public function getContent()
01293     {
01294         if ( $this->_oContent === null) {
01295             $oContent = oxNew( 'oxcontent' );
01296             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01297                 $this->_oContent = $oContent;
01298             }
01299         }
01300 
01301         return $this->_oContent;
01302     }
01303 
01309     public function isSortingActive()
01310     {
01311         return $this->_blActiveSorting;
01312     }
01313 
01319     public function getMenueList()
01320     {
01321         return $this->_aMenueList;
01322     }
01323 
01331     public function setMenueList( $aMenue )
01332     {
01333         $this->_aMenueList = $aMenue;
01334     }
01335 
01336 
01342     protected function _setNrOfArtPerPage()
01343     {
01344         $myConfig  = $this->getConfig();
01345 
01346         //setting default values to avoid possible errors showing article list
01347         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01348 
01349         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01350 
01351         // checking if all needed data is set
01352         switch ( $this->getListDisplayType() ) {
01353             case 'grid':
01354                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01355                 break;
01356             case 'line':
01357             case 'infogrid':
01358             default:
01359                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01360         }
01361 
01362         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01363             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01364         } else {
01365             $iNrofCatArticles = $aNrofCatArticles[0];
01366         }
01367 
01368         $oViewConf = $this->getViewConfig();
01369         //value from user input
01370         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01371             // M45 Possibility to push any "Show articles per page" number parameter
01372             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01373             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01374             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01375         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01376             // M45 Possibility to push any "Show articles per page" number parameter
01377             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01378             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01379             $iNrofCatArticles = $iSessArtPerPage;
01380         } else {
01381             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01382         }
01383 
01384         //setting number of articles per page to config value
01385         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01386     }
01387 
01393     protected function _getSeoObjectId()
01394     {
01395     }
01396 
01406     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01407     {
01408         if ( $sMeta ) {
01409 
01410             $oStr = getStr();
01411             if ( $iLength != -1 ) {
01412                 /* *
01413                  * performance - we dont need a huge amount of initial text.
01414                  * assume that effective text may be double longer than $iLength
01415                  * and simple turncate it
01416                  */
01417                 $iELength = ( $iLength * 2 );
01418                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01419             }
01420 
01421             // decoding html entities
01422             $sMeta = $oStr->html_entity_decode( $sMeta );
01423             // stripping HTML tags
01424             $sMeta = strip_tags( $sMeta );
01425 
01426             // removing some special chars
01427             $sMeta = $oStr->cleanStr( $sMeta );
01428 
01429             // removing duplicate words
01430             if ( $blRemoveDuplicatedWords ) {
01431                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01432             }
01433 
01434             // some special cases
01435             $sMeta = str_replace( ' ,', ',', $sMeta );
01436             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01437             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01438             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01439 
01440             return trim( $sMeta );
01441         }
01442     }
01443 
01452     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01453     {
01454 
01455         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01456 
01457         if ( $blRemoveDuplicatedWords ) {
01458             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01459         }
01460 
01461         // removing in admin defined strings
01462 
01463         /*if ( is_array( $aSkipTags ) && $sString ) {
01464             $oStr = getStr();
01465             foreach ( $aSkipTags as $sSkip ) {
01466                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01467                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01468                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01469                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01470             }
01471         }*/
01472 
01473         return trim( $sString );
01474     }
01475 
01484     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01485     {
01486         $oStr = getStr();
01487         if ( is_array( $aInput ) ) {
01488             $aStrings = $aInput;
01489         } else {
01490             //is String
01491             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01492         }
01493 
01494         if ( $sCount = count( $aSkipTags ) ) {
01495             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01496                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01497             }
01498         }
01499         $sCount = count($aStrings);
01500         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01501             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01502             // removing in admin defined strings
01503             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01504                 unset( $aStrings[$iNum] );
01505             }
01506         }
01507 
01508         // duplicates
01509         $aStrings = array_unique($aStrings);
01510 
01511         return implode( ', ', $aStrings );
01512     }
01513 
01521     public function getNavigationParams()
01522     {
01523         $aParams['cnid'] = $this->getCategoryId();
01524         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01525 
01526         $aParams['listtype'] = $this->getListType();
01527         $aParams['ldtype'] = $this->getListDisplayType();
01528 
01529         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01530 
01531         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01532         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01533         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01534 
01535         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01536         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01537         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01538 
01539         return $aParams;
01540     }
01541 
01551     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01552     {
01553 
01554         $aSorting = oxSession::getVar( 'aSorting' );
01555         $aSorting[$sCnid]['sortby']  = $sSortBy;
01556         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01557 
01558         oxSession::setVar( 'aSorting', $aSorting );
01559     }
01560 
01568     public function getSorting( $sCnid )
01569     {
01570         $aSorting = oxSession::getVar( 'aSorting' );
01571 
01572         if ( isset( $aSorting[$sCnid] ) ) {
01573             return $aSorting[$sCnid];
01574         }
01575     }
01576 
01584     public function getSortingSql( $sCnid )
01585     {
01586         $aSorting = $this->getSorting( $sCnid );
01587         if ( is_array( $aSorting ) ) {
01588             return implode( " ", $aSorting );
01589         }
01590     }
01591 
01597     public function getTitleSuffix()
01598     {
01599         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01600     }
01601 
01608     public function getTitlePrefix()
01609     {
01610         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01611     }
01612 
01621     protected function _getSubject( $iLang )
01622     {
01623         return null;
01624     }
01625 
01631     public function getDynUrlParams()
01632     {
01633         $sRet = '';
01634         $sListType = $this->getListType();
01635 
01636         switch ($sListType) {
01637             default:
01638                 break;
01639             case 'search':
01640                 $sRet .= "&amp;listtype={$sListType}";
01641                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01642                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01643                 }
01644 
01645                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01646                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01647                 }
01648                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01649                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01650                 }
01651                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01652                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01653                 }
01654                 break;
01655             case 'tag':
01656                 $sRet .= "&amp;listtype={$sListType}";
01657                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01658                     $sRet .= "&amp;searchtag={$sParam}";
01659                 }
01660                 break;
01661         }
01662 
01663         return $sRet;
01664     }
01665 
01673     public function getLink( $iLang = null )
01674     {
01675         if ( !isset( $iLang ) ) {
01676             $iLang = oxLang::getInstance()->getBaseLanguage();
01677         }
01678 
01679         $oDisplayObj = null;
01680         $blTrySeo = false;
01681         if ( oxUtils::getInstance()->seoIsActive() ) {
01682             $blTrySeo = true;
01683             $oDisplayObj = $this->_getSubject( $iLang );
01684         }
01685         $iActPageNr = $this->getActPage();
01686 
01687         if ( $oDisplayObj ) {
01688             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01689         }
01690 
01691         $myConfig = $this->getConfig();
01692 
01693         if ( $blTrySeo ) {
01694             $oEncoder = oxSeoEncoder::getInstance();
01695             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01696                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01697             }
01698         }
01699 
01700         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01701 
01702         // fallback to old non seo url
01703         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01704     }
01705 
01711     public function getCanonicalUrl()
01712     {
01713     }
01714 
01721     public function getSimilarRecommLists()
01722     {
01723     }
01724 
01731     public function getSearchParamForHtml()
01732     {
01733     }
01734 
01742     protected function _getRequestParams( $blAddPageNr  = true )
01743     {
01744         $sClass = $this->getClassName();
01745         $sFnc   = $this->getFncName();
01746 
01747         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01748         if ( in_array( $sFnc, $aFnc ) ) {
01749             $sFnc = '';
01750         }
01751 
01752         // #680
01753         $sURL = "cl={$sClass}";
01754         if ( $sFnc ) {
01755             $sURL .= "&amp;fnc={$sFnc}";
01756         }
01757         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01758             $sURL .= "&amp;cnid={$sVal}";
01759         }
01760         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01761             $sURL .= "&amp;mnid={$sVal}";
01762         }
01763         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01764             $sURL .= "&amp;anid={$sVal}";
01765         }
01766 
01767         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01768             $sURL .= "&amp;page={$sVal}";
01769         }
01770 
01771         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01772             $sURL .= "&amp;tpl={$sVal}";
01773         }
01774 
01775         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01776         // don't include page number for navigation
01777         // it will be done in oxubase::generatePageNavigation
01778         if ( $blAddPageNr && $iPgNr > 0 ) {
01779             $sURL .= "&amp;pgNr={$iPgNr}";
01780         }
01781 
01782         // #1184M - specialchar search
01783         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01784             $sURL .= "&amp;searchparam={$sVal}";
01785         }
01786 
01787         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01788             $sURL .= "&amp;searchcnid={$sVal}";
01789         }
01790 
01791         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01792             $sURL .= "&amp;searchvendor={$sVal}";
01793         }
01794 
01795         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01796             $sURL .= "&amp;searchmanufacturer={$sVal}";
01797         }
01798 
01799         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01800             $sURL .= "&amp;searchrecomm={$sVal}";
01801         }
01802 
01803         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01804             $sURL .= "&amp;searchtag={$sVal}";
01805         }
01806 
01807         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01808             $sURL .= "&amp;recommid={$sVal}";
01809         }
01810 
01811         return $sURL;
01812     }
01813 
01819     protected function _getSeoRequestParams()
01820     {
01821         $sClass = $this->getClassName();
01822         $sFnc   = $this->getFncName();
01823 
01824         // #921 S
01825         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01826         if ( in_array( $sFnc, $aFnc ) ) {
01827             $sFnc = '';
01828         }
01829 
01830         // #680
01831         $sURL = "cl={$sClass}";
01832         if ( $sFnc ) {
01833             $sURL .= "&amp;fnc={$sFnc}";
01834         }
01835         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01836             $sURL .= "&amp;page={$sVal}";
01837         }
01838 
01839         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01840             $sURL .= "&amp;tpl={$sVal}";
01841         }
01842 
01843         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01844         if ( $iPgNr > 0 ) {
01845             $sURL .= "&amp;pgNr={$iPgNr}";
01846         }
01847 
01848         return $sURL;
01849     }
01850 
01856     public function showSearch()
01857     {
01858         $blShow = true;
01859         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01860             $blShow = false;
01861         }
01862         return (int) $blShow;
01863     }
01864 
01870     public function getRssLinks()
01871     {
01872         return $this->_aRssLinks;
01873     }
01874 
01880     public function getSortColumns()
01881     {
01882         return $this->_aSortColumns;
01883     }
01884 
01890     public function getEditTags()
01891     {
01892     }
01893 
01899     public function getRecommSearch()
01900     {
01901     }
01902 
01908     public function getPaymentList()
01909     {
01910     }
01911 
01917     public function getActiveRecommList()
01918     {
01919         if ( $this->_oActiveRecommList === null ) {
01920             $this->_oActiveRecommList = false;
01921             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01922                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01923                 $this->_oActiveRecommList->load( $sOxid );
01924             }
01925         }
01926         return $this->_oActiveRecommList;
01927     }
01928 
01934     public function getAccessoires()
01935     {
01936     }
01937 
01943     public function getCrossSelling()
01944     {
01945     }
01946 
01952     public function getSimilarProducts()
01953     {
01954     }
01955 
01961     public function getAlsoBoughtTheseProducts()
01962     {
01963     }
01964 
01970     public function getArticleId()
01971     {
01972     }
01973 
01979     public function isMoreTagsVisible()
01980     {
01981         return false;
01982     }
01983 
01989     public function getTitle()
01990     {
01991     }
01992 
01998     public function getActiveLangAbbr()
01999     {
02000         // Performance
02001         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02002             return;
02003         }
02004 
02005         if ( !isset($this->_sActiveLangAbbr ) ) {
02006             $aLanguages = oxLang::getInstance()->getLanguageArray();
02007             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02008                 if ( $oVal->selected ) {
02009                     $this->_sActiveLangAbbr = $oVal->abbr;
02010                     break;
02011                 }
02012             }
02013         }
02014 
02015         return $this->_sActiveLangAbbr;
02016     }
02017 
02025     public function addGlobalParams( $oShop = null)
02026     {
02027         $oViewConf = parent::addGlobalParams( $oShop );
02028 
02029         $this->_setNrOfArtPerPage();
02030 
02031         return $oViewConf;
02032     }
02033 
02039     public function getAdditionalParams()
02040     {
02041         if ( $this->_sAdditionalParams === null ) {
02042             // #1018A
02043             $this->_sAdditionalParams  = parent::getAdditionalParams();
02044             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02045 
02046             // #1834M - specialchar search
02047             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02048             if ( isset( $sSearchParamForLink ) ) {
02049                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02050             }
02051             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02052                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02053             }
02054             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02055                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02056             }
02057             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02058                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02059             }
02060             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02061                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02062             }
02063             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02064                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02065             }
02066             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02067                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02068             }
02069         }
02070 
02071         return $this->_sAdditionalParams;
02072     }
02073 
02079     public function generatePageNavigationUrl()
02080     {
02081         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02082     }
02083 
02093     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02094     {
02095         if ( $iPage ) {
02096             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02097         }
02098         return $sUrl;
02099     }
02100 
02106     public function getPageNavigation()
02107     {
02108 
02109     }
02110 
02116     public function getPageNavigationLimitedTop()
02117     {
02118 
02119         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02120 
02121         return $this->_oPageNavigation;
02122     }
02123 
02129     public function getPageNavigationLimitedBottom()
02130     {
02131 
02132         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02133 
02134         return $this->_oPageNavigation;
02135     }
02136 
02137 
02145     public function generatePageNavigation( $iPositionCount = 0 )
02146     {
02147         startProfile('generatePageNavigation');
02148 
02149         $pageNavigation = new stdClass();
02150 
02151         $pageNavigation->NrOfPages = $this->_iCntPages;
02152         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02153         $iActPage = $this->getActPage();
02154         $pageNavigation->actPage   = $iActPage + 1;
02155         $sUrl = $this->generatePageNavigationUrl();
02156 
02157         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02158              $iStartNo = 2;
02159              $iFinishNo = $pageNavigation->NrOfPages;
02160              $bStart = false;
02161              $bFinish =false;
02162         } else {
02163             $iTmpVal = $iPositionCount - 3;
02164             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02165 
02166             // actual page is at the start
02167             if ( $pageNavigation->actPage <= $iTmpVal ) {
02168                 $iStartNo = 2;
02169                 $iFinishNo = $iTmpVal + 1;
02170                 $bStart = false;
02171                 $bFinish = true;
02172             // actual page is at the end
02173             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02174                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02175                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02176                 $bStart = true;
02177                 $bFinish = false;
02178             // actual page is in the midle
02179             } else {
02180                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02181                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02182                 $bStart = true;
02183                 $bFinish = true;
02184             }
02185         }
02186 
02187         if ( $iActPage > 0) {
02188             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02189         }
02190 
02191         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02192             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02193         }
02194 
02195         if ( $pageNavigation->NrOfPages > 1 ) {
02196 
02197             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02198 
02199                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02200                     $page = new Oxstdclass();
02201                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02202                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02203                     $pageNavigation->changePage[$i] = $page;
02204                 }
02205             }
02206 
02207             // first/last one
02208             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02209             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02210         }
02211 
02212         stopProfile('generatePageNavigation');
02213 
02214         return $pageNavigation;
02215     }
02216 
02222     public function getArticleCount()
02223     {
02224         return $this->_iAllArtCnt;
02225     }
02226 
02233     public function render()
02234     {
02235         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02236             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02237         }
02238 
02239         parent::render();
02240 
02241         if ( $this->getIsOrderStep() ) {
02242 
02243             // disabling navigation during order ...
02244             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02245                 $this->_iNewsRealStatus = 1;
02246                 $this->setShowNewsletter( 0 );
02247                 $this->setShowRightBasket( 0 );
02248                 $this->setShowLeftBasket( 0 );
02249                 $this->setShowTopBasket( 0 );
02250             }
02251         }
02252         return $this->_sThisTemplate;
02253     }
02254 
02260     public function getViewProduct()
02261     {
02262         return $this->getProduct();
02263     }
02264 
02272     public function setViewProduct( $oProduct )
02273     {
02274         $this->_oProduct = $oProduct;
02275     }
02276 
02282     public function getViewProductList()
02283     {
02284         return $this->_aArticleList;
02285     }
02286 
02292     public function getActPage()
02293     {
02294         if ( $this->_iActPage === null ) {
02295             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02296             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02297         }
02298         return $this->_iActPage;
02299     }
02300 
02308     public function getActTag()
02309     {
02310         if ( $this->_oActTag === null ) {
02311             $this->_oActTag = new Oxstdclass();
02312             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02313             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02314 
02315             $sLink = false;
02316             if ( oxUtils::getInstance()->seoIsActive() ) {
02317                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02318             }
02319 
02320             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02321         }
02322         return $this->_oActTag;
02323     }
02324 
02332     public function getActVendor()
02333     {
02334         // if active vendor is not set yet - trying to load it from request params
02335         // this may be usefull when category component was unable to load active vendor
02336         // and we still need some object to mount navigation info
02337         if ( $this->_oActVendor === null ) {
02338             $this->_oActVendor = false;
02339             $sVendorId = oxConfig::getParameter( 'cnid' );
02340             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02341             $oVendor = oxNew( 'oxvendor' );
02342             if ( $oVendor->load( $sVendorId ) ) {
02343                 $this->_oActVendor = $oVendor;
02344             }
02345         }
02346 
02347         return $this->_oActVendor;
02348     }
02349 
02357     public function getActManufacturer()
02358     {
02359         // if active Manufacturer is not set yet - trying to load it from request params
02360         // this may be usefull when category component was unable to load active Manufacturer
02361         // and we still need some object to mount navigation info
02362         if ( $this->_oActManufacturer === null ) {
02363 
02364             $this->_oActManufacturer = false;
02365             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02366             $oManufacturer = oxNew( 'oxmanufacturer' );
02367             if ( $oManufacturer->load( $sManufacturerId ) ) {
02368                 $this->_oActManufacturer = $oManufacturer;
02369             }
02370         }
02371 
02372         return $this->_oActManufacturer;
02373     }
02374 
02382     public function setActVendor( $oVendor )
02383     {
02384         $this->_oActVendor = $oVendor;
02385     }
02386 
02394     public function setActManufacturer( $oManufacturer )
02395     {
02396         $this->_oActManufacturer = $oManufacturer;
02397     }
02398 
02404     public function getActSearch()
02405     {
02406         if ( $this->_oActSearch === null ) {
02407             $this->_oActSearch = new oxStdClass();
02408             $sUrl = $this->getConfig()->getShopHomeURL();
02409             $this->_oActSearch->link = "{$sUrl}cl=search";
02410         }
02411         return $this->_oActSearch;
02412     }
02413 
02419     public function getCategoryTree()
02420     {
02421         return $this->_oCategoryTree;
02422     }
02423 
02431     public function setCategoryTree( $oCatTree )
02432     {
02433         $this->_oCategoryTree = $oCatTree;
02434     }
02435 
02441     public function getVendorTree()
02442     {
02443         return $this->_oVendorTree;
02444     }
02445 
02453     public function setVendorTree( $oVendorTree )
02454     {
02455         $this->_oVendorTree = $oVendorTree;
02456     }
02457 
02463     public function getManufacturerTree()
02464     {
02465         return $this->_oManufacturerTree;
02466     }
02467 
02475     public function setManufacturerTree( $oManufacturerTree )
02476     {
02477         $this->_oManufacturerTree = $oManufacturerTree;
02478     }
02479 
02485     public function getAddUrlParams()
02486     {
02487     }
02488 
02495     public function getTop5ArticleList()
02496     {
02497         if ( $this->_blTop5Action ) {
02498             if ( $this->_aTop5ArticleList === null ) {
02499                 $this->_aTop5ArticleList = false;
02500                 $myConfig = $this->getConfig();
02501                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02502                     // top 5 articles
02503                     $oArtList = oxNew( 'oxarticlelist' );
02504                     $oArtList->loadTop5Articles();
02505                     if ( $oArtList->count() ) {
02506                         $this->_aTop5ArticleList = $oArtList;
02507                     }
02508                 }
02509             }
02510         }
02511         return $this->_aTop5ArticleList;
02512     }
02513 
02520     public function getBargainArticleList()
02521     {
02522         if ( $this->_blBargainAction ) {
02523             if ( $this->_aBargainArticleList === null ) {
02524                 $this->_aBargainArticleList = array();
02525                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02526                     $oArtList = oxNew( 'oxarticlelist' );
02527                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02528                     if ( $oArtList->count() ) {
02529                         $this->_aBargainArticleList = $oArtList;
02530                     }
02531                 }
02532             }
02533         }
02534         return $this->_aBargainArticleList;
02535     }
02536 
02543     public function isLowOrderPrice()
02544     {
02545         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02546             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02547         }
02548 
02549         return $this->_blLowOrderPrice;
02550     }
02551 
02557     public function getMinOrderPrice()
02558     {
02559         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02560             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02561             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02562         }
02563         return $this->_sMinOrderPrice;
02564     }
02565 
02571     public function getNewsRealStatus()
02572     {
02573         return $this->_iNewsRealStatus;
02574     }
02575 
02581     protected function _canRedirect()
02582     {
02583         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02584             if ( oxConfig::getParameter( $sParam ) !== null ) {
02585                 return false;
02586             }
02587         }
02588 
02589         return true;
02590     }
02591 
02597     public function getProduct()
02598     {
02599     }
02600 
02606     public function getVendorlist()
02607     {
02608         return $this->_aVendorlist;
02609     }
02610 
02618     public function setVendorlist( $aList )
02619     {
02620         $this->_aVendorlist = $aList;
02621     }
02622 
02628     public function getManufacturerlist()
02629     {
02630         return $this->_aManufacturerlist;
02631     }
02632 
02640     public function setManufacturerlist( $aList )
02641     {
02642         $this->_aManufacturerlist = $aList;
02643     }
02644 
02652     public function setRootVendor( $oVendor )
02653     {
02654         $this->_oRootVendor = $oVendor;
02655     }
02656 
02662     public function getRootVendor()
02663     {
02664         return $this->_oRootVendor;
02665     }
02666 
02674     public function setRootManufacturer( $oManufacturer )
02675     {
02676         $this->_oRootManufacturer = $oManufacturer;
02677     }
02678 
02684     public function getRootManufacturer()
02685     {
02686         return $this->_oRootManufacturer;
02687     }
02688 
02694     public function getVendorId()
02695     {
02696         if ( $this->_sVendorId === null ) {
02697             $this->_sVendorId = false;
02698             if ( ( $oVendor = $this->getActVendor() ) ) {
02699                 $this->_sVendorId = $oVendor->getId();
02700             }
02701         }
02702         return $this->_sVendorId;
02703     }
02704 
02710     public function getManufacturerId()
02711     {
02712         if ( $this->_sManufacturerId === null ) {
02713             $this->_sManufacturerId = false;
02714             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02715                 $this->_sManufacturerId = $oManufacturer->getId();
02716             }
02717         }
02718         return $this->_sManufacturerId;
02719     }
02720 
02726     public function getSearchCatTree()
02727     {
02728         return $this->_aSearchCatTree;
02729     }
02730 
02738     public function setSearchCatTree( $aTree )
02739     {
02740         $this->_aSearchCatTree = $aTree;
02741     }
02742 
02748     public function getCatMoreUrl()
02749     {
02750         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02751     }
02752 
02758     public function getCatMore()
02759     {
02760         return $this->_oCatMore;
02761     }
02762 
02770     public function setCatMore( $oCat )
02771     {
02772         $this->_oCatMore = $oCat;
02773     }
02774 
02780     public function getCatTreePath()
02781     {
02782         return $this->_sCatTreePath;
02783     }
02784 
02792     public function getContentByIdent( $sIdent )
02793     {
02794         if ( !isset( $this->_aContents[$sIdent] ) ) {
02795             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02796             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02797         }
02798         return $this->_aContents[$sIdent];
02799     }
02800 
02806     public function getContentCategory()
02807     {
02808         return false;
02809     }
02810 
02816     public function getMustFillFields()
02817     {
02818         if ( $this->_aMustFillFields === null ) {
02819             $this->_aMustFillFields = false;
02820 
02821             // passing must-be-filled-fields info
02822             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02823             if ( is_array( $aMustFillFields ) ) {
02824                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02825             }
02826         }
02827         return $this->_aMustFillFields;
02828     }
02829 
02837     public function isFieldRequired( $sField )
02838     {
02839         if ( $aMustFillFields = $this->getMustFillFields() ) {
02840             if ( isset( $aMustFillFields[$sField] ) ) {
02841                 return true;
02842             }
02843         }
02844 
02845         return false;
02846     }
02847 
02853     public function getFormId()
02854     {
02855         if ( $this->_sFormId === null ) {
02856             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02857             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02858         }
02859 
02860         return $this->_sFormId;
02861     }
02862 
02868     public function canAcceptFormData()
02869     {
02870         if ( $this->_blCanAcceptFormData === null ) {
02871             $this->_blCanAcceptFormData = false;
02872 
02873             $sFormId = oxConfig::getParameter( "uformid" );
02874             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02875 
02876             // testing if form and session ids matches
02877             if ( $sFormId && $sFormId === $sSessionFormId ) {
02878                 $this->_blCanAcceptFormData = true;
02879             }
02880 
02881             // regenerating form data
02882             $this->getFormId();
02883         }
02884         return $this->_blCanAcceptFormData;
02885     }
02886 
02892     public function getPromoFinishedList()
02893     {
02894         if (isset($this->_oPromoFinishedList)) {
02895             return $this->_oPromoFinishedList;
02896         }
02897         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02898         $this->_oPromoFinishedList->loadFinishedByCount(2);
02899         return $this->_oPromoFinishedList;
02900     }
02901 
02907     public function getPromoCurrentList()
02908     {
02909         if (isset($this->_oPromoCurrentList)) {
02910             return $this->_oPromoCurrentList;
02911         }
02912         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02913         $this->_oPromoCurrentList->loadCurrent();
02914         return $this->_oPromoCurrentList;
02915     }
02916 
02922     public function getPromoFutureList()
02923     {
02924         if (isset($this->_oPromoFutureList)) {
02925             return $this->_oPromoFutureList;
02926         }
02927         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02928         $this->_oPromoFutureList->loadFutureByCount(2);
02929         return $this->_oPromoFutureList;
02930     }
02931 
02937     public function getShowPromotionList()
02938     {
02939         if (isset($this->_blShowPromotions)) {
02940             return $this->_blShowPromotions;
02941         }
02942         $this->_blShowPromotions = false;
02943         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02944             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02945         }
02946         return $this->_blShowPromotions;
02947     }
02948 
02954     public function isEnabledPrivateSales()
02955     {
02956         if ( $this->_blEnabledPrivateSales === null ) {
02957             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
02958             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
02959                 $this->_blEnabledPrivateSales = !$blCanPreview;
02960             }
02961         }
02962         return $this->_blEnabledPrivateSales;
02963     }
02964 
02970     public function getTagCloudManager()
02971     {
02972         if ( $this->_blShowTagCloud ) {
02973             return oxNew( "oxTagCloud" );
02974         } else {
02975             return false;
02976         }
02977     }
02978 
02984     public function getFieldValidationErrors()
02985     {
02986         return oxInputValidator::getInstance()->getFieldValidationErrors();
02987     }
02988 
02994     public function getBreadCrumb()
02995     {
02996         return null;
02997     }
02998 
03006     public function setRootCatChanged( $blRootCatChanged )
03007     {
03008         $this->_blRootCatChanged = $blRootCatChanged;
03009     }
03010 
03016     public function isRootCatChanged()
03017     {
03018         return $this->_blRootCatChanged;
03019     }
03020 
03026     public function getInvoiceAddress()
03027     {
03028         if ( $this->_aInvoiceAddress == null ) {
03029             $aAddress = oxConfig::getParameter( 'invadr');
03030             if ( $aAddress ) {
03031                 $this->_aInvoiceAddress = $aAddress;
03032             }
03033         }
03034         return $this->_aInvoiceAddress;
03035     }
03036 
03042     public function getDeliveryAddress()
03043     {
03044         if ( $this->_aDeliveryAddress == null ) {
03045             $aAddress = oxConfig::getParameter( 'deladr');
03046             if ( $aAddress ) {
03047                 $this->_aDeliveryAddress = $aAddress;
03048             }
03049         }
03050         return $this->_aDeliveryAddress;
03051     }
03052 
03060     public function setInvoiceAddress( $aAddress )
03061     {
03062         $this->_aInvoiceAddress = $aAddress;
03063     }
03064 
03070     public function getActiveUsername()
03071     {
03072         if ( $this->_sActiveUsername == null ) {
03073             $this->_sActiveUsername = false;
03074             $sUsername = oxConfig::getParameter( 'lgn_usr' );
03075             if ( $sUsername ) {
03076                 $this->_sActiveUsername = $sUsername;
03077             } elseif ( $oUser = $this->getUser() ) {
03078                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03079             }
03080         }
03081         return $this->_sActiveUsername;
03082     }
03083 
03089     public function getWishlistUserId()
03090     {
03091         return oxConfig::getParameter( 'wishid' );
03092     }
03093 
03099     public function getSearchCatId()
03100     {
03101     }
03102 
03108     public function getSearchVendor()
03109     {
03110     }
03111 
03117     public function getSearchManufacturer()
03118     {
03119     }
03120 
03126     public function getLastProducts()
03127     {
03128 
03129     }
03130 
03131 }