00001 <?php
00002
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007
00008
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 );
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );
00012
00018 class oxUBase extends oxView
00019 {
00024 protected $_blFbWidgetsOn = null;
00025
00030 protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
00031
00037 protected $_oaComponents = array();
00038
00044 protected $_blIsOrderStep = false;
00045
00051 protected $_sListType = null;
00052
00058 protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00059
00065 protected $_sListDisplayType = null;
00066
00072 protected $_oActCategory = null;
00073
00079 protected $_oActManufacturer = null;
00080
00086 protected $_oActVendor = null;
00087
00092 protected $_oActiveRecommList = null;
00093
00099 protected $_oActSearch = null;
00100
00105 protected $_blShowSorting = false;
00106
00111 protected $_blShowRightBasket = null;
00112
00117 protected $_blShowTopBasket = null;
00118
00123 protected $_blShowLeftBasket = null;
00124
00129 protected $_blLoadCurrency = null;
00130
00135 protected $_blLoadVendorTree = null;
00136
00141 protected $_blLoadManufacturerTree = null;
00142
00147 protected $_blDontShowEmptyCats = null;
00148
00153 protected $_blLoadLanguage = null;
00154
00159 protected $_blShowTopCatNav = null;
00160
00165 protected $_iTopCatNavItmCnt = null;
00166
00171 protected $_aRssLinks = null;
00172
00177 protected $_sListOrderBy = null;
00178
00183 protected $_sListOrderDir = null;
00184
00189 protected $_sMetaDescription = null;
00190
00195 protected $_sMetaKeywords = null;
00196
00202 protected $_sMetaDescriptionIdent = null;
00203
00209 protected $_sMetaKeywordsIdent = null;
00210
00215 protected $_sAdditionalParams = null;
00216
00221 protected $_oActCurrency = null;
00222
00227 protected $_blEnabledPrivateSales = null;
00228
00235 protected $_blCommonAdded = false;
00236
00243 protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00244
00251 protected $_blForceNoIndex = false;
00252
00257 protected $_sWishlistName = null;
00258
00263 protected $_iCompItemsCnt = null;
00264
00270 protected $_sContentId = null;
00271
00277 protected $_oContent = null;
00278
00284 protected $_sViewResetID = null;
00285
00290 protected $_blActiveSorting = null;
00291
00296 protected $_aMenueList = null;
00297
00303 protected $_aComponentNames = array(
00304 'oxcmp_user' => 1,
00305 'oxcmp_lang' => 0,
00306 'oxcmp_cur' => 1,
00307 'oxcmp_shop' => 1,
00308 'oxcmp_categories' => 0,
00309 'oxcmp_utils' => 1,
00310 'oxcmp_news' => 0,
00311 'oxcmp_basket' => 1
00312 );
00313
00319 protected $_aUserComponentNames = array();
00320
00326 protected $_oProduct = null;
00327
00332 protected $_iActPage = null;
00333
00338 protected $_aArticleList = null;
00339
00344 protected $_oVendorTree = null;
00345
00350 protected $_oManufacturerTree = null;
00351
00356 protected $_oCategoryTree = null;
00357
00362 protected $_aTop5ArticleList = null;
00363
00368 protected $_aBargainArticleList = null;
00369
00374 protected $_blLowOrderPrice = null;
00375
00380 protected $_sMinOrderPrice = null;
00381
00386 protected $_iNewsRealStatus = null;
00387
00393 protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00394
00399 protected $_aVendorlist = null;
00400
00405 protected $_oRootVendor = null;
00406
00411 protected $_sVendorId = null;
00412
00417 protected $_aManufacturerlist = null;
00418
00423 protected $_oRootManufacturer = null;
00424
00429 protected $_sManufacturerId = null;
00430
00435 protected $_aSearchCatTree = null;
00436
00441 protected $_oCatMore = null;
00442
00447 protected $_blNewsSubscribed = null;
00448
00453 protected $_oDelAddress = null;
00454
00459 protected $_sCatTreePath = null;
00460
00465 protected $_aContents = array();
00466
00471 protected $_blTop5Action = true;
00472
00477 protected $_blBargainAction = false;
00478
00484 protected $_aMustFillFields = null;
00485
00490 protected $_blShowTagCloud = true;
00491
00496 protected $_blRootCatChanged = false;
00497
00502 protected $_aInvoiceAddress = null;
00503
00508 protected $_aDeliveryAddress = null;
00509
00514 protected $_sActiveUsername = null;
00515
00521 protected static $_aCollectedComponentNames = null;
00522
00528 protected function _getComponentNames()
00529 {
00530 if ( self::$_aCollectedComponentNames === null ) {
00531 self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00532
00533
00534
00535 if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00536 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00537 }
00538
00539 if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00540 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00541 }
00542 }
00543
00544
00545 reset( self::$_aCollectedComponentNames );
00546 return self::$_aCollectedComponentNames;
00547 }
00548
00557 protected function _processRequest()
00558 {
00559 $myUtils = oxUtils::getInstance();
00560
00561
00562 if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00563
00564
00565 if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00566 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00567 } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00568
00569 $this->_forceNoIndex();
00570
00571 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00572 $sShopId = $this->getConfig()->getShopId();
00573 $sLangId = oxLang::getInstance()->getBaseLanguage();
00574 $sIdent = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00575
00576
00577 $oDb = oxDb::getDb();
00578 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00579 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00580 }
00581 }
00582 }
00583 }
00584
00591 public function init()
00592 {
00593 $this->_processRequest();
00594
00595
00596 $blInit = true;
00597
00598
00599
00600 foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00601
00602 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00603
00604 $oComponent = oxNew( $sComponentName );
00605 $oComponent->setParent( $this );
00606 $oComponent->setThisAction( $sComponentName );
00607 $this->_oaComponents[$sComponentName] = $oComponent;
00608 }
00609
00610
00611 if ( $blInit ) {
00612 $this->_oaComponents[$sComponentName]->init();
00613
00614
00615 if ( !method_exists( $this, $this->getFncName() ) ) {
00616 $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00617 }
00618 }
00619 }
00620
00621 parent::init();
00622
00623
00624 if ( $this->showSorting() ) {
00625 $this->prepareSortColumns();
00626 }
00627 }
00628
00635 public function getViewId()
00636 {
00637 if ( $this->_sViewId ) {
00638 return $this->_sViewId;
00639 }
00640
00641 $myConfig = $this->getConfig();
00642 $iLang = oxLang::getInstance()->getBaseLanguage();
00643 $iCur = (int) $myConfig->getShopCurrency();
00644
00645
00646 $this->_sViewId = "ox|$iLang|$iCur";
00647
00648 $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00649
00650
00651 if (function_exists('customGetViewId')) {
00652 $oExtViewId = customGetViewId();
00653
00654 if ($oExtViewId !== null) {
00655 $this->_sViewId .= '|'.md5(serialize($oExtViewId));
00656 }
00657 }
00658
00659 return $this->_sViewId;
00660 }
00661
00662
00668 public function showSorting()
00669 {
00670 return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00671 }
00672
00680 public function setComponents( $aComponents = null )
00681 {
00682 $this->_oaComponents = $aComponents;
00683 }
00684
00690 public function getComponents()
00691 {
00692 return $this->_oaComponents;
00693 }
00694
00702 public function setIsOrderStep( $blIsOrderStep = null )
00703 {
00704 $this->_blIsOrderStep = $blIsOrderStep;
00705 }
00706
00712 public function getIsOrderStep()
00713 {
00714 return $this->_blIsOrderStep;
00715 }
00716
00717
00725 public function setActiveCategory( $oCategory )
00726 {
00727 $this->_oActCategory = $oCategory;
00728 }
00729
00735 public function getActiveCategory()
00736 {
00737 return $this->_oActCategory;
00738 }
00739
00745 public function getListType()
00746 {
00747 if ( $this->_sListType == null ) {
00748 if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00749 $this->_sListType = $sListType;
00750 } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00751 $this->_sListType = $sListType;
00752 }
00753 }
00754 return $this->_sListType;
00755 }
00756
00762 public function getListDisplayType()
00763 {
00764 if ( $this->_sListDisplayType == null ) {
00765 $this->_sListDisplayType = oxConfig::getParameter( 'ldtype' );
00766
00767 if ( !$this->_sListDisplayType ) {
00768 $this->_sListDisplayType = oxSession::getVar( 'ldtype' );
00769 }
00770
00771 if ( !$this->_sListDisplayType ) {
00772 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00773 }
00774
00775 $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00776
00777
00778 if ( oxConfig::getParameter( 'ldtype' ) ) {
00779 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00780 }
00781 }
00782 return $this->_sListDisplayType;
00783 }
00784
00792 public function setListType( $sType )
00793 {
00794 $this->_sListType = $sType;
00795 $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00796 }
00797
00803 public function showRightBasket()
00804 {
00805 if ( $this->_blShowRightBasket === null ) {
00806 if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00807 $this->_blShowRightBasket = $blShowRightBasket;
00808 }
00809 }
00810 return $this->_blShowRightBasket;
00811 }
00812
00820 public function setShowRightBasket( $blShowBasket )
00821 {
00822 $this->_blShowRightBasket = $blShowBasket;
00823 }
00824
00830 public function showLeftBasket()
00831 {
00832 if ( $this->_blShowLeftBasket === null ) {
00833 if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00834 $this->_blShowLeftBasket = $blShowLeftBasket;
00835 }
00836 }
00837 return $this->_blShowLeftBasket;
00838 }
00839
00847 public function setShowLeftBasket( $blShowBasket )
00848 {
00849 $this->_blShowLeftBasket = $blShowBasket;
00850 }
00851
00857 public function showTopBasket()
00858 {
00859 if ( $this->_blShowTopBasket === null ) {
00860 if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00861 $this->_blShowTopBasket = $blShowTopBasket;
00862 }
00863 }
00864 return $this->_blShowTopBasket;
00865 }
00866
00874 public function setShowTopBasket( $blShowBasket )
00875 {
00876 $this->_blShowTopBasket = $blShowBasket;
00877 }
00878
00884 public function loadCurrency()
00885 {
00886 if ( $this->_blLoadCurrency == null ) {
00887 $this->_blLoadCurrency = false;
00888 if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00889 $this->_blLoadCurrency = $blLoadCurrency;
00890 }
00891 }
00892 return $this->_blLoadCurrency;
00893 }
00894
00902 public function loadVendorTree()
00903 {
00904 if ( $this->_blLoadVendorTree == null ) {
00905 $this->_blLoadVendorTree = false;
00906 if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00907 $this->_blLoadVendorTree = $blLoadVendorTree;
00908 }
00909 }
00910 return $this->_blLoadVendorTree;
00911 }
00912
00918 public function loadManufacturerTree()
00919 {
00920 if ( $this->_blLoadManufacturerTree == null ) {
00921 $this->_blLoadManufacturerTree = false;
00922 if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00923 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00924 }
00925 }
00926 return $this->_blLoadManufacturerTree;
00927 }
00928
00934 public function dontShowEmptyCategories()
00935 {
00936 if ( $this->_blDontShowEmptyCats == null ) {
00937 $this->_blDontShowEmptyCats = false;
00938 if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00939 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00940 }
00941 }
00942 return $this->_blDontShowEmptyCats;
00943 }
00944
00950 public function showCategoryArticlesCount()
00951 {
00952 return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00953 }
00954
00960 public function isLanguageLoaded()
00961 {
00962 if ( $this->_blLoadLanguage == null ) {
00963 $this->_blLoadLanguage = false;
00964 if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00965 $this->_blLoadLanguage = $blLoadLanguage;
00966 }
00967 }
00968 return $this->_blLoadLanguage;
00969 }
00970
00976 public function showTopCatNavigation()
00977 {
00978 if ( $this->_blShowTopCatNav == null ) {
00979 $this->_blShowTopCatNav = false;
00980 if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00981 $this->_blShowTopCatNav = $blShowTopCatNav;
00982 }
00983 }
00984 return $this->_blShowTopCatNav;
00985 }
00986
00992 public function getTopNavigationCatCnt()
00993 {
00994 if ( $this->_iTopCatNavItmCnt == null ) {
00995 $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00996 $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00997 }
00998 return $this->_iTopCatNavItmCnt;
00999 }
01000
01010 public function addRssFeed($sTitle, $sUrl, $key = null)
01011 {
01012 if (!is_array($this->_aRssLinks)) {
01013 $this->_aRssLinks = array();
01014 }
01015 if ($key === null) {
01016 $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
01017 } else {
01018 $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
01019 }
01020 }
01021
01027 public function getSortOrderByParameterName()
01028 {
01029 return 'listorderby';
01030 }
01031
01037 public function getSortOrderParameterName()
01038 {
01039 return 'listorder';
01040 }
01041
01052 public function prepareSortColumns()
01053 {
01054 $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
01055 $aSortDir = array( 'desc', 'asc' );
01056 if ( count( $aSortColumns ) > 0 ) {
01057
01058 $this->_blActiveSorting = true;
01059 $this->_aSortColumns = $aSortColumns;
01060
01061 $sCnid = oxConfig::getParameter( 'cnid' );
01062
01063
01064 $sSortBy = oxConfig::getParameter( $this->getSortOrderByParameterName() );
01065 $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
01066
01067 $oStr = getStr();
01068 if ( (!$sSortBy || !in_array( $oStr->strtolower($sSortBy), $aSortColumns) || !in_array( $oStr->strtolower($sSortDir), $aSortDir) ) && $aSorting = $this->getSorting( $sCnid ) ) {
01069 $sSortBy = $aSorting['sortby'];
01070 $sSortDir = $aSorting['sortdir'];
01071 }
01072
01073 if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
01074 $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
01075
01076 $this->_sListOrderBy = $sSortBy;
01077 $this->_sListOrderDir = $sSortDir;
01078
01079
01080 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
01081 }
01082 }
01083 }
01084
01090 public function getListOrderBy()
01091 {
01092
01093 $aColums = explode('.', $this->_sListOrderBy);
01094
01095 if ( is_array($aColums) && count($aColums) > 1 ) {
01096 return $aColums[1];
01097 }
01098
01099 return $this->_sListOrderBy;
01100 }
01101
01107 public function getListOrderDirection()
01108 {
01109 return $this->_sListOrderDir;
01110 }
01111
01119 public function setMetaDescription ( $sDescription )
01120 {
01121 return $this->_sMetaDescription = $sDescription;
01122 }
01123
01131 public function setMetaKeywords( $sKeywords )
01132 {
01133 return $this->_sMetaKeywords = $sKeywords;
01134 }
01135
01143 protected function _getMetaFromSeo( $sDataType )
01144 {
01145 $sOxid = $this->_getSeoObjectId();
01146 $iLang = oxLang::getInstance()->getBaseLanguage();
01147 $sShop = $this->getConfig()->getShopId();
01148
01149 if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01150 ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01151 return $sKeywords;
01152 }
01153 }
01154
01162 protected function _getMetaFromContent( $sMetaIdent )
01163 {
01164 if ( $sMetaIdent ) {
01165 $oContent = oxNew( 'oxcontent' );
01166 if ( $oContent->loadByIdent( $sMetaIdent ) &&
01167 $oContent->oxcontents__oxactive->value ) {
01168 return strip_tags( $oContent->oxcontents__oxcontent->value );
01169 }
01170 }
01171 }
01172
01178 public function getMetaKeywords()
01179 {
01180 if ( $this->_sMetaKeywords === null ) {
01181 $this->_sMetaKeywords = false;
01182
01183
01184 if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01185 $this->_sMetaKeywords = $sKeywords;
01186 } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01187 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01188 } else {
01189 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01190 }
01191 }
01192
01193 return $this->_sMetaKeywords;
01194 }
01195
01201 public function getMetaDescription()
01202 {
01203 if ( $this->_sMetaDescription === null ) {
01204 $this->_sMetaDescription = false;
01205
01206
01207 if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01208 $this->_sMetaDescription = $sDescription;
01209 } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01210 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01211 } else {
01212 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01213 }
01214 }
01215
01216 return $this->_sMetaDescription;
01217 }
01218
01224 public function getActCurrency()
01225 {
01226 return $this->_oActCurrency;
01227 }
01228
01236 public function setActCurrency( $oCur )
01237 {
01238 $this->_oActCurrency = $oCur;
01239 }
01240
01246 public function getCompareItemsCnt()
01247 {
01248 return (int)$this->_iCompItemsCnt;
01249 }
01250
01258 public function setCompareItemsCnt( $iCount )
01259 {
01260 $this->_iCompItemsCnt = $iCount;
01261 }
01262
01268 public function getWishlistName()
01269 {
01270 return $this->_sWishlistName;
01271 }
01272
01280 public function setWishlistName( $sName )
01281 {
01282 $this->_sWishlistName = $sName;
01283 }
01284
01290 protected function _forceNoIndex()
01291 {
01292 $this->_blForceNoIndex = true;
01293 }
01294
01301 public function noIndex()
01302 {
01303 if ( $this->_blForceNoIndex ) {
01304 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01305 } elseif ( oxConfig::getParameter( 'cur' ) ) {
01306 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01307 } else {
01308 switch ( oxConfig::getParameter( 'fnc' ) ) {
01309 case 'tocomparelist':
01310 case 'tobasket':
01311 $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01312 break;
01313 }
01314 }
01315 return $this->_iViewIndexState;
01316 }
01317
01324 public function getContentId()
01325 {
01326 if ( $this->_sContentId === null) {
01327 $oContent = oxNew( 'oxcontent' );
01328 $oContent->loadByIdent( 'oximpressum' );
01329 $this->_sContentId = $oContent->getId();
01330 }
01331
01332 return $this->_sContentId;
01333 }
01334
01341 public function getContent()
01342 {
01343 if ( $this->_oContent === null) {
01344 $oContent = oxNew( 'oxcontent' );
01345 if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01346 $this->_oContent = $oContent;
01347 }
01348 }
01349
01350 return $this->_oContent;
01351 }
01352
01358 public function isSortingActive()
01359 {
01360 return $this->_blActiveSorting;
01361 }
01362
01368 public function getMenueList()
01369 {
01370 return $this->_aMenueList;
01371 }
01372
01380 public function setMenueList( $aMenue )
01381 {
01382 $this->_aMenueList = $aMenue;
01383 }
01384
01385
01391 protected function _setNrOfArtPerPage()
01392 {
01393 $myConfig = $this->getConfig();
01394
01395
01396 $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01397
01398 $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01399
01400
01401 switch ( $this->getListDisplayType() ) {
01402 case 'grid':
01403 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01404 break;
01405 case 'line':
01406 case 'infogrid':
01407 default:
01408 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01409 }
01410
01411 if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01412 $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01413 } else {
01414 $iNrofCatArticles = $aNrofCatArticles[0];
01415 }
01416
01417 $oViewConf = $this->getViewConfig();
01418
01419 if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01420
01421 $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01422 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01423 oxSession::setVar( '_artperpage', $iNrofCatArticles );
01424 } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01425
01426 $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01427 $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01428 $iNrofCatArticles = $iSessArtPerPage;
01429 } else {
01430 $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01431 }
01432
01433
01434 $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01435 }
01436
01442 protected function _getSeoObjectId()
01443 {
01444 }
01445
01455 protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01456 {
01457 if ( $sMeta ) {
01458
01459 $oStr = getStr();
01460 if ( $iLength != -1 ) {
01461
01462
01463
01464
01465
01466 $iELength = ( $iLength * 2 );
01467 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01468 }
01469
01470
01471 $sMeta = $oStr->html_entity_decode( $sMeta );
01472
01473 $sMeta = strip_tags( $sMeta );
01474
01475
01476 $sMeta = $oStr->cleanStr( $sMeta );
01477
01478
01479 if ( $blRemoveDuplicatedWords ) {
01480 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01481 }
01482
01483
01484 $sMeta = str_replace( ' ,', ',', $sMeta );
01485 $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01486 $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01487 $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01488
01489 return trim( $sMeta );
01490 }
01491 }
01492
01501 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01502 {
01503
01504 $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01505
01506 if ( $blRemoveDuplicatedWords ) {
01507 $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01508 }
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522 return trim( $sString );
01523 }
01524
01533 protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01534 {
01535 $oStr = getStr();
01536 if ( is_array( $aInput ) ) {
01537 $aInput = implode( " ", $aInput );
01538 }
01539
01540
01541 $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01542
01543
01544 $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01545
01546 if ( $sCount = count( $aSkipTags ) ) {
01547 for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01548 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01549 }
01550 }
01551 $sCount = count($aStrings);
01552 for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01553 $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01554
01555 if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01556 unset( $aStrings[$iNum] );
01557 }
01558 }
01559
01560
01561 return implode( ', ', array_unique( $aStrings ) );
01562 }
01563
01571 public function getNavigationParams()
01572 {
01573 $aParams['cnid'] = $this->getCategoryId();
01574 $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01575
01576 $aParams['listtype'] = $this->getListType();
01577 $aParams['ldtype'] = $this->getListDisplayType();
01578
01579 $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01580
01581 $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01582 $aParams['searchparam'] = oxConfig::getParameter( 'searchparam', true );
01583 $aParams['searchtag'] = oxConfig::getParameter( 'searchtag', true );
01584
01585 $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01586 $aParams['searchcnid'] = oxConfig::getParameter( 'searchcnid' );
01587 $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01588
01589 return $aParams;
01590 }
01591
01601 public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01602 {
01603
01604 $aSorting = oxSession::getVar( 'aSorting' );
01605 $aSorting[$sCnid]['sortby'] = $sSortBy;
01606 $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01607
01608 oxSession::setVar( 'aSorting', $aSorting );
01609 }
01610
01618 public function getSorting( $sCnid )
01619 {
01620 $aSorting = oxSession::getVar( 'aSorting' );
01621
01622 if ( isset( $aSorting[$sCnid] ) ) {
01623 return $aSorting[$sCnid];
01624 }
01625 }
01626
01634 public function getSortingSql( $sCnid )
01635 {
01636 $aSorting = $this->getSorting( $sCnid );
01637 if ( is_array( $aSorting ) ) {
01638 return implode( " ", $aSorting );
01639 }
01640 }
01641
01647 public function getTitleSuffix()
01648 {
01649 return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01650 }
01651
01657 public function getTitlePageSuffix()
01658 {
01659 }
01660
01667 public function getTitlePrefix()
01668 {
01669 return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01670 }
01671
01672
01673
01682 protected function _getSubject( $iLang )
01683 {
01684 return null;
01685 }
01686
01692 public function getDynUrlParams()
01693 {
01694 $sRet = '';
01695 $sListType = $this->getListType();
01696
01697 switch ($sListType) {
01698 default:
01699 break;
01700 case 'search':
01701 $sRet .= "&listtype={$sListType}";
01702 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01703 $sRet .= "&searchparam={$sSearchParamForLink}";
01704 }
01705
01706 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01707 $sRet .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01708 }
01709 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01710 $sRet .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01711 }
01712 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01713 $sRet .= '&searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01714 }
01715 break;
01716 case 'tag':
01717 $sRet .= "&listtype={$sListType}";
01718 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01719 $sRet .= "&searchtag={$sParam}";
01720 }
01721 break;
01722 }
01723
01724 return $sRet;
01725 }
01726
01734 public function getLink( $iLang = null )
01735 {
01736 if ( !isset( $iLang ) ) {
01737 $iLang = oxLang::getInstance()->getBaseLanguage();
01738 }
01739
01740 $oDisplayObj = null;
01741 $blTrySeo = false;
01742 if ( oxUtils::getInstance()->seoIsActive() ) {
01743 $blTrySeo = true;
01744 $oDisplayObj = $this->_getSubject( $iLang );
01745 }
01746 $iActPageNr = $this->getActPage();
01747
01748 if ( $oDisplayObj ) {
01749 return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01750 }
01751
01752 $myConfig = $this->getConfig();
01753
01754 if ( $blTrySeo ) {
01755 $oEncoder = oxSeoEncoder::getInstance();
01756 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01757 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01758 }
01759 }
01760
01761 $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01762
01763
01764 return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01765 }
01766
01772 public function getCanonicalUrl()
01773 {
01774 }
01775
01782 public function getSimilarRecommLists()
01783 {
01784 }
01785
01792 public function getSearchParamForHtml()
01793 {
01794 }
01795
01803 protected function _getRequestParams( $blAddPageNr = true )
01804 {
01805 $sClass = $this->getClassName();
01806 $sFnc = $this->getFncName();
01807
01808 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01809 if ( in_array( $sFnc, $aFnc ) ) {
01810 $sFnc = '';
01811 }
01812
01813
01814 $sURL = "cl={$sClass}";
01815 if ( $sFnc ) {
01816 $sURL .= "&fnc={$sFnc}";
01817 }
01818 if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01819 $sURL .= "&cnid={$sVal}";
01820 }
01821 if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01822 $sURL .= "&mnid={$sVal}";
01823 }
01824 if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01825 $sURL .= "&anid={$sVal}";
01826 }
01827
01828 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01829 $sURL .= "&page={$sVal}";
01830 }
01831
01832 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01833 $sURL .= "&tpl={$sVal}";
01834 }
01835
01836 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01837
01838
01839 if ( $blAddPageNr && $iPgNr > 0 ) {
01840 $sURL .= "&pgNr={$iPgNr}";
01841 }
01842
01843
01844 if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01845 $sURL .= "&searchparam={$sVal}";
01846 }
01847
01848 if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01849 $sURL .= "&searchcnid={$sVal}";
01850 }
01851
01852 if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01853 $sURL .= "&searchvendor={$sVal}";
01854 }
01855
01856 if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01857 $sURL .= "&searchmanufacturer={$sVal}";
01858 }
01859
01860 if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01861 $sURL .= "&searchrecomm={$sVal}";
01862 }
01863
01864 if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01865 $sURL .= "&searchtag={$sVal}";
01866 }
01867
01868 if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01869 $sURL .= "&recommid={$sVal}";
01870 }
01871
01872 return $sURL;
01873 }
01874
01880 protected function _getSeoRequestParams()
01881 {
01882 $sClass = $this->getClassName();
01883 $sFnc = $this->getFncName();
01884
01885
01886 $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01887 if ( in_array( $sFnc, $aFnc ) ) {
01888 $sFnc = '';
01889 }
01890
01891
01892 $sURL = "cl={$sClass}";
01893 if ( $sFnc ) {
01894 $sURL .= "&fnc={$sFnc}";
01895 }
01896 if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01897 $sURL .= "&page={$sVal}";
01898 }
01899
01900 if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01901 $sURL .= "&tpl={$sVal}";
01902 }
01903
01904 $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01905 if ( $iPgNr > 0 ) {
01906 $sURL .= "&pgNr={$iPgNr}";
01907 }
01908
01909 return $sURL;
01910 }
01911
01917 public function showSearch()
01918 {
01919 $blShow = true;
01920 if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01921 $blShow = false;
01922 }
01923 return (int) $blShow;
01924 }
01925
01931 public function getRssLinks()
01932 {
01933 return $this->_aRssLinks;
01934 }
01935
01941 public function getSortColumns()
01942 {
01943 return $this->_aSortColumns;
01944 }
01945
01951 public function getEditTags()
01952 {
01953 }
01954
01960 public function getRecommSearch()
01961 {
01962 }
01963
01969 public function getPaymentList()
01970 {
01971 }
01972
01978 public function getActiveRecommList()
01979 {
01980 if ( $this->_oActiveRecommList === null ) {
01981 $this->_oActiveRecommList = false;
01982 if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01983 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01984 $this->_oActiveRecommList->load( $sOxid );
01985 }
01986 }
01987 return $this->_oActiveRecommList;
01988 }
01989
01995 public function getAccessoires()
01996 {
01997 }
01998
02004 public function getCrossSelling()
02005 {
02006 }
02007
02013 public function getSimilarProducts()
02014 {
02015 }
02016
02022 public function getAlsoBoughtTheseProducts()
02023 {
02024 }
02025
02031 public function getArticleId()
02032 {
02033 }
02034
02040 public function isMoreTagsVisible()
02041 {
02042 return false;
02043 }
02044
02050 public function getTitle()
02051 {
02052 }
02053
02059 public function getActiveLangAbbr()
02060 {
02061
02062 if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
02063 return;
02064 }
02065
02066 if ( !isset($this->_sActiveLangAbbr ) ) {
02067 $aLanguages = oxLang::getInstance()->getLanguageArray();
02068 while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
02069 if ( $oVal->selected ) {
02070 $this->_sActiveLangAbbr = $oVal->abbr;
02071 break;
02072 }
02073 }
02074 }
02075
02076 return $this->_sActiveLangAbbr;
02077 }
02078
02086 public function addGlobalParams( $oShop = null)
02087 {
02088 $oViewConf = parent::addGlobalParams( $oShop );
02089
02090 $this->_setNrOfArtPerPage();
02091
02092 return $oViewConf;
02093 }
02094
02100 public function getAdditionalParams()
02101 {
02102 if ( $this->_sAdditionalParams === null ) {
02103
02104 $this->_sAdditionalParams = parent::getAdditionalParams();
02105 $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02106
02107
02108 $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02109 if ( isset( $sSearchParamForLink ) ) {
02110 $this->_sAdditionalParams .= "&searchparam={$sSearchParamForLink}";
02111 }
02112 if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02113 $this->_sAdditionalParams .= '&searchtag='.rawurlencode( rawurldecode( $sVar ) );
02114 }
02115 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02116 $this->_sAdditionalParams .= '&searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02117 }
02118 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02119 $this->_sAdditionalParams .= '&searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02120 }
02121 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02122 $this->_sAdditionalParams .= '&searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02123 }
02124 if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02125 $this->_sAdditionalParams .= '&cnid='.rawurlencode( rawurldecode( $sVar ) );
02126 }
02127 if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02128 $this->_sAdditionalParams .= '&mnid='.rawurlencode( rawurldecode( $sVar ) );
02129 }
02130 }
02131
02132 return $this->_sAdditionalParams;
02133 }
02134
02140 public function generatePageNavigationUrl()
02141 {
02142 return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02143 }
02144
02154 protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02155 {
02156 if ( $iPage ) {
02157 if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
02158 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
02159 } else {
02160 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&' ) . 'pgNr='.$iPage;
02161 }
02162 } else {
02163 $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
02164 $sUrl = preg_replace('/\&\;\&\;/', '&', $sUrl);
02165 $sUrl = preg_replace('/\?\&\;/', '?', $sUrl);
02166 $sUrl = preg_replace('/\&\;$/', '', $sUrl);
02167 }
02168 return $sUrl;
02169 }
02170
02176 public function getPageNavigation()
02177 {
02178
02179 }
02180
02186 public function getPageNavigationLimitedTop()
02187 {
02188
02189 $this->_oPageNavigation = $this->generatePageNavigation( 7 );
02190
02191 return $this->_oPageNavigation;
02192 }
02193
02199 public function getPageNavigationLimitedBottom()
02200 {
02201
02202 $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02203
02204 return $this->_oPageNavigation;
02205 }
02206
02207
02215 public function generatePageNavigation( $iPositionCount = 0 )
02216 {
02217 startProfile('generatePageNavigation');
02218
02219 $pageNavigation = new stdClass();
02220
02221 $pageNavigation->NrOfPages = $this->_iCntPages;
02222 $pageNavigation->iArtCnt = $this->_iAllArtCnt;
02223 $iActPage = $this->getActPage();
02224 $pageNavigation->actPage = $iActPage + 1;
02225 $sUrl = $this->generatePageNavigationUrl();
02226
02227 if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02228 $iStartNo = 2;
02229 $iFinishNo = $pageNavigation->NrOfPages;
02230 $bStart = false;
02231 $bFinish =false;
02232 } else {
02233 $iTmpVal = $iPositionCount - 3;
02234 $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02235
02236
02237 if ( $pageNavigation->actPage <= $iTmpVal ) {
02238 $iStartNo = 2;
02239 $iFinishNo = $iTmpVal + 1;
02240 $bStart = false;
02241 $bFinish = true;
02242
02243 } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02244 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02245 $iFinishNo = $pageNavigation->NrOfPages - 1;
02246 $bStart = true;
02247 $bFinish = false;
02248
02249 } else {
02250 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02251 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02252 $bStart = true;
02253 $bFinish = true;
02254 }
02255 }
02256
02257 if ( $iActPage > 0) {
02258 $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02259 }
02260
02261 if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02262 $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02263 }
02264
02265 if ( $pageNavigation->NrOfPages > 1 ) {
02266
02267 for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02268
02269 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02270 $page = new Oxstdclass();
02271 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02272 $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02273 $pageNavigation->changePage[$i] = $page;
02274 }
02275 }
02276
02277
02278 $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02279 $pageNavigation->lastpage = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02280 }
02281
02282 stopProfile('generatePageNavigation');
02283
02284 return $pageNavigation;
02285 }
02286
02292 public function getArticleCount()
02293 {
02294 return $this->_iAllArtCnt;
02295 }
02296
02303 public function render()
02304 {
02305 foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02306 $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02307 }
02308
02309 parent::render();
02310
02311 if ( $this->getIsOrderStep() ) {
02312
02313
02314 if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02315 $this->_iNewsRealStatus = 1;
02316 $this->setShowNewsletter( 0 );
02317 $this->setShowRightBasket( 0 );
02318 $this->setShowLeftBasket( 0 );
02319 $this->setShowTopBasket( 0 );
02320 }
02321 }
02322 return $this->_sThisTemplate;
02323 }
02324
02330 public function getViewProduct()
02331 {
02332 return $this->getProduct();
02333 }
02334
02342 public function setViewProduct( $oProduct )
02343 {
02344 $this->_oProduct = $oProduct;
02345 }
02346
02352 public function getViewProductList()
02353 {
02354 return $this->_aArticleList;
02355 }
02356
02362 public function getActPage()
02363 {
02364 if ( $this->_iActPage === null ) {
02365 $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02366 $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02367 }
02368 return $this->_iActPage;
02369 }
02370
02378 public function getActTag()
02379 {
02380 if ( $this->_oActTag === null ) {
02381 $this->_oActTag = new Oxstdclass();
02382 $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02383 $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02384
02385 $sLink = false;
02386 if ( oxUtils::getInstance()->seoIsActive() ) {
02387 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02388 }
02389
02390 $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02391 }
02392 return $this->_oActTag;
02393 }
02394
02402 public function getActVendor()
02403 {
02404
02405
02406
02407 if ( $this->_oActVendor === null ) {
02408 $this->_oActVendor = false;
02409 $sVendorId = oxConfig::getParameter( 'cnid' );
02410 $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02411 $oVendor = oxNew( 'oxvendor' );
02412 if ( $oVendor->load( $sVendorId ) ) {
02413 $this->_oActVendor = $oVendor;
02414 }
02415 }
02416
02417 return $this->_oActVendor;
02418 }
02419
02427 public function getActManufacturer()
02428 {
02429
02430
02431
02432 if ( $this->_oActManufacturer === null ) {
02433
02434 $this->_oActManufacturer = false;
02435 $sManufacturerId = oxConfig::getParameter( 'mnid' );
02436 $oManufacturer = oxNew( 'oxmanufacturer' );
02437 if ( $oManufacturer->load( $sManufacturerId ) ) {
02438 $this->_oActManufacturer = $oManufacturer;
02439 }
02440 }
02441
02442 return $this->_oActManufacturer;
02443 }
02444
02452 public function setActVendor( $oVendor )
02453 {
02454 $this->_oActVendor = $oVendor;
02455 }
02456
02464 public function setActManufacturer( $oManufacturer )
02465 {
02466 $this->_oActManufacturer = $oManufacturer;
02467 }
02468
02474 public function getActSearch()
02475 {
02476 if ( $this->_oActSearch === null ) {
02477 $this->_oActSearch = new oxStdClass();
02478 $sUrl = $this->getConfig()->getShopHomeURL();
02479 $this->_oActSearch->link = "{$sUrl}cl=search";
02480 }
02481 return $this->_oActSearch;
02482 }
02483
02489 public function getCategoryTree()
02490 {
02491 return $this->_oCategoryTree;
02492 }
02493
02501 public function setCategoryTree( $oCatTree )
02502 {
02503 $this->_oCategoryTree = $oCatTree;
02504 }
02505
02511 public function getVendorTree()
02512 {
02513 return $this->_oVendorTree;
02514 }
02515
02523 public function setVendorTree( $oVendorTree )
02524 {
02525 $this->_oVendorTree = $oVendorTree;
02526 }
02527
02533 public function getManufacturerTree()
02534 {
02535 return $this->_oManufacturerTree;
02536 }
02537
02545 public function setManufacturerTree( $oManufacturerTree )
02546 {
02547 $this->_oManufacturerTree = $oManufacturerTree;
02548 }
02549
02555 public function getAddUrlParams()
02556 {
02557 }
02558
02565 public function getTop5ArticleList()
02566 {
02567 if ( $this->_blTop5Action ) {
02568 if ( $this->_aTop5ArticleList === null ) {
02569 $this->_aTop5ArticleList = false;
02570 $myConfig = $this->getConfig();
02571 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02572
02573 $oArtList = oxNew( 'oxarticlelist' );
02574 $oArtList->loadTop5Articles();
02575 if ( $oArtList->count() ) {
02576 $this->_aTop5ArticleList = $oArtList;
02577 }
02578 }
02579 }
02580 }
02581 return $this->_aTop5ArticleList;
02582 }
02583
02590 public function getBargainArticleList()
02591 {
02592 if ( $this->_blBargainAction ) {
02593 if ( $this->_aBargainArticleList === null ) {
02594 $this->_aBargainArticleList = array();
02595 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02596 $oArtList = oxNew( 'oxarticlelist' );
02597 $oArtList->loadAktionArticles( 'OXBARGAIN' );
02598 if ( $oArtList->count() ) {
02599 $this->_aBargainArticleList = $oArtList;
02600 }
02601 }
02602 }
02603 }
02604 return $this->_aBargainArticleList;
02605 }
02606
02613 public function isLowOrderPrice()
02614 {
02615 if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02616 $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02617 }
02618
02619 return $this->_blLowOrderPrice;
02620 }
02621
02627 public function getMinOrderPrice()
02628 {
02629 if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02630 $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02631 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02632 }
02633 return $this->_sMinOrderPrice;
02634 }
02635
02641 public function getNewsRealStatus()
02642 {
02643 return $this->_iNewsRealStatus;
02644 }
02645
02651 protected function _canRedirect()
02652 {
02653 foreach ( $this->_aBlockRedirectParams as $sParam ) {
02654 if ( oxConfig::getParameter( $sParam ) !== null ) {
02655 return false;
02656 }
02657 }
02658
02659 return true;
02660 }
02661
02667 public function getProduct()
02668 {
02669 }
02670
02676 public function getVendorlist()
02677 {
02678 return $this->_aVendorlist;
02679 }
02680
02688 public function setVendorlist( $aList )
02689 {
02690 $this->_aVendorlist = $aList;
02691 }
02692
02698 public function getManufacturerlist()
02699 {
02700 return $this->_aManufacturerlist;
02701 }
02702
02710 public function setManufacturerlist( $aList )
02711 {
02712 $this->_aManufacturerlist = $aList;
02713 }
02714
02722 public function setRootVendor( $oVendor )
02723 {
02724 $this->_oRootVendor = $oVendor;
02725 }
02726
02732 public function getRootVendor()
02733 {
02734 return $this->_oRootVendor;
02735 }
02736
02744 public function setRootManufacturer( $oManufacturer )
02745 {
02746 $this->_oRootManufacturer = $oManufacturer;
02747 }
02748
02754 public function getRootManufacturer()
02755 {
02756 return $this->_oRootManufacturer;
02757 }
02758
02764 public function getVendorId()
02765 {
02766 if ( $this->_sVendorId === null ) {
02767 $this->_sVendorId = false;
02768 if ( ( $oVendor = $this->getActVendor() ) ) {
02769 $this->_sVendorId = $oVendor->getId();
02770 }
02771 }
02772 return $this->_sVendorId;
02773 }
02774
02780 public function getManufacturerId()
02781 {
02782 if ( $this->_sManufacturerId === null ) {
02783 $this->_sManufacturerId = false;
02784 if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02785 $this->_sManufacturerId = $oManufacturer->getId();
02786 }
02787 }
02788 return $this->_sManufacturerId;
02789 }
02790
02796 public function getSearchCatTree()
02797 {
02798 return $this->_aSearchCatTree;
02799 }
02800
02808 public function setSearchCatTree( $aTree )
02809 {
02810 $this->_aSearchCatTree = $aTree;
02811 }
02812
02818 public function getCatMoreUrl()
02819 {
02820 return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02821 }
02822
02828 public function getCatMore()
02829 {
02830 return $this->_oCatMore;
02831 }
02832
02840 public function setCatMore( $oCat )
02841 {
02842 $this->_oCatMore = $oCat;
02843 }
02844
02850 public function getCatTreePath()
02851 {
02852 return $this->_sCatTreePath;
02853 }
02854
02862 public function getContentByIdent( $sIdent )
02863 {
02864 if ( !isset( $this->_aContents[$sIdent] ) ) {
02865 $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02866 $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02867 }
02868 return $this->_aContents[$sIdent];
02869 }
02870
02876 public function getContentCategory()
02877 {
02878 return false;
02879 }
02880
02886 public function getMustFillFields()
02887 {
02888 if ( $this->_aMustFillFields === null ) {
02889 $this->_aMustFillFields = false;
02890
02891
02892 $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02893 if ( is_array( $aMustFillFields ) ) {
02894 $this->_aMustFillFields = array_flip( $aMustFillFields );
02895 }
02896 }
02897 return $this->_aMustFillFields;
02898 }
02899
02907 public function isFieldRequired( $sField )
02908 {
02909 if ( $aMustFillFields = $this->getMustFillFields() ) {
02910 if ( isset( $aMustFillFields[$sField] ) ) {
02911 return true;
02912 }
02913 }
02914
02915 return false;
02916 }
02917
02923 public function getFormId()
02924 {
02925 if ( $this->_sFormId === null ) {
02926 $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02927 oxSession::setVar( 'sessionuformid', $this->_sFormId );
02928 }
02929
02930 return $this->_sFormId;
02931 }
02932
02938 public function canAcceptFormData()
02939 {
02940 if ( $this->_blCanAcceptFormData === null ) {
02941 $this->_blCanAcceptFormData = false;
02942
02943 $sFormId = oxConfig::getParameter( "uformid" );
02944 $sSessionFormId = oxSession::getVar( "sessionuformid" );
02945
02946
02947 if ( $sFormId && $sFormId === $sSessionFormId ) {
02948 $this->_blCanAcceptFormData = true;
02949 }
02950
02951
02952 $this->getFormId();
02953 }
02954 return $this->_blCanAcceptFormData;
02955 }
02956
02962 public function getPromoFinishedList()
02963 {
02964 if (isset($this->_oPromoFinishedList)) {
02965 return $this->_oPromoFinishedList;
02966 }
02967 $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02968 $this->_oPromoFinishedList->loadFinishedByCount(2);
02969 return $this->_oPromoFinishedList;
02970 }
02971
02977 public function getPromoCurrentList()
02978 {
02979 if (isset($this->_oPromoCurrentList)) {
02980 return $this->_oPromoCurrentList;
02981 }
02982 $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02983 $this->_oPromoCurrentList->loadCurrent();
02984 return $this->_oPromoCurrentList;
02985 }
02986
02992 public function getPromoFutureList()
02993 {
02994 if (isset($this->_oPromoFutureList)) {
02995 return $this->_oPromoFutureList;
02996 }
02997 $this->_oPromoFutureList = oxNew( 'oxActionList' );
02998 $this->_oPromoFutureList->loadFutureByCount(2);
02999 return $this->_oPromoFutureList;
03000 }
03001
03007 public function getShowPromotionList()
03008 {
03009 if (isset($this->_blShowPromotions)) {
03010 return $this->_blShowPromotions;
03011 }
03012 $this->_blShowPromotions = false;
03013 if (oxNew('oxActionList')->areAnyActivePromotions()) {
03014 $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
03015 }
03016 return $this->_blShowPromotions;
03017 }
03018
03024 public function isEnabledPrivateSales()
03025 {
03026 if ( $this->_blEnabledPrivateSales === null ) {
03027 $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
03028 if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
03029 $this->_blEnabledPrivateSales = !$blCanPreview;
03030 }
03031 }
03032 return $this->_blEnabledPrivateSales;
03033 }
03034
03040 public function getTagCloudManager()
03041 {
03042 if ( $this->_blShowTagCloud ) {
03043 return oxNew( "oxTagCloud" );
03044 } else {
03045 return false;
03046 }
03047 }
03048
03054 public function getFieldValidationErrors()
03055 {
03056 return oxInputValidator::getInstance()->getFieldValidationErrors();
03057 }
03058
03064 public function getBreadCrumb()
03065 {
03066 return null;
03067 }
03068
03076 public function setRootCatChanged( $blRootCatChanged )
03077 {
03078 $this->_blRootCatChanged = $blRootCatChanged;
03079 }
03080
03086 public function isRootCatChanged()
03087 {
03088 return $this->_blRootCatChanged;
03089 }
03090
03096 public function getInvoiceAddress()
03097 {
03098 if ( $this->_aInvoiceAddress == null ) {
03099 $aAddress = oxConfig::getParameter( 'invadr');
03100 if ( $aAddress ) {
03101 $this->_aInvoiceAddress = $aAddress;
03102 }
03103 }
03104 return $this->_aInvoiceAddress;
03105 }
03106
03112 public function getDeliveryAddress()
03113 {
03114 if ( $this->_aDeliveryAddress == null ) {
03115 $aAddress = oxConfig::getParameter( 'deladr');
03116 if ( $aAddress ) {
03117 $this->_aDeliveryAddress = $aAddress;
03118 }
03119 }
03120 return $this->_aDeliveryAddress;
03121 }
03122
03130 public function setInvoiceAddress( $aAddress )
03131 {
03132 $this->_aInvoiceAddress = $aAddress;
03133 }
03134
03140 public function getActiveUsername()
03141 {
03142 if ( $this->_sActiveUsername == null ) {
03143 $this->_sActiveUsername = false;
03144 $sUsername = oxConfig::getParameter( 'lgn_usr' );
03145 if ( $sUsername ) {
03146 $this->_sActiveUsername = $sUsername;
03147 } elseif ( $oUser = $this->getUser() ) {
03148 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
03149 }
03150 }
03151 return $this->_sActiveUsername;
03152 }
03153
03159 public function getWishlistUserId()
03160 {
03161 return oxConfig::getParameter( 'wishid' );
03162 }
03163
03169 public function getSearchCatId()
03170 {
03171 }
03172
03178 public function getSearchVendor()
03179 {
03180 }
03181
03187 public function getSearchManufacturer()
03188 {
03189 }
03190
03196 public function getLastProducts()
03197 {
03198
03199 }
03200
03206 public function getNewBasketItemMsgType()
03207 {
03208 return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
03209 }
03210
03216 public function showTags()
03217 {
03218 return (bool) $this->getConfig()->getConfigParam( "blShowTags" );
03219 }
03220
03228 public function isActive( $sName )
03229 {
03230 return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
03231 }
03232
03238 public function isFbWidgetWisible()
03239 {
03240 if ( $this->_blFbWidgetsOn === null ) {
03241 $oUtils = oxUtilsServer::getInstance();
03242
03243
03244 $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
03245
03246
03247 $oUtils->setOxCookie( "fbwidgetson", $this->_blFbWidgetsOn ? 1 : 0 );
03248 }
03249 return $this->_blFbWidgetsOn;
03250 }
03251
03257 public function showRememberMe()
03258 {
03259 return (bool)$this->getConfig()->getConfigParam('blShowRememberMe');
03260 }
03261 }