oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00007 // view indexing state for search engines:
00008 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00009 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00010 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00011 
00017 class oxUBase extends oxView
00018 {
00023     protected $_blFbWidgetsOn = null;
00024 
00029     protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
00030 
00036     protected $_oaComponents = array();
00037 
00043     protected $_blIsOrderStep = false;
00044 
00050     protected $_sListType = null;
00051 
00057     protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00058 
00064     protected $_sListDisplayType = null;
00065 
00071     protected $_sCustomListDisplayType = null;
00072 
00078     protected $_oActCategory = null;
00079 
00085     protected $_oActManufacturer = null;
00086 
00092     protected $_oActVendor = null;
00093 
00098     protected $_oActiveRecommList = null;
00099 
00105     protected $_oActSearch = null;
00106 
00111     protected $_blShowSorting = false;
00112 
00117     protected $_blLoadCurrency = null;
00118 
00123     protected $_blLoadManufacturerTree = null;
00124 
00129     protected $_blDontShowEmptyCats = null;
00130 
00135     protected $_blLoadLanguage = null;
00136 
00141     protected $_iTopCatNavItmCnt = null;
00142 
00147     protected $_aRssLinks = null;
00148 
00153     protected $_sListOrderBy = null;
00154 
00159     protected $_sListOrderDir = null;
00160 
00165     protected $_sMetaDescription = null;
00166 
00171     protected $_sMetaKeywords = null;
00172 
00178     protected $_sMetaDescriptionIdent = null;
00179 
00185     protected $_sMetaKeywordsIdent = null;
00186 
00191     protected $_sAdditionalParams = null;
00192 
00197     protected $_oActCurrency = null;
00198 
00203     protected $_blEnabledPrivateSales = null;
00204 
00211     protected $_blCommonAdded = false;
00212 
00219     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00220 
00227     protected $_blForceNoIndex = false;
00228 
00233     protected $_iCompItemsCnt = null;
00234 
00240     protected $_sContentId = null;
00241 
00247     protected $_oContent = null;
00248 
00254     protected $_sViewResetID = null;
00255 
00260     protected $_blActiveSorting = null;
00261 
00266     protected $_aMenueList = null;
00267 
00273     protected $_aComponentNames = array(
00274                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00275                                     'oxcmp_lang'       => 0,
00276                                     'oxcmp_cur'        => 1,
00277                                     'oxcmp_shop'       => 1,
00278                                     'oxcmp_categories' => 0,
00279                                     'oxcmp_utils'      => 1,
00280                                     'oxcmp_news'       => 0,
00281                                     'oxcmp_basket'     => 1
00282                                   );
00283 
00289     protected $_aUserComponentNames = array();
00290 
00296     protected $_oProduct = null;
00297 
00302     protected $_iActPage = null;
00303 
00308     protected $_aArticleList = null;
00309 
00314     protected $_oManufacturerTree  = null;
00315 
00320     protected $_oCategoryTree  = null;
00321 
00326     protected $_aTop5ArticleList  = null;
00327 
00332     protected $_aBargainArticleList  = null;
00333 
00338     protected $_blLowOrderPrice = null;
00339 
00344     protected $_sMinOrderPrice  = null;
00345 
00350     protected $_iNewsRealStatus  = null;
00351 
00357     protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00358 
00363     protected $_oRootVendor = null;
00364 
00369     protected $_sVendorId = null;
00370 
00375     protected $_aManufacturerlist = null;
00376 
00381     protected $_oRootManufacturer = null;
00382 
00387     protected $_sManufacturerId = null;
00388 
00393     protected $_aSearchCatTree = null;
00394 
00399     protected $_blNewsSubscribed = null;
00400 
00405     protected $_oDelAddress = null;
00406 
00411     protected $_sCatTreePath = null;
00412 
00417     protected $_aContents = array();
00418 
00423     protected $_blTop5Action = true;
00424 
00429     protected $_blBargainAction = false;
00430 
00436     protected $_aMustFillFields = null;
00437 
00442     protected $_blShowTagCloud = true;
00443 
00448     protected $_blRootCatChanged = false;
00449 
00454     protected $_aInvoiceAddress = null;
00455 
00460     protected $_aDeliveryAddress = null;
00461 
00466     protected $_sActiveUsername = null;
00467 
00473     protected static $_aCollectedComponentNames = null;
00474 
00481     protected $_blLoadComponents = true;
00482 
00488     protected function _getComponentNames()
00489     {
00490         if ( self::$_aCollectedComponentNames === null ) {
00491             self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00492 
00493             // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
00494             // so we added this array to config.inc.php file
00495             if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00496                 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00497             }
00498 
00499             if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00500                 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00501             }
00502         }
00503 
00504         // resetting array pointer
00505         reset( self::$_aCollectedComponentNames );
00506         return self::$_aCollectedComponentNames;
00507     }
00508 
00517     protected function _processRequest()
00518     {
00519         $myUtils = oxRegistry::getUtils();
00520 
00521         // non admin, request is not empty and was not processed by seo engine
00522         if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00523 
00524             // fetching standard url and looking for it in seo table
00525             if ( $this->_canRedirect() && ( $sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl( $sStdUrl ) ) ) {
00526                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00527             } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00528                 // forcing to set noindex/follow meta
00529                 $this->_forceNoIndex();
00530 
00531                 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00532                     $sShopId = $this->getConfig()->getShopId();
00533                     $sLangId = oxRegistry::getLang()->getBaseLanguage();
00534                     $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00535 
00536                     // logging "not found" url
00537                     $oDb = oxDb::getDb();
00538                     $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00539                                     values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00540                 }
00541             }
00542         }
00543     }
00544 
00551     public function init()
00552     {
00553         $this->_processRequest();
00554 
00555         // storing current view
00556         $blInit = true;
00557 
00558 
00559         // init all components if there are any
00560         if ( $this->_blLoadComponents ) {
00561             foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00562                 // do not override initiated components
00563                 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00564                     // component objects MUST be created to support user called functions
00565                     $oComponent = oxNew( $sComponentName );
00566                     $oComponent->setParent( $this );
00567                     $oComponent->setThisAction( $sComponentName );
00568                     $this->_oaComponents[$sComponentName] = $oComponent;
00569                 }
00570 
00571                 // do we really need to initiate them ?
00572                 if ( $blInit ) {
00573                     $this->_oaComponents[$sComponentName]->init();
00574 
00575                     // executing only is view does not have action method
00576                     if ( !method_exists( $this, $this->getFncName() ) ) {
00577                         $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00578                     }
00579                 }
00580             }
00581         }
00582 
00583         parent::init();
00584 
00585         // enable sorting ?
00586         if ( $this->showSorting() ) {
00587             $this->prepareSortColumns();
00588         }
00589     }
00590 
00597     public function getViewId()
00598     {
00599         if ( $this->_sViewId ) {
00600             return $this->_sViewId;
00601         }
00602 
00603         $myConfig = $this->getConfig();
00604         $iLang = oxRegistry::getLang()->getBaseLanguage();
00605         $iCur  = (int) $myConfig->getShopCurrency();
00606 
00607 
00608             $this->_sViewId =  "ox|$iLang|$iCur";
00609 
00610         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00611 
00612         // #0002866: external global viewID addition
00613         if (function_exists('customGetViewId')) {
00614             $oExtViewId = customGetViewId();
00615 
00616             if ($oExtViewId !== null) {
00617                 $this->_sViewId .= '|'.md5(serialize($oExtViewId));
00618             }
00619         }
00620 
00621         return $this->_sViewId;
00622     }
00623 
00624 
00630     public function showSorting()
00631     {
00632         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00633     }
00634 
00642     public function setComponents( $aComponents = null )
00643     {
00644         $this->_oaComponents = $aComponents;
00645     }
00646 
00652     public function getComponents()
00653     {
00654         return $this->_oaComponents;
00655     }
00656 
00664     public function getComponent( $sName )
00665     {
00666         if ( $sName != null ) {
00667             return $this->_oaComponents[$sName];
00668         }
00669     }
00677     public function setIsOrderStep( $blIsOrderStep = null )
00678     {
00679         $this->_blIsOrderStep = $blIsOrderStep;
00680     }
00681 
00687     public function getIsOrderStep()
00688     {
00689         return $this->_blIsOrderStep;
00690     }
00691 
00692 
00700     public function setActiveCategory( $oCategory )
00701     {
00702         $this->_oActCategory = $oCategory;
00703     }
00704 
00710     public function getActiveCategory()
00711     {
00712         return $this->_oActCategory;
00713     }
00714 
00720     public function getListType()
00721     {
00722         if ( $this->_sListType == null ) {
00723             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00724                 $this->_sListType = $sListType;
00725             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00726                 $this->_sListType = $sListType;
00727             }
00728         }
00729         return $this->_sListType;
00730     }
00731 
00737     public function getListDisplayType()
00738     {
00739         if ( $this->_sListDisplayType == null ) {
00740             $this->_sListDisplayType = $this->getCustomListDisplayType();
00741 
00742             if ( !$this->_sListDisplayType ) {
00743                 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00744             }
00745 
00746             $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00747 
00748             // writing to session
00749             if ( oxConfig::getParameter( 'ldtype' ) ) {
00750                 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00751             }
00752         }
00753         return $this->_sListDisplayType;
00754     }
00755 
00761     public function getCustomListDisplayType()
00762     {
00763         if ( $this->_sCustomListDisplayType == null ) {
00764             $this->_sCustomListDisplayType = oxConfig::getParameter( 'ldtype' );
00765 
00766             if ( !$this->_sCustomListDisplayType ) {
00767                 $this->_sCustomListDisplayType = oxSession::getVar( 'ldtype' );
00768             }
00769         }
00770         return $this->_sCustomListDisplayType;
00771     }
00772 
00780     public function setListType( $sType )
00781     {
00782         $this->_sListType = $sType;
00783         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00784     }
00785 
00791     public function loadCurrency()
00792     {
00793         if ( $this->_blLoadCurrency == null ) {
00794             $this->_blLoadCurrency = false;
00795             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00796                 $this->_blLoadCurrency = $blLoadCurrency;
00797             }
00798         }
00799         return $this->_blLoadCurrency;
00800     }
00801 
00807     public function dontShowEmptyCategories()
00808     {
00809         if ( $this->_blDontShowEmptyCats == null ) {
00810             $this->_blDontShowEmptyCats = false;
00811             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00812                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00813             }
00814         }
00815         return $this->_blDontShowEmptyCats;
00816     }
00817 
00823     public function showCategoryArticlesCount()
00824     {
00825         return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00826     }
00827 
00833     public function isLanguageLoaded()
00834     {
00835         if ( $this->_blLoadLanguage == null ) {
00836             $this->_blLoadLanguage = false;
00837             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00838                 $this->_blLoadLanguage = $blLoadLanguage;
00839             }
00840         }
00841         return $this->_blLoadLanguage;
00842     }
00843 
00849     public function getTopNavigationCatCnt()
00850     {
00851         if ( $this->_iTopCatNavItmCnt == null ) {
00852             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00853             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00854         }
00855         return $this->_iTopCatNavItmCnt;
00856     }
00857 
00867     public function addRssFeed($sTitle, $sUrl, $key = null)
00868     {
00869         if (!is_array($this->_aRssLinks)) {
00870             $this->_aRssLinks = array();
00871         }
00872 
00873         $sUrl = oxRegistry::get("oxUtilsUrl")->prepareUrlForNoSession($sUrl);
00874 
00875         if ($key === null) {
00876             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00877         } else {
00878             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00879         }
00880     }
00881 
00887     public function getSortOrderByParameterName()
00888     {
00889         return 'listorderby';
00890     }
00891 
00897     public function getSortOrderParameterName()
00898     {
00899         return 'listorder';
00900     }
00901 
00912     public function prepareSortColumns()
00913     {
00914         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00915         $aSortDir = array( 'desc', 'asc' );
00916         if ( count( $aSortColumns ) > 0 ) {
00917 
00918             $this->_blActiveSorting = true;
00919             $this->_aSortColumns = $aSortColumns;
00920 
00921             $sCnid = oxConfig::getParameter( 'cnid' );
00922 
00923 
00924             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
00925             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
00926 
00927             $oStr = getStr();
00928             if ( (!$sSortBy || !in_array( $oStr->strtolower($sSortBy), $aSortColumns) || !in_array( $oStr->strtolower($sSortDir), $aSortDir) ) && $aSorting = $this->getSorting( $sCnid ) ) {
00929                 $sSortBy  = $aSorting['sortby'];
00930                 $sSortDir = $aSorting['sortdir'];
00931             }
00932 
00933             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00934                  $sSortDir && oxRegistry::getUtils()->isValidAlpha( $sSortDir ) ) {
00935 
00936                 $this->_sListOrderBy  = $sSortBy;
00937                 $this->_sListOrderDir = $sSortDir;
00938 
00939                 // caching sorting config
00940                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00941             }
00942         }
00943     }
00944 
00950     public function getListOrderBy()
00951     {
00952         //if column is with table name split it
00953         $aColums = explode('.', $this->_sListOrderBy);
00954 
00955         if ( is_array($aColums) && count($aColums) > 1 ) {
00956            return $aColums[1];
00957         }
00958 
00959         return $this->_sListOrderBy;
00960     }
00961 
00967     public function getListOrderDirection()
00968     {
00969         return $this->_sListOrderDir;
00970     }
00971 
00979     public function setMetaDescription ( $sDescription )
00980     {
00981         return $this->_sMetaDescription = $sDescription;
00982     }
00983 
00991     public function setMetaKeywords( $sKeywords )
00992     {
00993         return $this->_sMetaKeywords = $sKeywords;
00994     }
00995 
01003     protected function _getMetaFromSeo( $sDataType )
01004     {
01005         $sOxid  = $this->_getSeoObjectId();
01006         $iLang  = oxRegistry::getLang()->getBaseLanguage();
01007         $sShop  = $this->getConfig()->getShopId();
01008 
01009         if ( $sOxid && oxRegistry::getUtils()->seoIsActive() &&
01010              ( $sKeywords = oxRegistry::get("oxSeoEncoder")->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01011             return $sKeywords;
01012         }
01013     }
01014 
01022     protected function _getMetaFromContent( $sMetaIdent )
01023     {
01024         if ( $sMetaIdent ) {
01025             $oContent = oxNew( 'oxcontent' );
01026             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01027                  $oContent->oxcontents__oxactive->value ) {
01028                 return getStr()->strip_tags( $oContent->oxcontents__oxcontent->value );
01029             }
01030         }
01031     }
01032 
01038     public function getMetaKeywords()
01039     {
01040         if ( $this->_sMetaKeywords === null ) {
01041             $this->_sMetaKeywords = false;
01042 
01043             // set special meta keywords ?
01044             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01045                 $this->_sMetaKeywords = $sKeywords;
01046             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01047                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01048             } else {
01049                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01050             }
01051         }
01052 
01053         return $this->_sMetaKeywords;
01054     }
01055 
01061     public function getMetaDescription()
01062     {
01063         if ( $this->_sMetaDescription === null ) {
01064             $this->_sMetaDescription = false;
01065 
01066             // set special meta description ?
01067             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01068                 $this->_sMetaDescription = $sDescription;
01069             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01070                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01071             } else {
01072                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01073             }
01074         }
01075 
01076         return $this->_sMetaDescription;
01077     }
01078 
01084     public function getActCurrency()
01085     {
01086         return $this->_oActCurrency;
01087     }
01088 
01096     public function setActCurrency( $oCur )
01097     {
01098         $this->_oActCurrency = $oCur;
01099     }
01100 
01106     public function getCompareItemCount()
01107     {
01108         if ( $this->_iCompItemsCnt === null ) {
01109             $aItems = oxSession::getVar('aFiltcompproducts');
01110             $this->_iCompItemsCnt = is_array($aItems)?count($aItems):0;
01111         }
01112         return $this->_iCompItemsCnt;
01113     }
01114 
01120     protected function _forceNoIndex()
01121     {
01122         $this->_blForceNoIndex = true;
01123     }
01124 
01131     public function noIndex()
01132     {
01133         if ( $this->_blForceNoIndex ) {
01134             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01135         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01136             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01137         } else {
01138             switch ( oxConfig::getParameter( 'fnc' ) ) {
01139                 case 'tocomparelist':
01140                 case 'tobasket':
01141                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01142                     break;
01143             }
01144         }
01145         return $this->_iViewIndexState;
01146     }
01147 
01153     public function isSortingActive()
01154     {
01155         return $this->_blActiveSorting;
01156     }
01157 
01163     public function getMenueList()
01164     {
01165         return $this->_aMenueList;
01166     }
01167 
01175     public function setMenueList( $aMenue )
01176     {
01177         $this->_aMenueList = $aMenue;
01178     }
01179 
01180 
01186     protected function _setNrOfArtPerPage()
01187     {
01188         $myConfig  = $this->getConfig();
01189 
01190         //setting default values to avoid possible errors showing article list
01191         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01192 
01193         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01194 
01195         // checking if all needed data is set
01196         switch ( $this->getListDisplayType() ) {
01197             case 'grid':
01198                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01199                 break;
01200             case 'line':
01201             case 'infogrid':
01202             default:
01203                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01204         }
01205 
01206         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01207             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01208         } else {
01209             $iNrofCatArticles = $aNrofCatArticles[0];
01210         }
01211 
01212         $oViewConf = $this->getViewConfig();
01213         //value from user input
01214         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01215             // M45 Possibility to push any "Show articles per page" number parameter
01216             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01217             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01218             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01219         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01220             // M45 Possibility to push any "Show articles per page" number parameter
01221             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01222             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01223             $iNrofCatArticles = $iSessArtPerPage;
01224         } else {
01225             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01226         }
01227 
01228         //setting number of articles per page to config value
01229         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01230     }
01231 
01237     protected function _getSeoObjectId()
01238     {
01239     }
01240 
01250     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01251     {
01252         if ( $sMeta ) {
01253 
01254             $oStr = getStr();
01255             if ( $iLength != -1 ) {
01256                 /* *
01257                  * performance - we dont need a huge amount of initial text.
01258                  * assume that effective text may be double longer than $iLength
01259                  * and simple turncate it
01260                  */
01261                 $iELength = ( $iLength * 2 );
01262                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01263             }
01264 
01265             // decoding html entities
01266             $sMeta = $oStr->html_entity_decode( $sMeta );
01267             // stripping HTML tags
01268             $sMeta = $oStr->strip_tags( $sMeta );
01269 
01270             // removing some special chars
01271             $sMeta = $oStr->cleanStr( $sMeta );
01272 
01273             // removing duplicate words
01274             if ( $blRemoveDuplicatedWords ) {
01275                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01276             }
01277 
01278             // some special cases
01279             $sMeta = str_replace( ' ,', ',', $sMeta );
01280             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01281             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01282             $sMeta = oxRegistry::get("oxUtilsString")->minimizeTruncateString( $sMeta, $iLength );
01283             $sMeta = $oStr->htmlspecialchars( $sMeta );
01284 
01285             return trim( $sMeta );
01286         }
01287     }
01288 
01297     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01298     {
01299 
01300         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01301 
01302         if ( $blRemoveDuplicatedWords ) {
01303             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01304         }
01305 
01306         // removing in admin defined strings
01307 
01308         /*if ( is_array( $aSkipTags ) && $sString ) {
01309             $oStr = getStr();
01310             foreach ( $aSkipTags as $sSkip ) {
01311                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01312                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01313                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01314                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01315             }
01316         }*/
01317 
01318         return trim( $sString );
01319     }
01320 
01329     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01330     {
01331         $oStr = getStr();
01332         if ( is_array( $aInput ) ) {
01333             $aInput = implode( " ", $aInput );
01334         }
01335 
01336         // removing some usually met characters..
01337         $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01338 
01339         // splitting by word
01340         $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01341 
01342         if ( $sCount = count( $aSkipTags ) ) {
01343             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01344                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01345             }
01346         }
01347         $sCount = count($aStrings);
01348         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01349             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01350             // removing in admin defined strings
01351             if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01352                 unset( $aStrings[$iNum] );
01353             }
01354         }
01355 
01356         // duplicates
01357         return implode( ', ', array_unique( $aStrings ) );
01358     }
01359 
01367     public function getNavigationParams()
01368     {
01369         $aParams['cnid'] = $this->getCategoryId();
01370         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01371 
01372         $aParams['listtype'] = $this->getListType();
01373         $aParams['ldtype'] = $this->getCustomListDisplayType();
01374         $aParams['actcontrol'] = $this->getClassName();
01375 
01376         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01377 
01378         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01379         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01380         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01381 
01382         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01383         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01384         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01385 
01386         return $aParams;
01387     }
01388 
01398     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01399     {
01400 
01401         $aSorting = oxSession::getVar( 'aSorting' );
01402         $aSorting[$sCnid]['sortby']  = $sSortBy;
01403         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01404 
01405         oxSession::setVar( 'aSorting', $aSorting );
01406     }
01407 
01415     public function getSorting( $sCnid )
01416     {
01417         $aSorting = oxSession::getVar( 'aSorting' );
01418 
01419         if ( isset( $aSorting[$sCnid] ) ) {
01420             return $aSorting[$sCnid];
01421         }
01422     }
01423 
01431     public function getSortingSql( $sCnid )
01432     {
01433         $aSorting = $this->getSorting( $sCnid );
01434         if ( is_array( $aSorting ) ) {
01435             return implode( " ", $aSorting );
01436         }
01437     }
01438 
01444     public function getTitleSuffix()
01445     {
01446         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01447     }
01448 
01454     public function getTitlePageSuffix()
01455     {
01456     }
01457 
01464     public function getTitlePrefix()
01465     {
01466         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01467     }
01468 
01469 
01470 
01479     protected function _getSubject( $iLang )
01480     {
01481         return null;
01482     }
01483 
01489     public function getDynUrlParams()
01490     {
01491         $sRet = '';
01492         $sListType = $this->getListType();
01493 
01494         switch ($sListType) {
01495             default:
01496                 break;
01497             case 'search':
01498                 $sRet .= "&amp;listtype={$sListType}";
01499                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01500                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01501                 }
01502 
01503                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid', true ) ) ) {
01504                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01505                 }
01506                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor', true ) ) ) {
01507                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01508                 }
01509                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer', true ) ) ) {
01510                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01511                 }
01512                 break;
01513             case 'tag':
01514                 $sRet .= "&amp;listtype={$sListType}";
01515                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', true ) ) ) {
01516                     $sRet .= "&amp;searchtag={$sParam}";
01517                 }
01518                 break;
01519         }
01520 
01521         return $sRet;
01522     }
01523 
01531     public function getLink( $iLang = null )
01532     {
01533         if ( !isset( $iLang ) ) {
01534             $iLang = oxRegistry::getLang()->getBaseLanguage();
01535         }
01536 
01537         $oDisplayObj = null;
01538         $blTrySeo = false;
01539         if ( oxRegistry::getUtils()->seoIsActive() ) {
01540             $blTrySeo = true;
01541             $oDisplayObj = $this->_getSubject( $iLang );
01542         }
01543         $iActPageNr = $this->getActPage();
01544 
01545         if ( $oDisplayObj ) {
01546             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01547         }
01548 
01549         $myConfig = $this->getConfig();
01550 
01551         if ( $blTrySeo ) {
01552             $oEncoder = oxRegistry::get("oxSeoEncoder");
01553             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01554                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01555             }
01556         }
01557 
01558         $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01559 
01560         // fallback to old non seo url
01561         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01562     }
01563 
01569     public function getCanonicalUrl()
01570     {
01571     }
01572 
01579     public function getSimilarRecommListIds()
01580     {
01581         return false;
01582     }
01589     public function getSearchParamForHtml()
01590     {
01591     }
01592 
01600     protected function _getRequestParams( $blAddPageNr  = true )
01601     {
01602         $sClass = $this->getClassName();
01603         $sFnc   = $this->getFncName();
01604 
01605         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01606         if ( in_array( $sFnc, $aFnc ) ) {
01607             $sFnc = '';
01608         }
01609 
01610         // #680
01611         $sURL = "cl={$sClass}";
01612         if ( $sFnc ) {
01613             $sURL .= "&amp;fnc={$sFnc}";
01614         }
01615         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01616             $sURL .= "&amp;cnid={$sVal}";
01617         }
01618         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01619             $sURL .= "&amp;mnid={$sVal}";
01620         }
01621         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01622             $sURL .= "&amp;anid={$sVal}";
01623         }
01624 
01625         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01626             $sURL .= "&amp;page={$sVal}";
01627         }
01628 
01629         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01630             $sURL .= "&amp;tpl={$sVal}";
01631         }
01632 
01633         if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01634             $sURL .= "&amp;oxloadid={$sVal}";
01635         }
01636 
01637         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01638         // don't include page number for navigation
01639         // it will be done in oxubase::generatePageNavigation
01640         if ( $blAddPageNr && $iPgNr > 0 ) {
01641             $sURL .= "&amp;pgNr={$iPgNr}";
01642         }
01643 
01644         // #1184M - specialchar search
01645         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01646             $sURL .= "&amp;searchparam={$sVal}";
01647         }
01648 
01649         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01650             $sURL .= "&amp;searchcnid={$sVal}";
01651         }
01652 
01653         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01654             $sURL .= "&amp;searchvendor={$sVal}";
01655         }
01656 
01657         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01658             $sURL .= "&amp;searchmanufacturer={$sVal}";
01659         }
01660 
01661         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01662             $sURL .= "&amp;searchrecomm={$sVal}";
01663         }
01664 
01665         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01666             $sURL .= "&amp;searchtag={$sVal}";
01667         }
01668 
01669         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01670             $sURL .= "&amp;recommid={$sVal}";
01671         }
01672 
01673         return $sURL;
01674     }
01675 
01681     protected function _getSeoRequestParams()
01682     {
01683         $sClass = $this->getClassName();
01684         $sFnc   = $this->getFncName();
01685 
01686         // #921 S
01687         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01688         if ( in_array( $sFnc, $aFnc ) ) {
01689             $sFnc = '';
01690         }
01691 
01692         // #680
01693         $sURL = "cl={$sClass}";
01694         if ( $sFnc ) {
01695             $sURL .= "&amp;fnc={$sFnc}";
01696         }
01697         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01698             $sURL .= "&amp;page={$sVal}";
01699         }
01700 
01701         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01702             $sURL .= "&amp;tpl={$sVal}";
01703         }
01704 
01705         if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01706             $sURL .= "&amp;oxloadid={$sVal}";
01707         }
01708 
01709         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01710         if ( $iPgNr > 0 ) {
01711             $sURL .= "&amp;pgNr={$iPgNr}";
01712         }
01713 
01714         return $sURL;
01715     }
01716 
01722     public function showSearch()
01723     {
01724         $blShow = true;
01725         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01726             $blShow = false;
01727         }
01728         return (int) $blShow;
01729     }
01730 
01736     public function getRssLinks()
01737     {
01738         return $this->_aRssLinks;
01739     }
01740 
01746     public function getSortColumns()
01747     {
01748         return $this->_aSortColumns;
01749     }
01750 
01756     public function getEditTags()
01757     {
01758     }
01759 
01765     public function getRecommSearch()
01766     {
01767     }
01768 
01774     public function getPaymentList()
01775     {
01776     }
01777 
01783     public function getActiveRecommList()
01784     {
01785         if ( $this->_oActiveRecommList === null ) {
01786             $this->_oActiveRecommList = false;
01787             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01788                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01789                 $this->_oActiveRecommList->load( $sOxid );
01790             }
01791         }
01792         return $this->_oActiveRecommList;
01793     }
01794 
01800     public function getAccessoires()
01801     {
01802     }
01803 
01809     public function getCrossSelling()
01810     {
01811     }
01812 
01818     public function getSimilarProducts()
01819     {
01820     }
01821 
01827     public function getAlsoBoughtTheseProducts()
01828     {
01829     }
01830 
01836     public function getArticleId()
01837     {
01838     }
01839 
01845     public function getTitle()
01846     {
01847         $sTranslationName = 'PAGE_TITLE_'.strtoupper($this->getConfig()->getActiveView()->getClassName());
01848         $sTranslated = oxRegistry::getLang()->translateString( $sTranslationName, oxRegistry::getLang()->getBaseLanguage(), false );
01849         return $sTranslationName == $sTranslated? null : $sTranslated;
01850     }
01851 
01857     public function getActiveLangAbbr()
01858     {
01859         // Performance
01860         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01861             return;
01862         }
01863 
01864         if ( !isset($this->_sActiveLangAbbr ) ) {
01865             $aLanguages = oxRegistry::getLang()->getLanguageArray();
01866             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01867                 if ( $oVal->selected ) {
01868                     $this->_sActiveLangAbbr = $oVal->abbr;
01869                     break;
01870                 }
01871             }
01872         }
01873 
01874         return $this->_sActiveLangAbbr;
01875     }
01876 
01884     public function addGlobalParams( $oShop = null)
01885     {
01886         $oViewConf = parent::addGlobalParams( $oShop );
01887 
01888         $this->_setNrOfArtPerPage();
01889 
01890         return $oViewConf;
01891     }
01892 
01898     public function getAdditionalParams()
01899     {
01900         if ( $this->_sAdditionalParams === null ) {
01901             // #1018A
01902             $this->_sAdditionalParams  = parent::getAdditionalParams();
01903             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01904 
01905             // #1834M - specialchar search
01906             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01907             if ( isset( $sSearchParamForLink ) ) {
01908                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01909             }
01910             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01911                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01912             }
01913             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01914                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01915             }
01916             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01917                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01918             }
01919             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01920                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01921             }
01922             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
01923                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
01924             }
01925             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
01926                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
01927             }
01928         }
01929 
01930         return $this->_sAdditionalParams;
01931     }
01932 
01938     public function generatePageNavigationUrl()
01939     {
01940         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
01941     }
01942 
01952     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
01953     {
01954         if ( $iPage ) {
01955             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
01956                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
01957             } else {
01958                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
01959             }
01960         } else {
01961            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
01962            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
01963            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
01964            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
01965         }
01966         return $sUrl;
01967     }
01968 
01974     public function getPageNavigation()
01975     {
01976 
01977     }
01978 
01984     public function getPageNavigationLimitedTop()
01985     {
01986 
01987         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
01988 
01989         return $this->_oPageNavigation;
01990     }
01991 
01997     public function getPageNavigationLimitedBottom()
01998     {
01999 
02000         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02001 
02002         return $this->_oPageNavigation;
02003     }
02004 
02005 
02013     public function generatePageNavigation( $iPositionCount = 0 )
02014     {
02015         startProfile('generatePageNavigation');
02016 
02017         $pageNavigation = new stdClass();
02018 
02019         $pageNavigation->NrOfPages = $this->_iCntPages;
02020         $iActPage = $this->getActPage();
02021         $pageNavigation->actPage   = $iActPage + 1;
02022         $sUrl = $this->generatePageNavigationUrl();
02023 
02024         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02025              $iStartNo = 2;
02026              $iFinishNo = $pageNavigation->NrOfPages;
02027              $bStart = false;
02028              $bFinish =false;
02029         } else {
02030             $iTmpVal = $iPositionCount - 3;
02031             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02032 
02033             // actual page is at the start
02034             if ( $pageNavigation->actPage <= $iTmpVal ) {
02035                 $iStartNo = 2;
02036                 $iFinishNo = $iTmpVal + 1;
02037                 $bStart = false;
02038                 $bFinish = true;
02039             // actual page is at the end
02040             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02041                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02042                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02043                 $bStart = true;
02044                 $bFinish = false;
02045             // actual page is in the midle
02046             } else {
02047                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02048                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02049                 $bStart = true;
02050                 $bFinish = true;
02051             }
02052         }
02053 
02054         if ( $iActPage > 0) {
02055             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02056         }
02057 
02058         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02059             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02060         }
02061 
02062         if ( $pageNavigation->NrOfPages > 1 ) {
02063 
02064             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02065 
02066                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02067                     $page = new stdClass();
02068                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02069                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02070                     $pageNavigation->changePage[$i] = $page;
02071                 }
02072             }
02073 
02074             // first/last one
02075             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02076             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02077         }
02078 
02079         stopProfile('generatePageNavigation');
02080 
02081         return $pageNavigation;
02082     }
02083 
02090     public function render()
02091     {
02092         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02093             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02094         }
02095 
02096         parent::render();
02097 
02098         if ( $this->getIsOrderStep() ) {
02099 
02100             // disabling navigation during order ...
02101             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02102                 $this->_iNewsRealStatus = 1;
02103                 $this->setShowNewsletter( 0 );
02104             }
02105         }
02106         return $this->_sThisTemplate;
02107     }
02108 
02114     public function getViewProduct()
02115     {
02116         return $this->getProduct();
02117     }
02118 
02126     public function setViewProduct( $oProduct )
02127     {
02128         $this->_oProduct = $oProduct;
02129     }
02130 
02136     public function getViewProductList()
02137     {
02138         return $this->_aArticleList;
02139     }
02140 
02146     public function getActPage()
02147     {
02148         if ( $this->_iActPage === null ) {
02149             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02150             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02151         }
02152         return $this->_iActPage;
02153     }
02154 
02162     public function getActTag()
02163     {
02164         if ( $this->_oActTag === null ) {
02165             $this->_oActTag = new stdClass();
02166             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02167             $oSeoEncoderTag = oxRegistry::get("oxSeoEncoderTag");
02168 
02169             $sLink = false;
02170             if ( oxRegistry::getUtils()->seoIsActive() ) {
02171                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxRegistry::getLang()->getBaseLanguage() );
02172             }
02173 
02174             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02175         }
02176         return $this->_oActTag;
02177     }
02178 
02186     public function getActVendor()
02187     {
02188         // if active vendor is not set yet - trying to load it from request params
02189         // this may be usefull when category component was unable to load active vendor
02190         // and we still need some object to mount navigation info
02191         if ( $this->_oActVendor === null ) {
02192             $this->_oActVendor = false;
02193             $sVendorId = oxConfig::getParameter( 'cnid' );
02194             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02195             $oVendor = oxNew( 'oxvendor' );
02196             if ( $oVendor->load( $sVendorId ) ) {
02197                 $this->_oActVendor = $oVendor;
02198             }
02199         }
02200 
02201         return $this->_oActVendor;
02202     }
02203 
02211     public function getActManufacturer()
02212     {
02213         // if active Manufacturer is not set yet - trying to load it from request params
02214         // this may be usefull when category component was unable to load active Manufacturer
02215         // and we still need some object to mount navigation info
02216         if ( $this->_oActManufacturer === null ) {
02217 
02218             $this->_oActManufacturer = false;
02219             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02220             $oManufacturer = oxNew( 'oxmanufacturer' );
02221             if ( $oManufacturer->load( $sManufacturerId ) ) {
02222                 $this->_oActManufacturer = $oManufacturer;
02223             }
02224         }
02225 
02226         return $this->_oActManufacturer;
02227     }
02228 
02236     public function setActVendor( $oVendor )
02237     {
02238         $this->_oActVendor = $oVendor;
02239     }
02240 
02248     public function setActManufacturer( $oManufacturer )
02249     {
02250         $this->_oActManufacturer = $oManufacturer;
02251     }
02252 
02258     public function getActSearch()
02259     {
02260         if ( $this->_oActSearch === null ) {
02261             $this->_oActSearch = new stdClass();
02262             $sUrl = $this->getConfig()->getShopHomeURL();
02263             $this->_oActSearch->link = "{$sUrl}cl=search";
02264         }
02265         return $this->_oActSearch;
02266     }
02267 
02273     public function getCategoryTree()
02274     {
02275         return $this->_oCategoryTree;
02276     }
02277 
02285     public function setCategoryTree( $oCatTree )
02286     {
02287         $this->_oCategoryTree = $oCatTree;
02288     }
02289 
02295     public function getManufacturerTree()
02296     {
02297         return $this->_oManufacturerTree;
02298     }
02299 
02307     public function setManufacturerTree( $oManufacturerTree )
02308     {
02309         $this->_oManufacturerTree = $oManufacturerTree;
02310     }
02311 
02317     public function getAddUrlParams()
02318     {
02319     }
02320 
02327     public function getTop5ArticleList()
02328     {
02329         if ( $this->_blTop5Action ) {
02330             if ( $this->_aTop5ArticleList === null ) {
02331                 $this->_aTop5ArticleList = false;
02332                 $myConfig = $this->getConfig();
02333                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02334                     // top 5 articles
02335                     $oArtList = oxNew( 'oxarticlelist' );
02336                     $oArtList->loadTop5Articles();
02337                     if ( $oArtList->count() ) {
02338                         $this->_aTop5ArticleList = $oArtList;
02339                     }
02340                 }
02341             }
02342         }
02343         return $this->_aTop5ArticleList;
02344     }
02345 
02352     public function getBargainArticleList()
02353     {
02354         if ( $this->_blBargainAction ) {
02355             if ( $this->_aBargainArticleList === null ) {
02356                 $this->_aBargainArticleList = array();
02357                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02358                     $oArtList = oxNew( 'oxarticlelist' );
02359                     $oArtList->loadActionArticles( 'OXBARGAIN' );
02360                     if ( $oArtList->count() ) {
02361                         $this->_aBargainArticleList = $oArtList;
02362                     }
02363                 }
02364             }
02365         }
02366         return $this->_aBargainArticleList;
02367     }
02368 
02375     public function isLowOrderPrice()
02376     {
02377         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02378             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02379         }
02380 
02381         return $this->_blLowOrderPrice;
02382     }
02383 
02389     public function getMinOrderPrice()
02390     {
02391         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02392             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02393             $this->_sMinOrderPrice = oxRegistry::getLang()->formatCurrency( $dMinOrderPrice );
02394         }
02395         return $this->_sMinOrderPrice;
02396     }
02397 
02403     public function getNewsRealStatus()
02404     {
02405         return $this->_iNewsRealStatus;
02406     }
02407 
02413     protected function _canRedirect()
02414     {
02415         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02416             if ( oxConfig::getParameter( $sParam ) !== null ) {
02417                 return false;
02418             }
02419         }
02420 
02421         return true;
02422     }
02423 
02429     public function getProduct()
02430     {
02431     }
02432 
02438     public function getManufacturerlist()
02439     {
02440         return $this->_aManufacturerlist;
02441     }
02442 
02450     public function setManufacturerlist( $aList )
02451     {
02452         $this->_aManufacturerlist = $aList;
02453     }
02454 
02462     public function setRootVendor( $oVendor )
02463     {
02464         $this->_oRootVendor = $oVendor;
02465     }
02466 
02472     public function getRootVendor()
02473     {
02474         return $this->_oRootVendor;
02475     }
02476 
02484     public function setRootManufacturer( $oManufacturer )
02485     {
02486         $this->_oRootManufacturer = $oManufacturer;
02487     }
02488 
02494     public function getRootManufacturer()
02495     {
02496         return $this->_oRootManufacturer;
02497     }
02498 
02504     public function getVendorId()
02505     {
02506         if ( $this->_sVendorId === null ) {
02507             $this->_sVendorId = false;
02508             if ( ( $oVendor = $this->getActVendor() ) ) {
02509                 $this->_sVendorId = $oVendor->getId();
02510             }
02511         }
02512         return $this->_sVendorId;
02513     }
02514 
02520     public function getManufacturerId()
02521     {
02522         if ( $this->_sManufacturerId === null ) {
02523             $this->_sManufacturerId = false;
02524             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02525                 $this->_sManufacturerId = $oManufacturer->getId();
02526             }
02527         }
02528         return $this->_sManufacturerId;
02529     }
02530 
02536     public function getSearchCatTree()
02537     {
02538         return $this->_aSearchCatTree;
02539     }
02540 
02548     public function setSearchCatTree( $aTree )
02549     {
02550         $this->_aSearchCatTree = $aTree;
02551     }
02552 
02558     public function getCatMoreUrl()
02559     {
02560         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02561     }
02562 
02568     public function getCatTreePath()
02569     {
02570         return $this->_sCatTreePath;
02571     }
02572 
02580     public function getContentByIdent( $sIdent )
02581     {
02582         if ( !isset( $this->_aContents[$sIdent] ) ) {
02583             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02584             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02585         }
02586         return $this->_aContents[$sIdent];
02587     }
02588 
02594     public function getContentCategory()
02595     {
02596         return false;
02597     }
02598 
02604     public function getMustFillFields()
02605     {
02606         if ( $this->_aMustFillFields === null ) {
02607             $this->_aMustFillFields = false;
02608 
02609             // passing must-be-filled-fields info
02610             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02611             if ( is_array( $aMustFillFields ) ) {
02612                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02613             }
02614         }
02615         return $this->_aMustFillFields;
02616     }
02617 
02625     public function isFieldRequired( $sField )
02626     {
02627         if ( $aMustFillFields = $this->getMustFillFields() ) {
02628             if ( isset( $aMustFillFields[$sField] ) ) {
02629                 return true;
02630             }
02631         }
02632 
02633         return false;
02634     }
02635 
02641     public function getFormId()
02642     {
02643         if ( $this->_sFormId === null ) {
02644             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02645             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02646         }
02647 
02648         return $this->_sFormId;
02649     }
02650 
02656     public function canAcceptFormData()
02657     {
02658         if ( $this->_blCanAcceptFormData === null ) {
02659             $this->_blCanAcceptFormData = false;
02660 
02661             $sFormId = oxConfig::getParameter( "uformid" );
02662             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02663 
02664             // testing if form and session ids matches
02665             if ( $sFormId && $sFormId === $sSessionFormId ) {
02666                 $this->_blCanAcceptFormData = true;
02667             }
02668 
02669             // regenerating form data
02670             $this->getFormId();
02671         }
02672         return $this->_blCanAcceptFormData;
02673     }
02674 
02680     public function getPromoFinishedList()
02681     {
02682         if (isset($this->_oPromoFinishedList)) {
02683             return $this->_oPromoFinishedList;
02684         }
02685         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02686         $this->_oPromoFinishedList->loadFinishedByCount(2);
02687         return $this->_oPromoFinishedList;
02688     }
02689 
02695     public function getPromoCurrentList()
02696     {
02697         if (isset($this->_oPromoCurrentList)) {
02698             return $this->_oPromoCurrentList;
02699         }
02700         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02701         $this->_oPromoCurrentList->loadCurrent();
02702         return $this->_oPromoCurrentList;
02703     }
02704 
02710     public function getPromoFutureList()
02711     {
02712         if (isset($this->_oPromoFutureList)) {
02713             return $this->_oPromoFutureList;
02714         }
02715         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02716         $this->_oPromoFutureList->loadFutureByCount(2);
02717         return $this->_oPromoFutureList;
02718     }
02719 
02725     public function getShowPromotionList()
02726     {
02727         if (isset($this->_blShowPromotions)) {
02728             return $this->_blShowPromotions;
02729         }
02730         $this->_blShowPromotions = false;
02731         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02732             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02733         }
02734         return $this->_blShowPromotions;
02735     }
02736 
02742     public function isEnabledPrivateSales()
02743     {
02744         if ( $this->_blEnabledPrivateSales === null ) {
02745             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
02746             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxRegistry::getUtils()->canPreview() ) !== null ) {
02747                 $this->_blEnabledPrivateSales = !$blCanPreview;
02748             }
02749         }
02750         return $this->_blEnabledPrivateSales;
02751     }
02752 
02758     public function getFieldValidationErrors()
02759     {
02760         return oxRegistry::get("oxInputValidator")->getFieldValidationErrors();
02761     }
02762 
02768     public function getBreadCrumb()
02769     {
02770         return null;
02771     }
02772 
02780     public function setRootCatChanged( $blRootCatChanged )
02781     {
02782         $this->_blRootCatChanged = $blRootCatChanged;
02783     }
02784 
02790     public function isRootCatChanged()
02791     {
02792         return $this->_blRootCatChanged;
02793     }
02794 
02800     public function getInvoiceAddress()
02801     {
02802         if ( $this->_aInvoiceAddress == null ) {
02803             $aAddress = oxConfig::getParameter( 'invadr');
02804             if ( $aAddress ) {
02805                 $this->_aInvoiceAddress = $aAddress;
02806             }
02807         }
02808         return $this->_aInvoiceAddress;
02809     }
02810 
02816     public function getDeliveryAddress()
02817     {
02818         if ( $this->_aDeliveryAddress == null ) {
02819             $aAddress = oxConfig::getParameter( 'deladr');
02820             //do not show deladr if address was reloaded
02821             if ( $aAddress && !oxConfig::getParameter( 'reloadaddress' )) {
02822                 $this->_aDeliveryAddress = $aAddress;
02823             }
02824         }
02825         return $this->_aDeliveryAddress;
02826     }
02827 
02835     public function setInvoiceAddress( $aAddress )
02836     {
02837         $this->_aInvoiceAddress = $aAddress;
02838     }
02839 
02845     public function getActiveUsername()
02846     {
02847         if ( $this->_sActiveUsername == null ) {
02848             $this->_sActiveUsername = false;
02849             $sUsername = oxConfig::getParameter( 'lgn_usr' );
02850             if ( $sUsername ) {
02851                 $this->_sActiveUsername = $sUsername;
02852             } elseif ( $oUser = $this->getUser() ) {
02853                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
02854             }
02855         }
02856         return $this->_sActiveUsername;
02857     }
02858 
02864     public function getWishlistUserId()
02865     {
02866         return oxConfig::getParameter( 'wishid' );
02867     }
02868 
02874     public function getSearchCatId()
02875     {
02876     }
02877 
02883     public function getSearchVendor()
02884     {
02885     }
02886 
02892     public function getSearchManufacturer()
02893     {
02894     }
02895 
02901     public function getLastProducts()
02902     {
02903 
02904     }
02905 
02911     public function getNewBasketItemMsgType()
02912     {
02913         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
02914     }
02915 
02923     public function isActive( $sName )
02924     {
02925         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
02926     }
02927 
02933     public function isFbWidgetVisible()
02934     {
02935         if ( $this->_blFbWidgetsOn === null ) {
02936             $oUtils = oxRegistry::get("oxUtilsServer");
02937 
02938             // reading ..
02939             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
02940         }
02941         return $this->_blFbWidgetsOn;
02942     }
02943 
02949     public function isEnabledDownloadableFiles()
02950     {
02951         return (bool) $this->getConfig()->getConfigParam( "blEnableDownloads" );
02952     }
02953 
02959     public function showRememberMe()
02960     {
02961         return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
02962     }
02963 
02970     public function isVatIncluded()
02971     {
02972         $blResult = true;
02973         $oUser = $this->getUser();
02974         $oConfig = $this->getConfig();
02975 
02976         if ( $oConfig->getConfigParam( 'blShowNetPrice' ) || $oConfig->getConfigParam( 'bl_perfCalcVatOnlyForBasketOrder' ) ) {
02977             $blResult = false;
02978         } elseif ( $oUser && $oUser->isPriceViewModeNetto() ) {
02979             $blResult = false;
02980         }
02981 
02982         return $blResult;
02983     }
02984 
02990     public function isPriceCalculated()
02991     {
02992         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadPrice' );
02993     }
02994 
03000     public function showTags()
03001     {
03002          return (bool) $this->_blShowTagCloud && $this->getConfig()->getConfigParam( "blShowTags" );
03003     }
03004 
03010     public function getWishlistName()
03011     {
03012         if ( $this->getUser() ) {
03013             $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
03014             if ( $sUserId ) {
03015                 $oWishUser = oxNew( 'oxuser' );
03016                 if ( $oWishUser->load( $sUserId ) ) {
03017                     return $oWishUser;
03018                 }
03019             }
03020         }
03021         return false;
03022     }
03023 
03024 }