00001 <?php
00002
00007
00008 define( 'VIEW_INDEXSTATE_INDEX', 0 );
00009 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 );
00010 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );
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
00262 protected $_blActiveSorting = null;
00263
00268 protected $_aMenueList = null;
00269
00275 protected $_aComponentNames = array(
00276 'oxcmp_user' => 1,
00277 'oxcmp_lang' => 0,
00278 'oxcmp_cur' => 1,
00279 'oxcmp_shop' => 1,
00280 'oxcmp_categories' => 0,
00281 'oxcmp_utils' => 1,
00282 'oxcmp_news' => 0,
00283 'oxcmp_basket' => 1
00284 );
00285
00291 protected $_aUserComponentNames = array();
00292
00298 protected $_oProduct = null;
00299
00304 protected $_iActPage = null;
00305
00310 protected $_aArticleList = null;
00311
00316 protected $_oManufacturerTree = null;
00317
00322 protected $_oCategoryTree = null;
00323
00328 protected $_aTop5ArticleList = null;
00329
00334 protected $_aBargainArticleList = null;
00335
00340 protected $_blLowOrderPrice = null;
00341
00346 protected $_sMinOrderPrice = null;
00347
00352 protected $_iNewsRealStatus = null;
00353
00359 protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00360
00365 protected $_oRootVendor = null;
00366
00371 protected $_sVendorId = null;
00372
00377 protected $_aManufacturerlist = null;
00378
00383 protected $_oRootManufacturer = null;
00384
00389 protected $_sManufacturerId = null;
00390
00395 protected $_aSearchCatTree = null;
00396
00401 protected $_blNewsSubscribed = null;
00402
00407 protected $_oDelAddress = null;
00408
00413 protected $_sCatTreePath = null;
00414
00419 protected $_aContents = array();
00420
00425 protected $_blTop5Action = true;
00426
00431 protected $_blBargainAction = false;
00432
00438 protected $_aMustFillFields = null;
00439
00444 protected $_blShowTagCloud = true;
00445
00450 protected $_blRootCatChanged = false;
00451
00456 protected $_aInvoiceAddress = null;
00457
00462 protected $_aDeliveryAddress = null;
00463
00468 protected $_sActiveUsername = null;
00469
00475 protected static $_aCollectedComponentNames = null;
00476
00483 protected $_blLoadComponents = true;
00484
00485
00491 protected $_aSortColumns = null;
00492
00498 protected function _getComponentNames()
00499 {
00500 if ( self::$_aCollectedComponentNames === null ) {
00501 self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00502
00503
00504
00505 if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00506 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00507 }
00508
00509 if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00510 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00511 }
00512 }
00513
00514
00515 reset( self::$_aCollectedComponentNames );
00516 return self::$_aCollectedComponentNames;
00517 }
00518
00527 protected function _processRequest()
00528 {
00529 $myUtils = oxRegistry::getUtils();
00530
00531
00532 if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00533
00534
00535 if ( $this->_canRedirect() && ( $sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl( $sStdUrl ) ) ) {
00536 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00537 } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00538
00539 $this->_forceNoIndex();
00540
00541 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00542 $sShopId = $this->getConfig()->getShopId();
00543 $sLangId = oxRegistry::getLang()->getBaseLanguage();
00544 $sIdent = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00545
00546
00547 $oDb = oxDb::getDb();
00548 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00549 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00550 }
00551 }
00552 }
00553 }
00554
00561 public function init()
00562 {
00563 $this->_processRequest();
00564
00565
00566 $blInit = true;
00567
00568
00569
00570 if ( $this->_blLoadComponents ) {
00571 foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00572
00573 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00574
00575 $oComponent = oxNew( $sComponentName );
00576 $oComponent->setParent( $this );
00577 $oComponent->setThisAction( $sComponentName );
00578 $this->_oaComponents[$sComponentName] = $oComponent;
00579 }
00580
00581
00582 if ( $blInit ) {
00583 $this->_oaComponents[$sComponentName]->init();
00584
00585
00586 if ( !method_exists( $this, $this->getFncName() ) ) {
00587 $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00588 }
00589 }
00590 }
00591 }
00592
00593 parent::init();
00594 }
00595
00602 public function getViewId()
00603 {
00604 if ( $this->_sViewId ) {
00605 return $this->_sViewId;
00606 }
00607
00608 $myConfig = $this->getConfig();
00609 $iLang = oxRegistry::getLang()->getBaseLanguage();
00610 $iCur = (int) $myConfig->getShopCurrency();
00611
00612
00613 $this->_sViewId = "ox|$iLang|$iCur";
00614
00615 $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00616
00617
00618 if ($myConfig->isSsl()) {
00619 $this->_sViewId .= "|ssl";
00620 }
00621
00622
00623 if (function_exists('customGetViewId')) {
00624 $oExtViewId = customGetViewId();
00625
00626 if ($oExtViewId !== null) {
00627 $this->_sViewId .= '|'.md5(serialize($oExtViewId));
00628 }
00629 }
00630 return $this->_sViewId;
00631 }
00632
00633
00639 public function showSorting()
00640 {
00641 return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00642 }
00643
00651 public function setComponents( $aComponents = null )
00652 {
00653 $this->_oaComponents = $aComponents;
00654 }
00655
00661 public function getComponents()
00662 {
00663 return $this->_oaComponents;
00664 }
00665
00673 public function getComponent( $sName )
00674 {
00675 if ( $sName != null ) {
00676 return $this->_oaComponents[$sName];
00677 }
00678 }
00686 public function setIsOrderStep( $blIsOrderStep = null )
00687 {
00688 $this->_blIsOrderStep = $blIsOrderStep;
00689 }
00690
00696 public function getIsOrderStep()
00697 {
00698 return $this->_blIsOrderStep;
00699 }
00700
00701
00709 public function setActiveCategory( $oCategory )
00710 {
00711 $this->_oActCategory = $oCategory;
00712 }
00713
00719 public function getActiveCategory()
00720 {
00721 return $this->_oActCategory;
00722 }
00723
00729 public function getListType()
00730 {
00731 if ( $this->_sListType == null ) {
00732 if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00733 $this->_sListType = $sListType;
00734 } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00735 $this->_sListType = $sListType;
00736 }
00737 }
00738 return $this->_sListType;
00739 }
00740
00746 public function getListDisplayType()
00747 {
00748 if ( $this->_sListDisplayType == null ) {
00749 $this->_sListDisplayType = $this->getCustomListDisplayType();
00750
00751 if ( !$this->_sListDisplayType ) {
00752 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00753 }
00754
00755 $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00756
00757
00758 if ( oxConfig::getParameter( 'ldtype' ) ) {
00759 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00760 }
00761 }
00762 return $this->_sListDisplayType;
00763 }
00764
00770 public function getCustomListDisplayType()
00771 {
00772 if ( $this->_sCustomListDisplayType == null ) {
00773 $this->_sCustomListDisplayType = oxConfig::getParameter( 'ldtype' );
00774
00775 if ( !$this->_sCustomListDisplayType ) {
00776 $this->_sCustomListDisplayType = oxSession::getVar( 'ldtype' );
00777 }
00778 }
00779 return $this->_sCustomListDisplayType;
00780 }
00781
00789 public function setListType( $sType )
00790 {
00791 $this->_sListType = $sType;
00792 $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00793 }
00794
00800 public function loadCurrency()
00801 {
00802 if ( $this->_blLoadCurrency == null ) {
00803 $this->_blLoadCurrency = false;
00804 if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00805 $this->_blLoadCurrency = $blLoadCurrency;
00806 }
00807 }
00808 return $this->_blLoadCurrency;
00809 }
00810
00816 public function dontShowEmptyCategories()
00817 {
00818 if ( $this->_blDontShowEmptyCats == null ) {
00819 $this->_blDontShowEmptyCats = false;
00820 if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00821 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00822 }
00823 }
00824 return $this->_blDontShowEmptyCats;
00825 }
00826
00832 public function showCategoryArticlesCount()
00833 {
00834 return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00835 }
00836
00842 public function isLanguageLoaded()
00843 {
00844 if ( $this->_blLoadLanguage == null ) {
00845 $this->_blLoadLanguage = false;
00846 if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00847 $this->_blLoadLanguage = $blLoadLanguage;
00848 }
00849 }
00850 return $this->_blLoadLanguage;
00851 }
00852
00858 public function getTopNavigationCatCnt()
00859 {
00860 if ( $this->_iTopCatNavItmCnt == null ) {
00861 $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00862 $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00863 }
00864 return $this->_iTopCatNavItmCnt;
00865 }
00866
00876 public function addRssFeed($sTitle, $sUrl, $key = null)
00877 {
00878 if (!is_array($this->_aRssLinks)) {
00879 $this->_aRssLinks = array();
00880 }
00881
00882 $sUrl = oxRegistry::get("oxUtilsUrl")->prepareUrlForNoSession($sUrl);
00883
00884 if ($key === null) {
00885 $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00886 } else {
00887 $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00888 }
00889 }
00890
00896 public function getSortOrderByParameterName()
00897 {
00898 return 'listorderby';
00899 }
00900
00906 public function getSortOrderParameterName()
00907 {
00908 return 'listorder';
00909 }
00910
00911
00917 public function getSortIdent()
00918 {
00919 return 'alist';
00920 }
00921
00927 public function getDefaultSorting()
00928 {
00929 $aSorting = array ( 'sortby' => 'oxtitle', 'sortdir' => 'asc' );
00930 return $aSorting;
00931 }
00932
00938 public function getUserSelectedSorting()
00939 {
00940 $aSorting = null;
00941 $oStr = getStr();
00942 $oConfig = oxRegistry::getConfig();
00943 $aSortDirections = array( 'desc', 'asc' );
00944 $aSortColumns = $this->getSortColumns();
00945
00946 $sSortBy = $oConfig->getParameter( $this->getSortOrderByParameterName() );
00947 $sSortDir = $oConfig->getParameter( $this->getSortOrderParameterName() );
00948
00949 if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00950 $sSortDir && oxRegistry::getUtils()->isValidAlpha( $sSortDir ) && in_array( $oStr->strtolower($sSortDir), $aSortDirections ) ) {
00951 $aSorting = array ( 'sortby' => $sSortBy, 'sortdir' => $sSortDir );
00952 }
00953
00954 return $aSorting;
00955 }
00956
00957
00965 public function getSavedSorting( $sSortIdent )
00966 {
00967 $aSorting = oxSession::getVar( 'aSorting' );
00968 if ( isset( $aSorting[$sSortIdent] ) ) {
00969 return $aSorting[$sSortIdent];
00970 }
00971 }
00972
00980 public function setListOrderBy( $sCulumn )
00981 {
00982 $this->_sListOrderBy = $sCulumn;
00983 }
00984
00992 public function setListOrderDirection( $sDirection )
00993 {
00994 $this->_sListOrderDir = $sDirection;
00995 }
00996
00997
00998
01011 public function prepareSortColumns()
01012 {
01013 $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01014 $aSortDir = array( 'desc', 'asc' );
01015 if ( count( $aSortColumns ) > 0 ) {
01016
01017 $this->_aSortColumns = $aSortColumns;
01018
01019 $sCnid = oxConfig::getParameter( 'cnid' );
01020
01021
01022 $sSortBy = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01023 $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01024
01025 $oStr = getStr();
01026 if ( (!$sSortBy || !in_array( $oStr->strtolower($sSortBy), $aSortColumns) || !in_array( $oStr->strtolower($sSortDir), $aSortDir) ) && $aSorting = $this->getSorting( $sCnid ) ) {
01027 $sSortBy = $aSorting['sortby'];
01028 $sSortDir = $aSorting['sortdir'];
01029 }
01030
01031 if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01032 $sSortDir && oxRegistry::getUtils()->isValidAlpha( $sSortDir ) ) {
01033
01034 $this->_sListOrderBy = $sSortBy;
01035 $this->_sListOrderDir = $sSortDir;
01036
01037
01038 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01039 }
01040 }
01041 }
01042
01048 public function getListOrderBy()
01049 {
01050
01051 $aColums = explode('.', $this->_sListOrderBy);
01052
01053 if ( is_array($aColums) && count($aColums) > 1 ) {
01054 return $aColums[1];
01055 }
01056
01057 return $this->_sListOrderBy;
01058 }
01059
01065 public function getListOrderDirection()
01066 {
01067 return $this->_sListOrderDir;
01068 }
01069
01077 public function setMetaDescription ( $sDescription )
01078 {
01079 return $this->_sMetaDescription = $sDescription;
01080 }
01081
01089 public function setMetaKeywords( $sKeywords )
01090 {
01091 return $this->_sMetaKeywords = $sKeywords;
01092 }
01093
01101 protected function _getMetaFromSeo( $sDataType )
01102 {
01103 $sOxid = $this->_getSeoObjectId();
01104 $iLang = oxRegistry::getLang()->getBaseLanguage();
01105 $sShop = $this->getConfig()->getShopId();
01106
01107 if ( $sOxid && oxRegistry::getUtils()->seoIsActive() &&
01108 ( $sKeywords = oxRegistry::get("oxSeoEncoder")->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01109 return $sKeywords;
01110 }
01111 }
01112
01120 protected function _getMetaFromContent( $sMetaIdent )
01121 {
01122 if ( $sMetaIdent ) {
01123 $oContent = oxNew( 'oxcontent' );
01124 if ( $oContent->loadByIdent( $sMetaIdent ) &&
01125 $oContent->oxcontents__oxactive->value ) {
01126 return getStr()->strip_tags( $oContent->oxcontents__oxcontent->value );
01127 }
01128 }
01129 }
01130
01136 public function getMetaKeywords()
01137 {
01138 if ( $this->_sMetaKeywords === null ) {
01139 $this->_sMetaKeywords = false;
01140
01141
01142 if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01143 $this->_sMetaKeywords = $sKeywords;
01144 } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01145 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01146 } else {
01147 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01148 }
01149 }
01150
01151 return $this->_sMetaKeywords;
01152 }
01153
01159 public function getMetaDescription()
01160 {
01161 if ( $this->_sMetaDescription === null ) {
01162 $this->_sMetaDescription = false;
01163
01164
01165 if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01166 $this->_sMetaDescription = $sDescription;
01167 } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01168 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01169 } else {
01170 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01171 }
01172 }
01173
01174 return $this->_sMetaDescription;
01175 }
01176
01182 public function getActCurrency()
01183 {
01184 return $this->_oActCurrency;
01185 }
01186
01194 public function setActCurrency( $oCur )
01195 {
01196 $this->_oActCurrency = $oCur;
01197 }
01198
01204 public function getCompareItemCount()
01205 {
01206 if ( $this->_iCompItemsCnt === null ) {
01207 $aItems = oxSession::getVar('aFiltcompproducts');
01208 $this->_iCompItemsCnt = is_array($aItems)?count($aItems):0;
01209 }
01210 return $this->_iCompItemsCnt;
01211 }
01212
01218 protected function _forceNoIndex()
01219 {
01220 $this->_blForceNoIndex = true;
01221 }
01222
01229 public function noIndex()
01230 {
01231 if ( $this->_blForceNoIndex ) {
01232 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01233 } elseif ( oxConfig::getParameter( 'cur' ) ) {
01234 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01235 } else {
01236 switch ( oxConfig::getParameter( 'fnc' ) ) {
01237 case 'tocomparelist':
01238 case 'tobasket':
01239 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01240 break;
01241 }
01242 }
01243 return $this->_iViewIndexState;
01244 }
01245
01253 public function isSortingActive()
01254 {
01255 return $this->_blActiveSorting;
01256 }
01257
01263 public function getMenueList()
01264 {
01265 return $this->_aMenueList;
01266 }
01267
01275 public function setMenueList( $aMenue )
01276 {
01277 $this->_aMenueList = $aMenue;
01278 }
01279
01280
01286 protected function _setNrOfArtPerPage()
01287 {
01288 $myConfig = $this->getConfig();
01289
01290
01291 $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01292
01293 $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01294
01295
01296 switch ( $this->getListDisplayType() ) {
01297 case 'grid':
01298 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01299 break;
01300 case 'line':
01301 case 'infogrid':
01302 default:
01303 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01304 }
01305
01306 if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01307 $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01308 } else {
01309 $iNrofCatArticles = $aNrofCatArticles[0];
01310 }
01311
01312 $oViewConf = $this->getViewConfig();
01313
01314 if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01315
01316 $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01317 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01318 oxSession::setVar( '_artperpage', $iNrofCatArticles );
01319 } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01320
01321 $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01322 $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01323 $iNrofCatArticles = $iSessArtPerPage;
01324 } else {
01325 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01326 }
01327
01328
01329 $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01330 }
01331
01337 protected function _getSeoObjectId()
01338 {
01339 }
01340
01350 protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01351 {
01352 if ( $sMeta ) {
01353
01354 $oStr = getStr();
01355 if ( $iLength != -1 ) {
01356
01357
01358
01359
01360
01361 $iELength = ( $iLength * 2 );
01362 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01363 }
01364
01365
01366 $sMeta = $oStr->html_entity_decode( $sMeta );
01367
01368 $sMeta = $oStr->strip_tags( $sMeta );
01369
01370
01371 $sMeta = $oStr->cleanStr( $sMeta );
01372
01373
01374 if ( $blRemoveDuplicatedWords ) {
01375 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01376 }
01377
01378
01379 $sMeta = str_replace( ' ,', ',', $sMeta );
01380 $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01381 $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01382 $sMeta = oxRegistry::get("oxUtilsString")->minimizeTruncateString( $sMeta, $iLength );
01383 $sMeta = $oStr->htmlspecialchars( $sMeta );
01384
01385 return trim( $sMeta );
01386 }
01387 }
01388
01397 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01398 {
01399
01400 $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01401
01402 if ( $blRemoveDuplicatedWords ) {
01403 $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01404 }
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418 return trim( $sString );
01419 }
01420
01429 protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01430 {
01431 $oStr = getStr();
01432 if ( is_array( $aInput ) ) {
01433 $aInput = implode( " ", $aInput );
01434 }
01435
01436
01437 $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01438
01439
01440 $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01441
01442 if ( $sCount = count( $aSkipTags ) ) {
01443 for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01444 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01445 }
01446 }
01447 $sCount = count($aStrings);
01448 for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01449 $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01450
01451 if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01452 unset( $aStrings[$iNum] );
01453 }
01454 }
01455
01456
01457 return implode( ', ', array_unique( $aStrings ) );
01458 }
01459
01467 public function getNavigationParams()
01468 {
01469 $aParams['cnid'] = $this->getCategoryId();
01470 $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01471
01472 $aParams['listtype'] = $this->getListType();
01473 $aParams['ldtype'] = $this->getCustomListDisplayType();
01474 $aParams['actcontrol'] = $this->getClassName();
01475
01476 $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01477
01478 $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01479 $aParams['searchparam'] = oxConfig::getParameter( 'searchparam', true );
01480 $aParams['searchtag'] = oxConfig::getParameter( 'searchtag', true );
01481
01482 $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01483 $aParams['searchcnid'] = oxConfig::getParameter( 'searchcnid' );
01484 $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01485
01486 return $aParams;
01487 }
01488
01498 public function setItemSorting( $sSortIdent, $sSortBy, $sSortDir = null )
01499 {
01500 $aSorting = oxSession::getVar( 'aSorting' );
01501 $aSorting[$sSortIdent]['sortby'] = $sSortBy;
01502 $aSorting[$sSortIdent]['sortdir'] = $sSortDir ? $sSortDir : null;
01503
01504 oxSession::setVar( 'aSorting', $aSorting );
01505 }
01506
01514 public function getSorting( $sSortIdent )
01515 {
01516 $aSorting = null;
01517
01518 if ( $aSorting = $this->getUserSelectedSorting() ) {
01519 $this->setItemSorting( $sSortIdent, $aSorting['sortby'], $aSorting['sortdir'] );
01520 } elseif ( !$aSorting = $this->getSavedSorting( $sSortIdent ) ) {
01521 $aSorting = $this->getDefaultSorting();
01522 }
01523
01524 if ( $aSorting ) {
01525 $this->setListOrderBy( $aSorting['sortby'] );
01526 $this->setListOrderDirection( $aSorting['sortdir'] );
01527 }
01528
01529 return $aSorting;
01530 }
01531
01539 public function getSortingSql( $sCnid )
01540 {
01541 $aSorting = $this->getSorting( $sCnid );
01542 if ( is_array( $aSorting ) ) {
01543 return implode( " ", $aSorting );
01544 }
01545 }
01546
01552 public function getTitleSuffix()
01553 {
01554 return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01555 }
01556
01562 public function getTitlePageSuffix()
01563 {
01564 }
01565
01572 public function getTitlePrefix()
01573 {
01574 return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01575 }
01576
01577
01578
01587 protected function _getSubject( $iLang )
01588 {
01589 return null;
01590 }
01591
01597 public function getDynUrlParams()
01598 {
01599 $sRet = '';
01600 $sListType = $this->getListType();
01601
01602 switch ($sListType) {
01603 default:
01604 break;
01605 case 'search':
01606 $sRet .= "&listtype={$sListType}";
01607 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01608 $sRet .= "&searchparam={$sSearchParamForLink}";
01609 }
01610
01611 if ( ( $sVar = oxConfig::getParameter( 'searchcnid', true ) ) ) {
01612 $sRet .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01613 }
01614 if ( ( $sVar = oxConfig::getParameter( 'searchvendor', true ) ) ) {
01615 $sRet .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01616 }
01617 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer', true ) ) ) {
01618 $sRet .= '&searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01619 }
01620 break;
01621 case 'tag':
01622 $sRet .= "&listtype={$sListType}";
01623 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', true ) ) ) {
01624 $sRet .= "&searchtag={$sParam}";
01625 }
01626 break;
01627 }
01628
01629 return $sRet;
01630 }
01631
01639 public function getLink( $iLang = null )
01640 {
01641 if ( !isset( $iLang ) ) {
01642 $iLang = oxRegistry::getLang()->getBaseLanguage();
01643 }
01644
01645 $oDisplayObj = null;
01646 $blTrySeo = false;
01647 if ( oxRegistry::getUtils()->seoIsActive() ) {
01648 $blTrySeo = true;
01649 $oDisplayObj = $this->_getSubject( $iLang );
01650 }
01651 $iActPageNr = $this->getActPage();
01652
01653 if ( $oDisplayObj ) {
01654 return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01655 }
01656
01657 $myConfig = $this->getConfig();
01658
01659 if ( $blTrySeo ) {
01660 $oEncoder = oxRegistry::get("oxSeoEncoder");
01661 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01662 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01663 }
01664 }
01665
01666 $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01667
01668
01669 return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01670 }
01671
01677 public function getCanonicalUrl()
01678 {
01679 }
01680
01687 public function getSimilarRecommListIds()
01688 {
01689 return false;
01690 }
01697 public function getSearchParamForHtml()
01698 {
01699 }
01700
01708 protected function _getRequestParams( $blAddPageNr = true )
01709 {
01710 $sClass = $this->getClassName();
01711 $sFnc = $this->getFncName();
01712
01713 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01714 if ( in_array( $sFnc, $aFnc ) ) {
01715 $sFnc = '';
01716 }
01717
01718
01719 $sURL = "cl={$sClass}";
01720 if ( $sFnc ) {
01721 $sURL .= "&fnc={$sFnc}";
01722 }
01723 if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01724 $sURL .= "&cnid={$sVal}";
01725 }
01726 if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01727 $sURL .= "&mnid={$sVal}";
01728 }
01729 if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01730 $sURL .= "&anid={$sVal}";
01731 }
01732
01733 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01734 $sURL .= "&page={$sVal}";
01735 }
01736
01737 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01738 $sURL .= "&tpl={$sVal}";
01739 }
01740
01741 if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01742 $sURL .= "&oxloadid={$sVal}";
01743 }
01744
01745 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01746
01747
01748 if ( $blAddPageNr && $iPgNr > 0 ) {
01749 $sURL .= "&pgNr={$iPgNr}";
01750 }
01751
01752
01753 if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01754 $sURL .= "&searchparam={$sVal}";
01755 }
01756
01757 if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01758 $sURL .= "&searchcnid={$sVal}";
01759 }
01760
01761 if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01762 $sURL .= "&searchvendor={$sVal}";
01763 }
01764
01765 if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01766 $sURL .= "&searchmanufacturer={$sVal}";
01767 }
01768
01769 if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01770 $sURL .= "&searchrecomm={$sVal}";
01771 }
01772
01773 if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01774 $sURL .= "&searchtag={$sVal}";
01775 }
01776
01777 if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01778 $sURL .= "&recommid={$sVal}";
01779 }
01780
01781 return $sURL;
01782 }
01783
01789 protected function _getSeoRequestParams()
01790 {
01791 $sClass = $this->getClassName();
01792 $sFnc = $this->getFncName();
01793
01794
01795 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01796 if ( in_array( $sFnc, $aFnc ) ) {
01797 $sFnc = '';
01798 }
01799
01800
01801 $sURL = "cl={$sClass}";
01802 if ( $sFnc ) {
01803 $sURL .= "&fnc={$sFnc}";
01804 }
01805 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01806 $sURL .= "&page={$sVal}";
01807 }
01808
01809 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01810 $sURL .= "&tpl={$sVal}";
01811 }
01812
01813 if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01814 $sURL .= "&oxloadid={$sVal}";
01815 }
01816
01817 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01818 if ( $iPgNr > 0 ) {
01819 $sURL .= "&pgNr={$iPgNr}";
01820 }
01821
01822 return $sURL;
01823 }
01824
01830 public function showSearch()
01831 {
01832 $blShow = true;
01833 if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01834 $blShow = false;
01835 }
01836 return (int) $blShow;
01837 }
01838
01844 public function getRssLinks()
01845 {
01846 return $this->_aRssLinks;
01847 }
01848
01854 public function getSortColumns()
01855 {
01856 if ( $this->_aSortColumns === null ) {
01857 $this->setSortColumns( $this->getConfig()->getConfigParam( 'aSortCols' ) );
01858 }
01859 return $this->_aSortColumns;
01860 }
01861
01862
01870 public function setSortColumns( $aSortColumns )
01871 {
01872 $this->_aSortColumns = $aSortColumns;
01873 }
01874
01880 public function getEditTags()
01881 {
01882 }
01883
01889 public function getRecommSearch()
01890 {
01891 }
01892
01898 public function getPaymentList()
01899 {
01900 }
01901
01907 public function getActiveRecommList()
01908 {
01909 if ( $this->_oActiveRecommList === null ) {
01910 $this->_oActiveRecommList = false;
01911 if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01912 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01913 $this->_oActiveRecommList->load( $sOxid );
01914 }
01915 }
01916 return $this->_oActiveRecommList;
01917 }
01918
01924 public function getAccessoires()
01925 {
01926 }
01927
01933 public function getCrossSelling()
01934 {
01935 }
01936
01942 public function getSimilarProducts()
01943 {
01944 }
01945
01951 public function getAlsoBoughtTheseProducts()
01952 {
01953 }
01954
01960 public function getArticleId()
01961 {
01962 }
01963
01969 public function getTitle()
01970 {
01971 $sTranslationName = 'PAGE_TITLE_'.strtoupper($this->getConfig()->getActiveView()->getClassName());
01972 $sTranslated = oxRegistry::getLang()->translateString( $sTranslationName, oxRegistry::getLang()->getBaseLanguage(), false );
01973 return $sTranslationName == $sTranslated? null : $sTranslated;
01974 }
01975
01981 public function getActiveLangAbbr()
01982 {
01983
01984 if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01985 return;
01986 }
01987
01988 if ( !isset($this->_sActiveLangAbbr ) ) {
01989 $aLanguages = oxRegistry::getLang()->getLanguageArray();
01990 while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01991 if ( $oVal->selected ) {
01992 $this->_sActiveLangAbbr = $oVal->abbr;
01993 break;
01994 }
01995 }
01996 }
01997
01998 return $this->_sActiveLangAbbr;
01999 }
02000
02008 public function addGlobalParams( $oShop = null)
02009 {
02010 $oViewConf = parent::addGlobalParams( $oShop );
02011
02012 $this->_setNrOfArtPerPage();
02013
02014 return $oViewConf;
02015 }
02016
02022 public function getAdditionalParams()
02023 {
02024 if ( $this->_sAdditionalParams === null ) {
02025
02026 $this->_sAdditionalParams = parent::getAdditionalParams();
02027 $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02028
02029
02030 $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02031 if ( isset( $sSearchParamForLink ) ) {
02032 $this->_sAdditionalParams .= "&searchparam={$sSearchParamForLink}";
02033 }
02034 if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02035 $this->_sAdditionalParams .= '&searchtag='.rawurlencode( rawurldecode( $sVar ) );
02036 }
02037 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02038 $this->_sAdditionalParams .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02039 }
02040 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02041 $this->_sAdditionalParams .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02042 }
02043 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02044 $this->_sAdditionalParams .= '&searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02045 }
02046 if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02047 $this->_sAdditionalParams .= '&cnid='.rawurlencode( rawurldecode( $sVar ) );
02048 }
02049 if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02050 $this->_sAdditionalParams .= '&mnid='.rawurlencode( rawurldecode( $sVar ) );
02051 }
02052 }
02053
02054 return $this->_sAdditionalParams;
02055 }
02056
02062 public function generatePageNavigationUrl()
02063 {
02064 return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02065 }
02066
02076 protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02077 {
02078 if ( $iPage ) {
02079 if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02080 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02081 } else {
02082 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&' ) . 'pgNr='.$iPage;
02083 }
02084 } else {
02085 $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02086 $sUrl = preg_replace('/\&\;\&\;/', '&', $sUrl);
02087 $sUrl = preg_replace('/\?\&\;/', '?', $sUrl);
02088 $sUrl = preg_replace('/\&\;$/', '', $sUrl);
02089 }
02090 return $sUrl;
02091 }
02092
02098 public function getPageNavigation()
02099 {
02100
02101 }
02102
02108 public function getPageNavigationLimitedTop()
02109 {
02110
02111 $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02112
02113 return $this->_oPageNavigation;
02114 }
02115
02121 public function getPageNavigationLimitedBottom()
02122 {
02123
02124 $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02125
02126 return $this->_oPageNavigation;
02127 }
02128
02129
02137 public function generatePageNavigation( $iPositionCount = 0 )
02138 {
02139 startProfile('generatePageNavigation');
02140
02141 $pageNavigation = new stdClass();
02142
02143 $pageNavigation->NrOfPages = $this->_iCntPages;
02144 $iActPage = $this->getActPage();
02145 $pageNavigation->actPage = $iActPage + 1;
02146 $sUrl = $this->generatePageNavigationUrl();
02147
02148 if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02149 $iStartNo = 2;
02150 $iFinishNo = $pageNavigation->NrOfPages;
02151 $bStart = false;
02152 $bFinish =false;
02153 } else {
02154 $iTmpVal = $iPositionCount - 3;
02155 $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02156
02157
02158 if ( $pageNavigation->actPage <= $iTmpVal ) {
02159 $iStartNo = 2;
02160 $iFinishNo = $iTmpVal + 1;
02161 $bStart = false;
02162 $bFinish = true;
02163
02164 } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02165 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02166 $iFinishNo = $pageNavigation->NrOfPages - 1;
02167 $bStart = true;
02168 $bFinish = false;
02169
02170 } else {
02171 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02172 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02173 $bStart = true;
02174 $bFinish = true;
02175 }
02176 }
02177
02178 if ( $iActPage > 0) {
02179 $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02180 }
02181
02182 if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02183 $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02184 }
02185
02186 if ( $pageNavigation->NrOfPages > 1 ) {
02187
02188 for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02189
02190 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02191 $page = new stdClass();
02192 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02193 $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02194 $pageNavigation->changePage[$i] = $page;
02195 }
02196 }
02197
02198
02199 $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02200 $pageNavigation->lastpage = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02201 }
02202
02203 stopProfile('generatePageNavigation');
02204
02205 return $pageNavigation;
02206 }
02207
02214 public function render()
02215 {
02216 foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02217 $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02218 }
02219
02220 parent::render();
02221
02222 if ( $this->getIsOrderStep() ) {
02223
02224
02225 if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02226 $this->_iNewsRealStatus = 1;
02227 $this->setShowNewsletter( 0 );
02228 }
02229 }
02230 return $this->_sThisTemplate;
02231 }
02232
02238 public function getViewProduct()
02239 {
02240 return $this->getProduct();
02241 }
02242
02250 public function setViewProduct( $oProduct )
02251 {
02252 $this->_oProduct = $oProduct;
02253 }
02254
02260 public function getViewProductList()
02261 {
02262 return $this->_aArticleList;
02263 }
02264
02270 public function getActPage()
02271 {
02272 if ( $this->_iActPage === null ) {
02273 $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02274 $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02275 }
02276 return $this->_iActPage;
02277 }
02278
02286 public function getActTag()
02287 {
02288 if ( $this->_oActTag === null ) {
02289 $this->_oActTag = new stdClass();
02290 $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02291 $oSeoEncoderTag = oxRegistry::get("oxSeoEncoderTag");
02292
02293 $sLink = false;
02294 if ( oxRegistry::getUtils()->seoIsActive() ) {
02295 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxRegistry::getLang()->getBaseLanguage() );
02296 }
02297
02298 $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02299 }
02300 return $this->_oActTag;
02301 }
02302
02310 public function getActVendor()
02311 {
02312
02313
02314
02315 if ( $this->_oActVendor === null ) {
02316 $this->_oActVendor = false;
02317 $sVendorId = oxConfig::getParameter( 'cnid' );
02318 $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02319 $oVendor = oxNew( 'oxvendor' );
02320 if ( $oVendor->load( $sVendorId ) ) {
02321 $this->_oActVendor = $oVendor;
02322 }
02323 }
02324
02325 return $this->_oActVendor;
02326 }
02327
02335 public function getActManufacturer()
02336 {
02337
02338
02339
02340 if ( $this->_oActManufacturer === null ) {
02341
02342 $this->_oActManufacturer = false;
02343 $sManufacturerId = oxConfig::getParameter( 'mnid' );
02344 $oManufacturer = oxNew( 'oxmanufacturer' );
02345 if ( $oManufacturer->load( $sManufacturerId ) ) {
02346 $this->_oActManufacturer = $oManufacturer;
02347 }
02348 }
02349
02350 return $this->_oActManufacturer;
02351 }
02352
02360 public function setActVendor( $oVendor )
02361 {
02362 $this->_oActVendor = $oVendor;
02363 }
02364
02372 public function setActManufacturer( $oManufacturer )
02373 {
02374 $this->_oActManufacturer = $oManufacturer;
02375 }
02376
02382 public function getActSearch()
02383 {
02384 if ( $this->_oActSearch === null ) {
02385 $this->_oActSearch = new stdClass();
02386 $sUrl = $this->getConfig()->getShopHomeURL();
02387 $this->_oActSearch->link = "{$sUrl}cl=search";
02388 }
02389 return $this->_oActSearch;
02390 }
02391
02397 public function getCategoryTree()
02398 {
02399 return $this->_oCategoryTree;
02400 }
02401
02409 public function setCategoryTree( $oCatTree )
02410 {
02411 $this->_oCategoryTree = $oCatTree;
02412 }
02413
02419 public function getManufacturerTree()
02420 {
02421 return $this->_oManufacturerTree;
02422 }
02423
02431 public function setManufacturerTree( $oManufacturerTree )
02432 {
02433 $this->_oManufacturerTree = $oManufacturerTree;
02434 }
02435
02441 public function getAddUrlParams()
02442 {
02443 }
02444
02451 public function getTop5ArticleList()
02452 {
02453 if ( $this->_blTop5Action ) {
02454 if ( $this->_aTop5ArticleList === null ) {
02455 $this->_aTop5ArticleList = false;
02456 $myConfig = $this->getConfig();
02457 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02458
02459 $oArtList = oxNew( 'oxarticlelist' );
02460 $oArtList->loadTop5Articles();
02461 if ( $oArtList->count() ) {
02462 $this->_aTop5ArticleList = $oArtList;
02463 }
02464 }
02465 }
02466 }
02467 return $this->_aTop5ArticleList;
02468 }
02469
02476 public function getBargainArticleList()
02477 {
02478 if ( $this->_blBargainAction ) {
02479 if ( $this->_aBargainArticleList === null ) {
02480 $this->_aBargainArticleList = array();
02481 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02482 $oArtList = oxNew( 'oxarticlelist' );
02483 $oArtList->loadActionArticles( 'OXBARGAIN' );
02484 if ( $oArtList->count() ) {
02485 $this->_aBargainArticleList = $oArtList;
02486 }
02487 }
02488 }
02489 }
02490 return $this->_aBargainArticleList;
02491 }
02492
02499 public function isLowOrderPrice()
02500 {
02501 if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02502 $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02503 }
02504
02505 return $this->_blLowOrderPrice;
02506 }
02507
02513 public function getMinOrderPrice()
02514 {
02515 if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02516 $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02517 $this->_sMinOrderPrice = oxRegistry::getLang()->formatCurrency( $dMinOrderPrice );
02518 }
02519 return $this->_sMinOrderPrice;
02520 }
02521
02527 public function getNewsRealStatus()
02528 {
02529 return $this->_iNewsRealStatus;
02530 }
02531
02537 protected function _canRedirect()
02538 {
02539 foreach ( $this->_aBlockRedirectParams as $sParam ) {
02540 if ( oxConfig::getParameter( $sParam ) !== null ) {
02541 return false;
02542 }
02543 }
02544
02545 return true;
02546 }
02547
02553 public function getProduct()
02554 {
02555 }
02556
02562 public function getManufacturerlist()
02563 {
02564 return $this->_aManufacturerlist;
02565 }
02566
02574 public function setManufacturerlist( $aList )
02575 {
02576 $this->_aManufacturerlist = $aList;
02577 }
02578
02586 public function setRootVendor( $oVendor )
02587 {
02588 $this->_oRootVendor = $oVendor;
02589 }
02590
02596 public function getRootVendor()
02597 {
02598 return $this->_oRootVendor;
02599 }
02600
02608 public function setRootManufacturer( $oManufacturer )
02609 {
02610 $this->_oRootManufacturer = $oManufacturer;
02611 }
02612
02618 public function getRootManufacturer()
02619 {
02620 return $this->_oRootManufacturer;
02621 }
02622
02628 public function getVendorId()
02629 {
02630 if ( $this->_sVendorId === null ) {
02631 $this->_sVendorId = false;
02632 if ( ( $oVendor = $this->getActVendor() ) ) {
02633 $this->_sVendorId = $oVendor->getId();
02634 }
02635 }
02636 return $this->_sVendorId;
02637 }
02638
02644 public function getManufacturerId()
02645 {
02646 if ( $this->_sManufacturerId === null ) {
02647 $this->_sManufacturerId = false;
02648 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02649 $this->_sManufacturerId = $oManufacturer->getId();
02650 }
02651 }
02652 return $this->_sManufacturerId;
02653 }
02654
02660 public function getSearchCatTree()
02661 {
02662 return $this->_aSearchCatTree;
02663 }
02664
02672 public function setSearchCatTree( $aTree )
02673 {
02674 $this->_aSearchCatTree = $aTree;
02675 }
02676
02682 public function getCatMoreUrl()
02683 {
02684 return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02685 }
02686
02692 public function getCatTreePath()
02693 {
02694 return $this->_sCatTreePath;
02695 }
02696
02704 public function getContentByIdent( $sIdent )
02705 {
02706 if ( !isset( $this->_aContents[$sIdent] ) ) {
02707 $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02708 $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02709 }
02710 return $this->_aContents[$sIdent];
02711 }
02712
02718 public function getContentCategory()
02719 {
02720 return false;
02721 }
02722
02728 public function getMustFillFields()
02729 {
02730 if ( $this->_aMustFillFields === null ) {
02731 $this->_aMustFillFields = false;
02732
02733
02734 $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02735 if ( is_array( $aMustFillFields ) ) {
02736 $this->_aMustFillFields = array_flip( $aMustFillFields );
02737 }
02738 }
02739 return $this->_aMustFillFields;
02740 }
02741
02749 public function isFieldRequired( $sField )
02750 {
02751 if ( $aMustFillFields = $this->getMustFillFields() ) {
02752 if ( isset( $aMustFillFields[$sField] ) ) {
02753 return true;
02754 }
02755 }
02756
02757 return false;
02758 }
02759
02765 public function getFormId()
02766 {
02767 if ( $this->_sFormId === null ) {
02768 $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02769 oxSession::setVar( 'sessionuformid', $this->_sFormId );
02770 }
02771
02772 return $this->_sFormId;
02773 }
02774
02780 public function canAcceptFormData()
02781 {
02782 if ( $this->_blCanAcceptFormData === null ) {
02783 $this->_blCanAcceptFormData = false;
02784
02785 $sFormId = oxConfig::getParameter( "uformid" );
02786 $sSessionFormId = oxSession::getVar( "sessionuformid" );
02787
02788
02789 if ( $sFormId && $sFormId === $sSessionFormId ) {
02790 $this->_blCanAcceptFormData = true;
02791 }
02792
02793
02794 $this->getFormId();
02795 }
02796 return $this->_blCanAcceptFormData;
02797 }
02798
02804 public function getPromoFinishedList()
02805 {
02806 if (isset($this->_oPromoFinishedList)) {
02807 return $this->_oPromoFinishedList;
02808 }
02809 $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02810 $this->_oPromoFinishedList->loadFinishedByCount(2);
02811 return $this->_oPromoFinishedList;
02812 }
02813
02819 public function getPromoCurrentList()
02820 {
02821 if (isset($this->_oPromoCurrentList)) {
02822 return $this->_oPromoCurrentList;
02823 }
02824 $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02825 $this->_oPromoCurrentList->loadCurrent();
02826 return $this->_oPromoCurrentList;
02827 }
02828
02834 public function getPromoFutureList()
02835 {
02836 if (isset($this->_oPromoFutureList)) {
02837 return $this->_oPromoFutureList;
02838 }
02839 $this->_oPromoFutureList = oxNew( 'oxActionList' );
02840 $this->_oPromoFutureList->loadFutureByCount(2);
02841 return $this->_oPromoFutureList;
02842 }
02843
02849 public function getShowPromotionList()
02850 {
02851 if (isset($this->_blShowPromotions)) {
02852 return $this->_blShowPromotions;
02853 }
02854 $this->_blShowPromotions = false;
02855 if (oxNew('oxActionList')->areAnyActivePromotions()) {
02856 $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02857 }
02858 return $this->_blShowPromotions;
02859 }
02860
02866 public function isEnabledPrivateSales()
02867 {
02868 if ( $this->_blEnabledPrivateSales === null ) {
02869 $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
02870 if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxRegistry::getUtils()->canPreview() ) !== null ) {
02871 $this->_blEnabledPrivateSales = !$blCanPreview;
02872 }
02873 }
02874 return $this->_blEnabledPrivateSales;
02875 }
02876
02882 public function getFieldValidationErrors()
02883 {
02884 return oxRegistry::get("oxInputValidator")->getFieldValidationErrors();
02885 }
02886
02892 public function getBreadCrumb()
02893 {
02894 return null;
02895 }
02896
02904 public function setRootCatChanged( $blRootCatChanged )
02905 {
02906 $this->_blRootCatChanged = $blRootCatChanged;
02907 }
02908
02914 public function isRootCatChanged()
02915 {
02916 return $this->_blRootCatChanged;
02917 }
02918
02924 public function getInvoiceAddress()
02925 {
02926 if ( $this->_aInvoiceAddress == null ) {
02927 $aAddress = oxConfig::getParameter( 'invadr');
02928 if ( $aAddress ) {
02929 $this->_aInvoiceAddress = $aAddress;
02930 }
02931 }
02932 return $this->_aInvoiceAddress;
02933 }
02934
02940 public function getDeliveryAddress()
02941 {
02942 if ( $this->_aDeliveryAddress == null ) {
02943 $oConfig = $this->getConfig();
02944
02945 if ( !$oConfig->getRequestParameter( 'reloadaddress' ) ) {
02946 $this->_aDeliveryAddress = $oConfig->getRequestParameter( 'deladr');
02947 }
02948 }
02949 return $this->_aDeliveryAddress;
02950 }
02951
02959 public function setDeliveryAddress($aDeliveryAddress)
02960 {
02961 $this->_aDeliveryAddress = $aDeliveryAddress;
02962 }
02963
02971 public function setInvoiceAddress( $aAddress )
02972 {
02973 $this->_aInvoiceAddress = $aAddress;
02974 }
02975
02981 public function getActiveUsername()
02982 {
02983 if ( $this->_sActiveUsername == null ) {
02984 $this->_sActiveUsername = false;
02985 $sUsername = oxConfig::getParameter( 'lgn_usr' );
02986 if ( $sUsername ) {
02987 $this->_sActiveUsername = $sUsername;
02988 } elseif ( $oUser = $this->getUser() ) {
02989 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
02990 }
02991 }
02992 return $this->_sActiveUsername;
02993 }
02994
03000 public function getWishlistUserId()
03001 {
03002 return oxConfig::getParameter( 'wishid' );
03003 }
03004
03010 public function getSearchCatId()
03011 {
03012 }
03013
03019 public function getSearchVendor()
03020 {
03021 }
03022
03028 public function getSearchManufacturer()
03029 {
03030 }
03031
03037 public function getLastProducts()
03038 {
03039
03040 }
03041
03047 public function getNewBasketItemMsgType()
03048 {
03049 return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03050 }
03051
03059 public function isActive( $sName )
03060 {
03061 return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
03062 }
03063
03069 public function isFbWidgetVisible()
03070 {
03071 if ( $this->_blFbWidgetsOn === null ) {
03072 $oUtils = oxRegistry::get("oxUtilsServer");
03073
03074
03075 $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
03076 }
03077 return $this->_blFbWidgetsOn;
03078 }
03079
03085 public function isEnabledDownloadableFiles()
03086 {
03087 return (bool) $this->getConfig()->getConfigParam( "blEnableDownloads" );
03088 }
03089
03095 public function showRememberMe()
03096 {
03097 return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
03098 }
03099
03106 public function isVatIncluded()
03107 {
03108 $blResult = true;
03109 $oUser = $this->getUser();
03110 $oConfig = $this->getConfig();
03111
03112 if ( $oConfig->getConfigParam( 'blShowNetPrice' ) || $oConfig->getConfigParam( 'bl_perfCalcVatOnlyForBasketOrder' ) ) {
03113 $blResult = false;
03114 } elseif ( $oUser && $oUser->isPriceViewModeNetto() ) {
03115 $blResult = false;
03116 }
03117
03118 return $blResult;
03119 }
03120
03126 public function isPriceCalculated()
03127 {
03128 return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadPrice' );
03129 }
03130
03136 public function showTags()
03137 {
03138 return (bool) $this->_blShowTagCloud && $this->getConfig()->getConfigParam( "blShowTags" );
03139 }
03140
03146 public function getWishlistName()
03147 {
03148 if ( $this->getUser() ) {
03149 $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
03150 if ( $sUserId ) {
03151 $oWishUser = oxNew( 'oxuser' );
03152 if ( $oWishUser->load( $sUserId ) ) {
03153 return $oWishUser;
03154 }
03155 }
03156 }
03157 return false;
03158 }
03159
03160 }