oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007 
00008 // view indexing state for search engines:
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00012 
00018 class oxUBase extends oxView
00019 {
00027     public function isActive( $sName )
00028     {
00029         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
00030     }
00031 
00037     protected $_oaComponents = array();
00038 
00044     protected $_blIsCallForCache = false;
00045 
00051     protected $_blIsOrderStep = false;
00052 
00058     protected $_sListType = null;
00059 
00065     protected $_oActCategory = null;
00066 
00072     protected $_oActManufacturer = null;
00073 
00079     protected $_oActVendor = null;
00080 
00085     protected $_oActiveRecommList = null;
00086 
00092     protected $_oActSearch = null;
00093 
00098     protected $_blShowSorting = false;
00099 
00104     protected $_blShowRightBasket = null;
00105 
00110     protected $_blShowTopBasket = null;
00111 
00116     protected $_blShowLeftBasket = null;
00117 
00122     protected $_blLoadCurrency = null;
00123 
00128     protected $_blLoadVendorTree = null;
00129 
00134     protected $_blLoadManufacturerTree = null;
00135 
00140     protected $_blDontShowEmptyCats = null;
00141 
00146     protected $_blLoadLanguage = null;
00147 
00152     protected $_blShowTopCatNav = null;
00153 
00158     protected $_iTopCatNavItmCnt = null;
00159 
00164     protected $_aRssLinks = null;
00165 
00170     protected $_sListOrderBy = null;
00171 
00176     protected $_sListOrderDir = null;
00177 
00182     protected $_sMetaDescription = null;
00183 
00188     protected $_sMetaKeywords = null;
00189 
00195     protected $_sMetaDescriptionIdent = null;
00196 
00202     protected $_sMetaKeywordsIdent = null;
00203 
00208     protected $_sAdditionalParams = null;
00209 
00214     protected $_oActCurrency = null;
00215 
00222     protected $_blCommonAdded = false;
00223 
00230     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00231 
00238     protected $_blForceNoIndex = false;
00239 
00244     protected $_sWishlistName = null;
00245 
00250     protected $_iCompItemsCnt = null;
00251 
00257     protected $_sContentId = null;
00258 
00264     protected $_oContent = null;
00265 
00271     protected $_sViewResetID = null;
00272 
00277     protected $_blActiveSorting = null;
00278 
00283     protected $_aMenueList = null;
00284 
00290     protected $_aComponentNames = array(
00291                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00292                                     'oxcmp_lang'       => 1,
00293                                     'oxcmp_cur'        => 1,
00294                                     'oxcmp_shop'       => 1,
00295                                     'oxcmp_categories' => 0,
00296                                     'oxcmp_utils'      => 1,
00297                                     'oxcmp_news'       => 0,
00298                                     'oxcmp_basket'     => 1
00299                                   );
00300 
00306     protected $_aUserComponentNames = array();
00307 
00313     protected $_oProduct = null;
00314 
00319     protected $_iActPage = null;
00320 
00325     protected $_aArticleList = null;
00326 
00331     protected $_oVendorTree  = null;
00332 
00337     protected $_oManufacturerTree  = null;
00338 
00343     protected $_oCategoryTree  = null;
00344 
00349     protected $_aTop5ArticleList  = null;
00350 
00355     protected $_aBargainArticleList  = null;
00356 
00361     protected $_blLowOrderPrice = null;
00362 
00370     protected $_iLowOrderPrice  = null;
00371 
00376     protected $_sMinOrderPrice  = null;
00377 
00382     protected $_iNewsRealStatus  = null;
00383 
00388     protected $_aBlockRedirectParams = array( 'fnc' );
00389 
00394     protected $_aVendorlist = null;
00395 
00400     protected $_oRootVendor = null;
00401 
00406     protected $_sVendorId = null;
00407 
00412     protected $_aManufacturerlist = null;
00413 
00418     protected $_oRootManufacturer = null;
00419 
00424     protected $_sManufacturerId = null;
00425 
00430     protected $_aSearchCatTree = null;
00431 
00436     protected $_oCatMore = null;
00437 
00442     protected $_blNewsSubscribed = null;
00443 
00448     protected $_blShowShipAddress = null;
00449 
00454     protected $_oDelAddress = null;
00455 
00460     protected $_sCatTreePath = null;
00461 
00466     protected $_aContents = array();
00467 
00472     protected $_blTop5Action = false;
00473 
00478     protected $_blBargainAction = false;
00479 
00485     protected $_aMustFillFields = null;
00486 
00495     protected function _processRequest()
00496     {
00497         $myUtils = oxUtils::getInstance();
00498 
00499         // non admin, request is not empty and was not processed by seo engine
00500         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00501 
00502             // fetching standard url and looking for it in seo table
00503             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00504                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00505             } else {
00506                 // forcing to set noindex/follow meta
00507                 $this->_forceNoIndex();
00508 
00509                 $sShopId = $this->getConfig()->getShopId();
00510                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00511                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00512 
00513                 // logging "not found" url
00514                 $oDb = oxDb::getDb();
00515                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00516                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00517             }
00518         }
00519     }
00520 
00527     public function init()
00528     {
00529         $this->_processRequest();
00530 
00531         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00532             unset( $this->_aComponentNames['oxcmp_basket'] );
00533         }
00534 
00535         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00536         if ( !$this->_blCommonAdded ) {
00537             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00538             $this->_blCommonAdded = true;
00539         }
00540 
00541         // storing current view
00542         $blInit = true;
00543 
00544 
00545         // init all components if there are any
00546         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00547             // do not override initiated components
00548             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00549                 // component objects MUST be created to support user called functions
00550                 $oComponent = oxNew( $sComponentName );
00551                 $oComponent->setParent( $this );
00552                 $oComponent->setThisAction( $sComponentName );
00553                 $this->_oaComponents[$sComponentName] = $oComponent;
00554             }
00555 
00556             // do we really need to initiate them ?
00557             if ( $blInit ) {
00558                 $this->_oaComponents[$sComponentName]->init();
00559 
00560                 // executing only is view does not have action method
00561                 if ( !method_exists( $this, $this->getFncName() ) ) {
00562                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00563                 }
00564             }
00565         }
00566 
00567         parent::init();
00568 
00569         // enable sorting ?
00570         if ( $this->showSorting() ) {
00571             $this->prepareSortColumns();
00572         }
00573         $this->_aViewData['showsorting']    = $this->isSortingActive();
00574         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00575         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00576         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00577     }
00578 
00585     public function getViewId()
00586     {
00587         if ( $this->_sViewId ) {
00588             return $this->_sViewId;
00589         }
00590 
00591         $iLang = oxLang::getInstance()->getBaseLanguage();
00592         $iCur  = (int) oxConfig::getParameter( 'currency' );
00593 
00594 
00595             $this->_sViewId =  "ox|$iLang|$iCur";
00596 
00597         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex );
00598 
00599         return $this->_sViewId;
00600     }
00601 
00602 
00608     public function showSorting()
00609     {
00610         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00611     }
00612 
00620     public function setComponents( $aComponents = null )
00621     {
00622         $this->_oaComponents = $aComponents;
00623     }
00624 
00630     public function getComponents()
00631     {
00632         return $this->_oaComponents;
00633     }
00634 
00642     public function setIsOrderStep( $blIsOrderStep = null )
00643     {
00644         $this->_blIsOrderStep = $blIsOrderStep;
00645     }
00646 
00652     public function getIsOrderStep()
00653     {
00654         return $this->_blIsOrderStep;
00655     }
00656 
00657 
00665     public function setActiveCategory( $oCategory )
00666     {
00667         $this->_oActCategory = $oCategory;
00668     }
00669 
00675     public function getActiveCategory()
00676     {
00677         return $this->_oActCategory;
00678     }
00679 
00687     public function setIsCallForCache( $blIsCallForCache = null )
00688     {
00689         $this->_blIsCallForCache = $blIsCallForCache;
00690     }
00691 
00697     public function getIsCallForCache()
00698     {
00699         return $this->_blIsCallForCache;
00700     }
00701 
00707     public function getListType()
00708     {
00709         if ( $this->_sListType == null ) {
00710             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00711                 $this->_sListType = $sListType;
00712             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00713                 $this->_sListType = $sListType;
00714             }
00715         }
00716         return $this->_sListType;
00717     }
00718 
00726     public function setListType( $sType )
00727     {
00728         $this->_sListType = $sType;
00729         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00730     }
00731 
00737     public function showRightBasket()
00738     {
00739         if ( $this->_blShowRightBasket === null ) {
00740             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00741                 $this->_blShowRightBasket = $blShowRightBasket;
00742             }
00743         }
00744         return $this->_blShowRightBasket;
00745     }
00746 
00754     public function setShowRightBasket( $blShowBasket )
00755     {
00756         $this->_blShowRightBasket = $blShowBasket;
00757     }
00758 
00764     public function showLeftBasket()
00765     {
00766         if ( $this->_blShowLeftBasket === null ) {
00767             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00768                 $this->_blShowLeftBasket = $blShowLeftBasket;
00769             }
00770         }
00771         return $this->_blShowLeftBasket;
00772     }
00773 
00781     public function setShowLeftBasket( $blShowBasket )
00782     {
00783         $this->_blShowLeftBasket = $blShowBasket;
00784     }
00785 
00791     public function showTopBasket()
00792     {
00793         if ( $this->_blShowTopBasket === null ) {
00794             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00795                 $this->_blShowTopBasket = $blShowTopBasket;
00796             }
00797         }
00798         return $this->_blShowTopBasket;
00799     }
00800 
00808     public function setShowTopBasket( $blShowBasket )
00809     {
00810         $this->_blShowTopBasket = $blShowBasket;
00811     }
00812 
00818     public function loadCurrency()
00819     {
00820         if ( $this->_blLoadCurrency == null ) {
00821             $this->_blLoadCurrency = false;
00822             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00823                 $this->_blLoadCurrency = $blLoadCurrency;
00824             }
00825         }
00826         return $this->_blLoadCurrency;
00827     }
00828 
00834     public function loadVendorTree()
00835     {
00836         if ( $this->_blLoadVendorTree == null ) {
00837             $this->_blLoadVendorTree = false;
00838             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00839                 $this->_blLoadVendorTree = $blLoadVendorTree;
00840             }
00841         }
00842         return $this->_blLoadVendorTree;
00843     }
00844 
00850     public function loadManufacturerTree()
00851     {
00852         if ( $this->_blLoadManufacturerTree == null ) {
00853             $this->_blLoadManufacturerTree = false;
00854             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00855                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00856             }
00857         }
00858         return $this->_blLoadManufacturerTree;
00859     }
00860 
00866     public function dontShowEmptyCategories()
00867     {
00868         if ( $this->_blDontShowEmptyCats == null ) {
00869             $this->_blDontShowEmptyCats = false;
00870             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00871                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00872             }
00873         }
00874         return $this->_blDontShowEmptyCats;
00875     }
00876 
00882     public function isLanguageLoaded()
00883     {
00884         if ( $this->_blLoadLanguage == null ) {
00885             $this->_blLoadLanguage = false;
00886             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00887                 $this->_blLoadLanguage = $blLoadLanguage;
00888             }
00889         }
00890         return $this->_blLoadLanguage;
00891     }
00892 
00898     public function showTopCatNavigation()
00899     {
00900         if ( $this->_blShowTopCatNav == null ) {
00901             $this->_blShowTopCatNav = false;
00902             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00903                 $this->_blShowTopCatNav = $blShowTopCatNav;
00904             }
00905         }
00906         return $this->_blShowTopCatNav;
00907     }
00908 
00914     public function getTopNavigationCatCnt()
00915     {
00916         if ( $this->_iTopCatNavItmCnt == null ) {
00917             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00918             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00919         }
00920         return $this->_iTopCatNavItmCnt;
00921     }
00922 
00932     public function addRssFeed($sTitle, $sUrl, $key = null)
00933     {
00934         if (!is_array($this->_aRssLinks)) {
00935             $this->_aRssLinks = array();
00936         }
00937         if ($key === null) {
00938             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00939         } else {
00940             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00941         }
00942 
00943         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00944     }
00945 
00960     public function prepareSortColumns()
00961     {
00962         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00963         if ( count( $aSortColumns ) > 0 ) {
00964 
00965             $this->_blActiveSorting = true;
00966             $this->_aSortColumns = $aSortColumns;
00967 
00968             $sCnid = oxConfig::getParameter( 'cnid' );
00969 
00970             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00971             $sSortDir = oxConfig::getParameter( 'listorder' );
00972 
00973             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00974                 $sSortBy  = $aSorting['sortby'];
00975                 $sSortDir = $aSorting['sortdir'];
00976             }
00977 
00978             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00979                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00980 
00981                 $this->_sListOrderBy  = $sSortBy;
00982                 $this->_sListOrderDir = $sSortDir;
00983 
00984                 // caching sorting config
00985                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00986             }
00987         }
00988     }
00989 
00995     public function getListOrderBy()
00996     {
00997         return $this->_sListOrderBy;
00998     }
00999 
01005     public function getListOrderDirection()
01006     {
01007         return $this->_sListOrderDir;
01008     }
01009 
01017     public function setMetaDescription ( $sDescription )
01018     {
01019         return $this->_sMetaDescription = $sDescription;
01020     }
01021 
01029     public function setMetaKeywords( $sKeywords )
01030     {
01031         return $this->_sMetaKeywords = $sKeywords;
01032     }
01033 
01042     protected function _getMetaSeoParam()
01043     {
01044     }
01045 
01053     protected function _getMetaFromSeo( $sDataType )
01054     {
01055         $sOxid  = $this->_getSeoObjectId();
01056         $iLang  = oxLang::getInstance()->getBaseLanguage();
01057         $sShop  = $this->getConfig()->getShopId();
01058 
01059         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01060              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01061             return $sKeywords;
01062         }
01063     }
01064 
01072     protected function _getMetaFromContent( $sMetaIdent )
01073     {
01074         if ( $sMetaIdent ) {
01075             $oContent = oxNew( 'oxcontent' );
01076             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01077                  $oContent->oxcontents__oxactive->value ) {
01078                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01079             }
01080         }
01081     }
01082 
01088     public function getMetaKeywords()
01089     {
01090         if ( $this->_sMetaKeywords === null ) {
01091             $this->_sMetaKeywords = false;
01092 
01093             // set special meta keywords ?
01094             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01095                 $this->_sMetaKeywords = $sKeywords;
01096             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01097                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01098             } else {
01099                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01100             }
01101         }
01102 
01103         return $this->_sMetaKeywords;
01104     }
01105 
01111     public function getMetaDescription()
01112     {
01113         if ( $this->_sMetaDescription === null ) {
01114             $this->_sMetaDescription = false;
01115 
01116             // set special meta description ?
01117             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01118                 $this->_sMetaDescription = $sDescription;
01119             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01120                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01121             } else {
01122                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01123             }
01124         }
01125 
01126         return $this->_sMetaDescription;
01127     }
01128 
01134     public function getActCurrency()
01135     {
01136         return $this->_oActCurrency;
01137     }
01138 
01146     public function setActCurrency( $oCur )
01147     {
01148         $this->_oActCurrency = $oCur;
01149     }
01150 
01156     public function getCompareItemsCnt()
01157     {
01158         return $this->_iCompItemsCnt;
01159     }
01160 
01168     public function setCompareItemsCnt( $iCount )
01169     {
01170         $this->_iCompItemsCnt = $iCount;
01171     }
01172 
01178     public function getWishlistName()
01179     {
01180         return $this->_sWishlistName;
01181     }
01182 
01190     public function setWishlistName( $sName )
01191     {
01192         $this->_sWishlistName = $sName;
01193     }
01194 
01200     protected function _forceNoIndex()
01201     {
01202         $this->_blForceNoIndex = true;
01203     }
01204 
01211     public function noIndex()
01212     {
01213         if ( $this->_blForceNoIndex ) {
01214             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01215         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01216             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01217         } else {
01218             switch ( oxConfig::getParameter( 'fnc' ) ) {
01219                 case 'tocomparelist':
01220                 case 'tobasket':
01221                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01222                     break;
01223             }
01224         }
01225         return $this->_iViewIndexState;
01226     }
01227 
01234     public function getContentId()
01235     {
01236         if ( $this->_sContentId === null) {
01237             $oContent = oxNew( 'oxcontent' );
01238             $oContent->loadByIdent( 'oximpressum' );
01239             $this->_sContentId = $oContent->getId();
01240         }
01241 
01242         return $this->_sContentId;
01243     }
01244 
01251     public function getContent()
01252     {
01253         if ( $this->_oContent === null) {
01254             $oContent = oxNew( 'oxcontent' );
01255             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01256                 $this->_oContent = $oContent;
01257             }
01258         }
01259 
01260         return $this->_oContent;
01261     }
01262 
01268     public function isSortingActive()
01269     {
01270         return $this->_blActiveSorting;
01271     }
01272 
01278     public function getMenueList()
01279     {
01280         return $this->_aMenueList;
01281     }
01282 
01290     public function setMenueList( $aMenue )
01291     {
01292         $this->_aMenueList = $aMenue;
01293     }
01294 
01295 
01301     protected function _setNrOfArtPerPage()
01302     {
01303         $myConfig  = $this->getConfig();
01304         $aViewData = array();
01305 
01306         //setting default values to avoid possible errors showing article list
01307         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01308         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01309 
01310         // checking if all needed data is set
01311         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01312         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01313             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01314         } else {
01315             $iNrofCatArticles = $aNrofCatArticles[0];
01316         }
01317 
01318         $oViewConf = $this->getViewConfig();
01319         //value from user input
01320         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01321             // M45 Possibility to push any "Show articles per page" number parameter
01322             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01323             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01324             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01325         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01326             // M45 Possibility to push any "Show articles per page" number parameter
01327             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01328             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01329             $iNrofCatArticles = $iSessArtPerPage;
01330         } else {
01331             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01332         }
01333 
01334         //setting number of articles per page to config value
01335         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01336 
01337         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01338     }
01339 
01345     protected function _getSeoObjectId()
01346     {
01347     }
01348 
01358     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01359     {
01360         if ( $sMeta ) {
01361 
01362             $oStr = getStr();
01363             if ( $iLength != -1 ) {
01364                 /* *
01365                  * performance - we dont need a huge amount of initial text.
01366                  * assume that effective text may be double longer than $iLength
01367                  * and simple turncate it
01368                  */
01369                 $iELength = ( $iLength * 2 );
01370                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01371             }
01372 
01373             // decoding html entities
01374             $sMeta = $oStr->html_entity_decode( $sMeta );
01375             // stripping HTML tags
01376             $sMeta = strip_tags( $sMeta );
01377 
01378             // removing some special chars
01379             $sMeta = $oStr->cleanStr( $sMeta );
01380 
01381             // removing duplicate words
01382             if ( $blRemoveDuplicatedWords ) {
01383                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01384             }
01385 
01386             // some special cases
01387             $sMeta = str_replace( ' ,', ',', $sMeta );
01388             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01389             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01390             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01391 
01392             return trim( $sMeta );
01393         }
01394     }
01395 
01404     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01405     {
01406 
01407         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01408 
01409         if ( $blRemoveDuplicatedWords ) {
01410             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01411         }
01412 
01413         // removing in admin defined strings
01414 
01415         /*if ( is_array( $aSkipTags ) && $sString ) {
01416             $oStr = getStr();
01417             foreach ( $aSkipTags as $sSkip ) {
01418                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01419                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01420                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01421                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01422             }
01423         }*/
01424 
01425         return trim( $sString );
01426     }
01427 
01436     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01437     {
01438         $oStr = getStr();
01439         if ( is_array( $aInput ) ) {
01440             $aStrings = $aInput;
01441         } else {
01442             //is String
01443             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01444         }
01445 
01446         if ( $sCount = count( $aSkipTags ) ) {
01447             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01448                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01449             }
01450         }
01451         $sCount = count($aStrings);
01452         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01453             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01454             // removing in admin defined strings
01455             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01456                 unset( $aStrings[$iNum] );
01457             }
01458         }
01459 
01460         // duplicates
01461         $aStrings = array_unique($aStrings);
01462 
01463         return implode( ', ', $aStrings );
01464     }
01465 
01473     public function getNavigationParams()
01474     {
01475         $aParams['cnid'] = $this->getCategoryId();
01476         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01477 
01478         $aParams['listtype'] = $this->getListType();
01479         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01480 
01481         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01482         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01483         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01484 
01485         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01486         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01487         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01488 
01489         return $aParams;
01490     }
01491 
01501     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01502     {
01503         $aSorting = oxSession::getVar( 'aSorting' );
01504         $aSorting[$sCnid]['sortby']  = $sSortBy;
01505         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01506 
01507         oxSession::setVar( 'aSorting', $aSorting );
01508     }
01509 
01517     public function getSorting( $sCnid )
01518     {
01519         $aSorting = oxSession::getVar( 'aSorting' );
01520         if ( isset( $aSorting[$sCnid] ) ) {
01521             return $aSorting[$sCnid];
01522         }
01523     }
01524 
01532     public function getSortingSql( $sCnid )
01533     {
01534         $aSorting = $this->getSorting( $sCnid );
01535         if ( is_array( $aSorting ) ) {
01536             return implode( " ", $aSorting );
01537         }
01538     }
01539 
01545     public function getTitleSuffix()
01546     {
01547         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01548     }
01549 
01556     public function getTitlePrefix()
01557     {
01558         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01559     }
01560 
01569     protected function _getSubject( $iLang )
01570     {
01571         return null;
01572     }
01573 
01579     public function getDynUrlParams()
01580     {
01581         $sRet = '';
01582         $sListType = $this->getListType();
01583 
01584         switch ($sListType) {
01585             default:
01586                 break;
01587             case 'search':
01588                 $sRet .= "&amp;listtype={$sListType}";
01589                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01590                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01591                 }
01592 
01593                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01594                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01595                 }
01596                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01597                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01598                 }
01599                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01600                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01601                 }
01602                 break;
01603             case 'tag':
01604                 $sRet .= "&amp;listtype={$sListType}";
01605                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01606                     $sRet .= "&amp;searchtag={$sParam}";
01607                 }
01608                 break;
01609         }
01610 
01611         return $sRet;
01612     }
01613 
01621     public function getLink( $iLang = null )
01622     {
01623         if ( !isset( $iLang ) ) {
01624             $iLang = oxLang::getInstance()->getBaseLanguage();
01625         }
01626 
01627         $oDisplayObj = null;
01628         $blTrySeo = false;
01629         if ( oxUtils::getInstance()->seoIsActive() ) {
01630             $blTrySeo = true;
01631             $oDisplayObj = $this->_getSubject( $iLang );
01632         }
01633         $iActPageNr = $this->getActPage();
01634 
01635         if ( $oDisplayObj ) {
01636             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01637         }
01638 
01639         $myConfig = $this->getConfig();
01640 
01641         if ( $blTrySeo ) {
01642             $oEncoder = oxSeoEncoder::getInstance();
01643             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01644                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01645             }
01646         }
01647 
01648         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01649 
01650         // fallback to old non seo url
01651         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01652     }
01653 
01659     public function getCanonicalUrl()
01660     {
01661     }
01662 
01669     public function getSimilarRecommLists()
01670     {
01671     }
01672 
01680     protected function _getRequestParams( $blAddPageNr  = true )
01681     {
01682         $sClass = $this->getClassName();
01683         $sFnc   = $this->getFncName();
01684 
01685         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01686         if ( in_array( $sFnc, $aFnc ) ) {
01687             $sFnc = '';
01688         }
01689 
01690         // #680
01691         $sURL = "cl={$sClass}";
01692         if ( $sFnc ) {
01693             $sURL .= "&amp;fnc={$sFnc}";
01694         }
01695         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01696             $sURL .= "&amp;cnid={$sVal}";
01697         }
01698         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01699             $sURL .= "&amp;mnid={$sVal}";
01700         }
01701         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01702             $sURL .= "&amp;anid={$sVal}";
01703         }
01704 
01705         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01706             $sURL .= "&amp;page={$sVal}";
01707         }
01708 
01709         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01710             $sURL .= "&amp;tpl={$sVal}";
01711         }
01712 
01713         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01714         // don't include page number for navigation
01715         // it will be done in oxubase::generatePageNavigation
01716         if ( $blAddPageNr && $iPgNr > 0 ) {
01717             $sURL .= "&amp;pgNr={$iPgNr}";
01718         }
01719 
01720         // #1184M - specialchar search
01721         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01722             $sURL .= "&amp;searchparam={$sVal}";
01723         }
01724 
01725         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01726             $sURL .= "&amp;searchcnid={$sVal}";
01727         }
01728 
01729         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01730             $sURL .= "&amp;searchvendor={$sVal}";
01731         }
01732 
01733         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01734             $sURL .= "&amp;searchmanufacturer={$sVal}";
01735         }
01736 
01737         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01738             $sURL .= "&amp;searchrecomm={$sVal}";
01739         }
01740 
01741         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01742             $sURL .= "&amp;searchtag={$sVal}";
01743         }
01744 
01745         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01746             $sURL .= "&amp;recommid={$sVal}";
01747         }
01748 
01749         return $sURL;
01750     }
01751 
01757     protected function _getSeoRequestParams()
01758     {
01759         $sClass = $this->getClassName();
01760         $sFnc   = $this->getFncName();
01761 
01762         // #921 S
01763         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01764         if ( in_array( $sFnc, $aFnc ) ) {
01765             $sFnc = '';
01766         }
01767 
01768         // #680
01769         $sURL = "cl={$sClass}";
01770         if ( $sFnc ) {
01771             $sURL .= "&amp;fnc={$sFnc}";
01772         }
01773         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01774             $sURL .= "&amp;page={$sVal}";
01775         }
01776 
01777         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01778             $sURL .= "&amp;tpl={$sVal}";
01779         }
01780 
01781         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01782         if ( $iPgNr > 0 ) {
01783             $sURL .= "&amp;pgNr={$iPgNr}";
01784         }
01785 
01786         return $sURL;
01787     }
01788 
01794     public function showSearch()
01795     {
01796         $blShow = true;
01797         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01798             $blShow = false;
01799         }
01800         return (int) $blShow;
01801     }
01802 
01808     public function getRssLinks()
01809     {
01810         return $this->_aRssLinks;
01811     }
01812 
01818     public function getSortColumns()
01819     {
01820         return $this->_aSortColumns;
01821     }
01822 
01828     public function getEditTags()
01829     {
01830     }
01831 
01837     public function getRecommSearch()
01838     {
01839     }
01840 
01848     public function getReviewUserId()
01849     {
01850     }
01851 
01857     public function getPaymentList()
01858     {
01859     }
01860 
01866     public function getActiveRecommList()
01867     {
01868         if ( $this->_oActiveRecommList === null ) {
01869             $this->_oActiveRecommList = false;
01870             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01871                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01872                 $this->_oActiveRecommList->load( $sOxid );
01873             }
01874         }
01875         return $this->_oActiveRecommList;
01876     }
01877 
01883     public function getAccessoires()
01884     {
01885     }
01886 
01892     public function getCrossSelling()
01893     {
01894     }
01895 
01901     public function getSimilarProducts()
01902     {
01903     }
01904 
01912     public function getAlsoBoughtThiesProducts()
01913     {
01914     }
01915 
01921     public function getAlsoBoughtTheseProducts()
01922     {
01923     }
01924 
01930     public function getArticleId()
01931     {
01932     }
01933 
01939     public function isMoreTagsVisible()
01940     {
01941         return false;
01942     }
01943 
01949     public function getTitle()
01950     {
01951     }
01952 
01958     public function getActiveLangAbbr()
01959     {
01960         // Performance
01961         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01962             return;
01963         }
01964 
01965         if ( !isset($this->_sActiveLangAbbr ) ) {
01966             $aLanguages = oxLang::getInstance()->getLanguageArray();
01967             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01968                 if ( $oVal->selected ) {
01969                     $this->_sActiveLangAbbr = $oVal->abbr;
01970                     break;
01971                 }
01972             }
01973         }
01974 
01975         return $this->_sActiveLangAbbr;
01976     }
01977 
01991     public function addGlobalParams( $oShop = null)
01992     {
01993         $myConfig = $this->getConfig();
01994 
01995         $oViewConf = parent::addGlobalParams( $oShop );
01996 
01997         $this->_aViewData['isfiltering'] = true;
01998         $this->_aViewData['isnewsletter'] = true;
01999         $this->_aViewData['isvarianten'] = true;
02000         $this->_aViewData['isreview'] = true;
02001         $this->_aViewData['isaddsales'] = true;
02002         $this->_aViewData['isvoucher'] = true;
02003         $this->_aViewData['ispricealarm'] = true;
02004         $this->_aViewData['iswishlist'] = true;
02005         $this->_aViewData['isipayment'] = true;
02006         $this->_aViewData['istrusted'] = true;
02007         $this->_aViewData['isfiltering'] = true;
02008         $this->_aViewData['isgooglestats'] = true;
02009         $this->_aViewData['iswishlist'] = true;
02010 
02011 
02012         // show baskets
02013         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02014         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02015         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02016 
02017         // allow currency swiching
02018         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02019 
02020         // show/hide vendors
02021         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02022 
02023         // show/hide Manufacturers
02024         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02025 
02026         // show/hide empty categories
02027         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02028 
02029         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02030 
02031         // used for compatibility with older templates
02032         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02033         $this->_aViewData['urlsign']    = '&';
02034         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02035         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02036 
02037         $this->_aViewData['sListType'] = $this->getListType();
02038         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02039 
02040         // new navigation ?
02041         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02042         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02043 
02044         $this->_setNrOfArtPerPage();
02045 
02046 
02047         return $oViewConf;
02048     }
02049 
02055     public function getAdditionalParams()
02056     {
02057         if ( $this->_sAdditionalParams === null ) {
02058             // #1018A
02059             $this->_sAdditionalParams  = parent::getAdditionalParams();
02060             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02061 
02062             // #1834M - specialchar search
02063             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02064             if ( isset( $sSearchParamForLink ) ) {
02065                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02066             }
02067             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02068                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02069             }
02070             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02071                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02072             }
02073             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02074                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02075             }
02076             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02077                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02078             }
02079             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02080                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02081             }
02082             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02083                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02084             }
02085         }
02086 
02087         return $this->_sAdditionalParams;
02088     }
02089 
02095     public function generatePageNavigationUrl()
02096     {
02097         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02098     }
02099 
02109     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02110     {
02111         if ( $iPage ) {
02112             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02113         }
02114         return $sUrl;
02115     }
02116 
02122     public function generatePageNavigation()
02123     {
02124         startProfile('generatePageNavigation');
02125         // generate the page navigation
02126         $pageNavigation = new stdClass();
02127         $pageNavigation->NrOfPages = $this->_iCntPages;
02128         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02129         $iActPage = $this->getActPage();
02130         $pageNavigation->actPage   = $iActPage + 1;
02131 
02132         $sUrl = $this->generatePageNavigationUrl();
02133 
02134         if ( $iActPage > 0) {
02135             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02136         }
02137 
02138         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02139             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02140         }
02141 
02142         if ( $pageNavigation->NrOfPages > 1 ) {
02143             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02144                 $page = new Oxstdclass();
02145                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02146                 $page->selected = 0;
02147                 if ( $i == $pageNavigation->actPage ) {
02148                     $page->selected = 1;
02149                 }
02150                 $pageNavigation->changePage[$i] = $page;
02151             }
02152 
02153             // first/last one
02154             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02155             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02156         }
02157 
02158         stopProfile('generatePageNavigation');
02159 
02160         return $pageNavigation;
02161     }
02162 
02170     public function prepareMinimumOrderPrice4View()
02171     {
02172         $myConfig = $this->getConfig();
02173         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02174         if ( isset( $iMinOrderPrice ) && is_numeric($iMinOrderPrice)) {
02175             $oBasket = $this->getSession()->getBasket();
02176             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02177                 return;
02178             }
02179             $oCur    = $myConfig->getActShopCurrencyObject();
02180             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02181             // Coupons and discounts should be considered in "Min order price" check
02182             $dVoucherDiscount = 0;
02183             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02184                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02185             }
02186             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02187                 $this->_iLowOrderPrice = 1;
02188                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02189             }
02190         }
02191     }
02192 
02199     public function render()
02200     {
02201         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02202             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02203         }
02204 
02205         parent::render();
02206 
02207         if ( $this->getIsOrderStep() ) {
02208 
02209             // disabling navigation during order ...
02210             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02211                 $this->_iNewsRealStatus = 1;
02212                 $this->setShowNewsletter( 0 );
02213                 // for old tpl. will be removed later
02214                 $this->_aViewData['isnewsletter'] = 0;
02215                 $this->setShowRightBasket( 0 );
02216                 $this->setShowLeftBasket( 0 );
02217                 $this->setShowTopBasket( 0 );
02218             }
02219             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02220             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02221         }
02222 
02223         // meta data
02224         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02225         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02226 
02227         // show baskets
02228         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02229         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02230         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02231 
02232         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02233 
02234         $this->_aViewData['noindex'] = $this->noIndex();
02235 
02236         return $this->_sThisTemplate;
02237     }
02238 
02244     public function getViewProduct()
02245     {
02246         return $this->getProduct();
02247     }
02248 
02256     public function setViewProduct( $oProduct )
02257     {
02258         $this->_oProduct = $oProduct;
02259     }
02260 
02266     public function getViewProductList()
02267     {
02268         return $this->_aArticleList;
02269     }
02270 
02276     public function getActPage()
02277     {
02278         if ( $this->_iActPage === null ) {
02279             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02280             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02281         }
02282         return $this->_iActPage;
02283     }
02284 
02292     public function getActTag()
02293     {
02294         if ( $this->_oActTag === null ) {
02295             $this->_oActTag = new Oxstdclass();
02296             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02297             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02298 
02299             $sLink = false;
02300             if ( oxUtils::getInstance()->seoIsActive() ) {
02301                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02302             }
02303 
02304             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02305         }
02306         return $this->_oActTag;
02307     }
02308 
02316     public function getActVendor()
02317     {
02318         // if active vendor is not set yet - trying to load it from request params
02319         // this may be usefull when category component was unable to load active vendor
02320         // and we still need some object to mount navigation info
02321         if ( $this->_oActVendor === null ) {
02322             $this->_oActVendor = false;
02323             $sVendorId = oxConfig::getParameter( 'cnid' );
02324             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02325             $oVendor = oxNew( 'oxvendor' );
02326             if ( $oVendor->load( $sVendorId ) ) {
02327                 $this->_oActVendor = $oVendor;
02328             }
02329         }
02330 
02331         return $this->_oActVendor;
02332     }
02333 
02341     public function getActManufacturer()
02342     {
02343         // if active Manufacturer is not set yet - trying to load it from request params
02344         // this may be usefull when category component was unable to load active Manufacturer
02345         // and we still need some object to mount navigation info
02346         if ( $this->_oActManufacturer === null ) {
02347 
02348             $this->_oActManufacturer = false;
02349             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02350             $oManufacturer = oxNew( 'oxmanufacturer' );
02351             if ( $oManufacturer->load( $sManufacturerId ) ) {
02352                 $this->_oActManufacturer = $oManufacturer;
02353             }
02354         }
02355 
02356         return $this->_oActManufacturer;
02357     }
02358 
02366     public function setActVendor( $oVendor )
02367     {
02368         $this->_oActVendor = $oVendor;
02369     }
02370 
02378     public function setActManufacturer( $oManufacturer )
02379     {
02380         $this->_oActManufacturer = $oManufacturer;
02381     }
02382 
02388     public function getActSearch()
02389     {
02390         if ( $this->_oActSearch === null ) {
02391             $this->_oActSearch = new oxStdClass();
02392             $sUrl = $this->getConfig()->getShopHomeURL();
02393             $this->_oActSearch->link = "{$sUrl}cl=search";
02394         }
02395         return $this->_oActSearch;
02396     }
02397 
02405     public function getActRecommList()
02406     {
02407         return $this->getActiveRecommList();
02408     }
02409 
02415     public function getCategoryTree()
02416     {
02417         return $this->_oCategoryTree;
02418     }
02419 
02427     public function setCategoryTree( $oCatTree )
02428     {
02429         $this->_oCategoryTree = $oCatTree;
02430     }
02431 
02437     public function getVendorTree()
02438     {
02439         return $this->_oVendorTree;
02440     }
02441 
02449     public function setVendorTree( $oVendorTree )
02450     {
02451         $this->_oVendorTree = $oVendorTree;
02452     }
02453 
02459     public function getManufacturerTree()
02460     {
02461         return $this->_oManufacturerTree;
02462     }
02463 
02471     public function setManufacturerTree( $oManufacturerTree )
02472     {
02473         $this->_oManufacturerTree = $oManufacturerTree;
02474     }
02484     protected function _loadActions()
02485     {
02486         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02487         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02488     }
02489 
02495     public function getAddUrlParams()
02496     {
02497     }
02498 
02505     public function getTop5ArticleList()
02506     {
02507         if ( $this->_blTop5Action ) {
02508             if ( $this->_aTop5ArticleList === null ) {
02509                 $this->_aTop5ArticleList = false;
02510                 $myConfig = $this->getConfig();
02511                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02512                     // top 5 articles
02513                     $oArtList = oxNew( 'oxarticlelist' );
02514                     $oArtList->loadTop5Articles();
02515                     if ( $oArtList->count() ) {
02516                         $this->_aTop5ArticleList = $oArtList;
02517                     }
02518                 }
02519             }
02520         }
02521         return $this->_aTop5ArticleList;
02522     }
02523 
02530     public function getBargainArticleList()
02531     {
02532         if ( $this->_blBargainAction ) {
02533             if ( $this->_aBargainArticleList === null ) {
02534                 $this->_aBargainArticleList = array();
02535                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02536                     $oArtList = oxNew( 'oxarticlelist' );
02537                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02538                     if ( $oArtList->count() ) {
02539                         $this->_aBargainArticleList = $oArtList;
02540                     }
02541                 }
02542             }
02543         }
02544         return $this->_aBargainArticleList;
02545     }
02546 
02553     public function isLowOrderPrice()
02554     {
02555         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02556             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02557         }
02558 
02559         return $this->_blLowOrderPrice;
02560     }
02561 
02567     public function getMinOrderPrice()
02568     {
02569         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02570             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02571             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02572         }
02573         return $this->_sMinOrderPrice;
02574     }
02575 
02581     public function getNewsRealStatus()
02582     {
02583         return $this->_iNewsRealStatus;
02584     }
02585 
02591     protected function _canRedirect()
02592     {
02593         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02594             if ( oxConfig::getParameter( $sParam ) !== null ) {
02595                 return false;
02596             }
02597         }
02598 
02599         return true;
02600     }
02601 
02607     public function getProduct()
02608     {
02609     }
02610 
02616     public function getVendorlist()
02617     {
02618         return $this->_aVendorlist;
02619     }
02620 
02628     public function setVendorlist( $aList )
02629     {
02630         $this->_aVendorlist = $aList;
02631     }
02632 
02638     public function getManufacturerlist()
02639     {
02640         return $this->_aManufacturerlist;
02641     }
02642 
02650     public function setManufacturerlist( $aList )
02651     {
02652         $this->_aManufacturerlist = $aList;
02653     }
02654 
02662     public function setRootVendor( $oVendor )
02663     {
02664         $this->_oRootVendor = $oVendor;
02665     }
02666 
02672     public function getRootVendor()
02673     {
02674         return $this->_oRootVendor;
02675     }
02676 
02684     public function setRootManufacturer( $oManufacturer )
02685     {
02686         $this->_oRootManufacturer = $oManufacturer;
02687     }
02688 
02694     public function getRootManufacturer()
02695     {
02696         return $this->_oRootManufacturer;
02697     }
02698 
02704     public function getVendorId()
02705     {
02706         if ( $this->_sVendorId === null ) {
02707             $this->_sVendorId = false;
02708             if ( ( $oVendor = $this->getActVendor() ) ) {
02709                 $this->_sVendorId = $oVendor->getId();
02710             }
02711         }
02712         return $this->_sVendorId;
02713     }
02714 
02720     public function getManufacturerId()
02721     {
02722         if ( $this->_sManufacturerId === null ) {
02723             $this->_sManufacturerId = false;
02724             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02725                 $this->_sManufacturerId = $oManufacturer->getId();
02726             }
02727         }
02728         return $this->_sManufacturerId;
02729     }
02730 
02736     public function getSearchCatTree()
02737     {
02738         return $this->_aSearchCatTree;
02739     }
02740 
02748     public function setSearchCatTree( $aTree )
02749     {
02750         $this->_aSearchCatTree = $aTree;
02751     }
02752 
02758     public function getCatMore()
02759     {
02760         return $this->_oCatMore;
02761     }
02762 
02770     public function setCatMore( $oCat )
02771     {
02772         $this->_oCatMore = $oCat;
02773     }
02774 
02780     public function getCatTreePath()
02781     {
02782         return $this->_sCatTreePath;
02783     }
02784 
02792     public function getContentByIdent( $sIdent )
02793     {
02794         if ( !isset( $this->_aContents[$sIdent] ) ) {
02795             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02796             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02797         }
02798         return $this->_aContents[$sIdent];
02799     }
02800 
02806     public function getContentCategory()
02807     {
02808         return false;
02809     }
02810 
02816     public function getMustFillFields()
02817     {
02818         if ( $this->_aMustFillFields === null ) {
02819             $this->_aMustFillFields = false;
02820 
02821             // passing must-be-filled-fields info
02822             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02823             if ( is_array( $aMustFillFields ) ) {
02824                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02825             }
02826         }
02827         return $this->_aMustFillFields;
02828     }
02829 
02837     public function isFieldRequired( $sField )
02838     {
02839         if ( $aMustFillFields = $this->getMustFillFields() ) {
02840             if ( isset( $aMustFillFields[$sField] ) ) {
02841                 return true;
02842             }
02843         }
02844 
02845         return false;
02846     }
02847 
02853     public function getFormId()
02854     {
02855         if ( $this->_sFormId === null ) {
02856             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02857             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02858         }
02859 
02860         return $this->_sFormId;
02861     }
02862 
02868     public function canAcceptFormData()
02869     {
02870         if ( $this->_blCanAcceptFormData === null ) {
02871             $this->_blCanAcceptFormData = false;
02872 
02873             $sFormId = oxConfig::getParameter( "uformid" );
02874             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02875 
02876             // testing if form and session ids matches
02877             if ( $sFormId && $sFormId === $sSessionFormId ) {
02878                 $this->_blCanAcceptFormData = true;
02879             }
02880 
02881             // regenerating form data
02882             $this->getFormId();
02883         }
02884         return $this->_blCanAcceptFormData;
02885     }
02886 
02892     public function getPromoFinishedList()
02893     {
02894         if (isset($this->_oPromoFinishedList)) {
02895             return $this->_oPromoFinishedList;
02896         }
02897         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02898         $this->_oPromoFinishedList->loadFinishedByCount(2);
02899         return $this->_oPromoFinishedList;
02900     }
02901 
02907     public function getPromoCurrentList()
02908     {
02909         if (isset($this->_oPromoCurrentList)) {
02910             return $this->_oPromoCurrentList;
02911         }
02912         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02913         $this->_oPromoCurrentList->loadCurrent();
02914         return $this->_oPromoCurrentList;
02915     }
02916 
02922     public function getPromoFutureList()
02923     {
02924         if (isset($this->_oPromoFutureList)) {
02925             return $this->_oPromoFutureList;
02926         }
02927         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02928         $this->_oPromoFutureList->loadFutureByCount(2);
02929         return $this->_oPromoFutureList;
02930     }
02931 
02937     public function getShowPromotionList()
02938     {
02939         if (isset($this->_blShowPromotions)) {
02940             return $this->_blShowPromotions;
02941         }
02942         $this->_blShowPromotions = false;
02943         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02944             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02945         }
02946         return $this->_blShowPromotions;
02947     }
02948 
02949 }