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         return $this->_sViewId."|".( (int) $this->_blForceNoIndex );
00598     }
00599 
00600 
00606     public function showSorting()
00607     {
00608         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00609     }
00610 
00618     public function setComponents( $aComponents = null )
00619     {
00620         $this->_oaComponents = $aComponents;
00621     }
00622 
00628     public function getComponents()
00629     {
00630         return $this->_oaComponents;
00631     }
00632 
00640     public function setIsOrderStep( $blIsOrderStep = null )
00641     {
00642         $this->_blIsOrderStep = $blIsOrderStep;
00643     }
00644 
00650     public function getIsOrderStep()
00651     {
00652         return $this->_blIsOrderStep;
00653     }
00654 
00655 
00663     public function setActiveCategory( $oCategory )
00664     {
00665         $this->_oActCategory = $oCategory;
00666     }
00667 
00673     public function getActiveCategory()
00674     {
00675         return $this->_oActCategory;
00676     }
00677 
00685     public function setIsCallForCache( $blIsCallForCache = null )
00686     {
00687         $this->_blIsCallForCache = $blIsCallForCache;
00688     }
00689 
00695     public function getIsCallForCache()
00696     {
00697         return $this->_blIsCallForCache;
00698     }
00699 
00705     public function getListType()
00706     {
00707         if ( $this->_sListType == null ) {
00708             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00709                 $this->_sListType = $sListType;
00710             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00711                 $this->_sListType = $sListType;
00712             }
00713         }
00714         return $this->_sListType;
00715     }
00716 
00724     public function setListType( $sType )
00725     {
00726         $this->_sListType = $sType;
00727         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00728     }
00729 
00735     public function showRightBasket()
00736     {
00737         if ( $this->_blShowRightBasket === null ) {
00738             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00739                 $this->_blShowRightBasket = $blShowRightBasket;
00740             }
00741         }
00742         return $this->_blShowRightBasket;
00743     }
00744 
00752     public function setShowRightBasket( $blShowBasket )
00753     {
00754         $this->_blShowRightBasket = $blShowBasket;
00755     }
00756 
00762     public function showLeftBasket()
00763     {
00764         if ( $this->_blShowLeftBasket === null ) {
00765             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00766                 $this->_blShowLeftBasket = $blShowLeftBasket;
00767             }
00768         }
00769         return $this->_blShowLeftBasket;
00770     }
00771 
00779     public function setShowLeftBasket( $blShowBasket )
00780     {
00781         $this->_blShowLeftBasket = $blShowBasket;
00782     }
00783 
00789     public function showTopBasket()
00790     {
00791         if ( $this->_blShowTopBasket === null ) {
00792             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00793                 $this->_blShowTopBasket = $blShowTopBasket;
00794             }
00795         }
00796         return $this->_blShowTopBasket;
00797     }
00798 
00806     public function setShowTopBasket( $blShowBasket )
00807     {
00808         $this->_blShowTopBasket = $blShowBasket;
00809     }
00810 
00816     public function loadCurrency()
00817     {
00818         if ( $this->_blLoadCurrency == null ) {
00819             $this->_blLoadCurrency = false;
00820             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00821                 $this->_blLoadCurrency = $blLoadCurrency;
00822             }
00823         }
00824         return $this->_blLoadCurrency;
00825     }
00826 
00832     public function loadVendorTree()
00833     {
00834         if ( $this->_blLoadVendorTree == null ) {
00835             $this->_blLoadVendorTree = false;
00836             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00837                 $this->_blLoadVendorTree = $blLoadVendorTree;
00838             }
00839         }
00840         return $this->_blLoadVendorTree;
00841     }
00842 
00848     public function loadManufacturerTree()
00849     {
00850         if ( $this->_blLoadManufacturerTree == null ) {
00851             $this->_blLoadManufacturerTree = false;
00852             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00853                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00854             }
00855         }
00856         return $this->_blLoadManufacturerTree;
00857     }
00858 
00864     public function dontShowEmptyCategories()
00865     {
00866         if ( $this->_blDontShowEmptyCats == null ) {
00867             $this->_blDontShowEmptyCats = false;
00868             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00869                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00870             }
00871         }
00872         return $this->_blDontShowEmptyCats;
00873     }
00874 
00880     public function isLanguageLoaded()
00881     {
00882         if ( $this->_blLoadLanguage == null ) {
00883             $this->_blLoadLanguage = false;
00884             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00885                 $this->_blLoadLanguage = $blLoadLanguage;
00886             }
00887         }
00888         return $this->_blLoadLanguage;
00889     }
00890 
00896     public function showTopCatNavigation()
00897     {
00898         if ( $this->_blShowTopCatNav == null ) {
00899             $this->_blShowTopCatNav = false;
00900             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00901                 $this->_blShowTopCatNav = $blShowTopCatNav;
00902             }
00903         }
00904         return $this->_blShowTopCatNav;
00905     }
00906 
00912     public function getTopNavigationCatCnt()
00913     {
00914         if ( $this->_iTopCatNavItmCnt == null ) {
00915             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00916             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00917         }
00918         return $this->_iTopCatNavItmCnt;
00919     }
00920 
00930     public function addRssFeed($sTitle, $sUrl, $key = null)
00931     {
00932         if (!is_array($this->_aRssLinks)) {
00933             $this->_aRssLinks = array();
00934         }
00935         if ($key === null) {
00936             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00937         } else {
00938             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00939         }
00940 
00941         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00942     }
00943 
00958     public function prepareSortColumns()
00959     {
00960         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00961         if ( count( $aSortColumns ) > 0 ) {
00962 
00963             $this->_blActiveSorting = true;
00964             $this->_aSortColumns = $aSortColumns;
00965 
00966             $sCnid = oxConfig::getParameter( 'cnid' );
00967 
00968             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00969             $sSortDir = oxConfig::getParameter( 'listorder' );
00970 
00971             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00972                 $sSortBy  = $aSorting['sortby'];
00973                 $sSortDir = $aSorting['sortdir'];
00974             }
00975 
00976             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00977                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00978 
00979                 $this->_sListOrderBy  = $sSortBy;
00980                 $this->_sListOrderDir = $sSortDir;
00981 
00982                 // caching sorting config
00983                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00984             }
00985         }
00986     }
00987 
00993     public function getListOrderBy()
00994     {
00995         return $this->_sListOrderBy;
00996     }
00997 
01003     public function getListOrderDirection()
01004     {
01005         return $this->_sListOrderDir;
01006     }
01007 
01015     public function setMetaDescription ( $sDescription )
01016     {
01017         return $this->_sMetaDescription = $sDescription;
01018     }
01019 
01027     public function setMetaKeywords( $sKeywords )
01028     {
01029         return $this->_sMetaKeywords = $sKeywords;
01030     }
01031 
01040     protected function _getMetaSeoParam()
01041     {
01042     }
01043 
01051     protected function _getMetaFromSeo( $sDataType )
01052     {
01053         $sOxid  = $this->_getSeoObjectId();
01054         $iLang  = oxLang::getInstance()->getBaseLanguage();
01055         $sShop  = $this->getConfig()->getShopId();
01056 
01057         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01058              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01059             return $sKeywords;
01060         }
01061     }
01062 
01070     protected function _getMetaFromContent( $sMetaIdent )
01071     {
01072         if ( $sMetaIdent ) {
01073             $oContent = oxNew( 'oxcontent' );
01074             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01075                  $oContent->oxcontents__oxactive->value ) {
01076                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01077             }
01078         }
01079     }
01080 
01086     public function getMetaKeywords()
01087     {
01088         if ( $this->_sMetaKeywords === null ) {
01089             $this->_sMetaKeywords = false;
01090 
01091             // set special meta keywords ?
01092             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01093                 $this->_sMetaKeywords = $sKeywords;
01094             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01095                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01096             } else {
01097                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01098             }
01099         }
01100 
01101         return $this->_sMetaKeywords;
01102     }
01103 
01109     public function getMetaDescription()
01110     {
01111         if ( $this->_sMetaDescription === null ) {
01112             $this->_sMetaDescription = false;
01113 
01114             // set special meta description ?
01115             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01116                 $this->_sMetaDescription = $sDescription;
01117             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01118                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01119             } else {
01120                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01121             }
01122         }
01123 
01124         return $this->_sMetaDescription;
01125     }
01126 
01132     public function getActCurrency()
01133     {
01134         return $this->_oActCurrency;
01135     }
01136 
01144     public function setActCurrency( $oCur )
01145     {
01146         $this->_oActCurrency = $oCur;
01147     }
01148 
01154     public function getCompareItemsCnt()
01155     {
01156         return $this->_iCompItemsCnt;
01157     }
01158 
01166     public function setCompareItemsCnt( $iCount )
01167     {
01168         $this->_iCompItemsCnt = $iCount;
01169     }
01170 
01176     public function getWishlistName()
01177     {
01178         return $this->_sWishlistName;
01179     }
01180 
01188     public function setWishlistName( $sName )
01189     {
01190         $this->_sWishlistName = $sName;
01191     }
01192 
01198     protected function _forceNoIndex()
01199     {
01200         $this->_blForceNoIndex = true;
01201     }
01202 
01209     public function noIndex()
01210     {
01211         if ( $this->_blForceNoIndex ) {
01212             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01213         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01214             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01215         } else {
01216             switch ( oxConfig::getParameter( 'fnc' ) ) {
01217                 case 'tocomparelist':
01218                 case 'tobasket':
01219                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01220                     break;
01221             }
01222         }
01223         return $this->_iViewIndexState;
01224     }
01225 
01232     public function getContentId()
01233     {
01234         if ( $this->_sContentId === null) {
01235             $oContent = oxNew( 'oxcontent' );
01236             $oContent->loadByIdent( 'oximpressum' );
01237             $this->_sContentId = $oContent->getId();
01238         }
01239 
01240         return $this->_sContentId;
01241     }
01242 
01249     public function getContent()
01250     {
01251         if ( $this->_oContent === null) {
01252             $oContent = oxNew( 'oxcontent' );
01253             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01254                 $this->_oContent = $oContent;
01255             }
01256         }
01257 
01258         return $this->_oContent;
01259     }
01260 
01266     public function isSortingActive()
01267     {
01268         return $this->_blActiveSorting;
01269     }
01270 
01276     public function getMenueList()
01277     {
01278         return $this->_aMenueList;
01279     }
01280 
01288     public function setMenueList( $aMenue )
01289     {
01290         $this->_aMenueList = $aMenue;
01291     }
01292 
01293 
01299     protected function _setNrOfArtPerPage()
01300     {
01301         $myConfig  = $this->getConfig();
01302         $aViewData = array();
01303 
01304         //setting default values to avoid possible errors showing article list
01305         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01306         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01307 
01308         // checking if all needed data is set
01309         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01310         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01311             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01312         } else {
01313             $iNrofCatArticles = $aNrofCatArticles[0];
01314         }
01315 
01316         $oViewConf = $this->getViewConfig();
01317         //value from user input
01318         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01319             // M45 Possibility to push any "Show articles per page" number parameter
01320             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01321             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01322             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01323         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01324             // M45 Possibility to push any "Show articles per page" number parameter
01325             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01326             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01327             $iNrofCatArticles = $iSessArtPerPage;
01328         } else {
01329             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01330         }
01331 
01332         //setting number of articles per page to config value
01333         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01334 
01335         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01336     }
01337 
01343     protected function _getSeoObjectId()
01344     {
01345     }
01346 
01356     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01357     {
01358         if ( $sMeta ) {
01359 
01360             $oStr = getStr();
01361             if ( $iLength != -1 ) {
01362                 /* *
01363                  * performance - we dont need a huge amount of initial text.
01364                  * assume that effective text may be double longer than $iLength
01365                  * and simple turncate it
01366                  */
01367                 $iELength = ( $iLength * 2 );
01368                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01369             }
01370 
01371             // decoding html entities
01372             $sMeta = $oStr->html_entity_decode( $sMeta );
01373             // stripping HTML tags
01374             $sMeta = strip_tags( $sMeta );
01375 
01376             // removing some special chars
01377             $sMeta = $oStr->cleanStr( $sMeta );
01378 
01379             // removing duplicate words
01380             if ( $blRemoveDuplicatedWords ) {
01381                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01382             }
01383 
01384             // some special cases
01385             $sMeta = str_replace( ' ,', ',', $sMeta );
01386             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01387             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01388             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01389 
01390             return trim( $sMeta );
01391         }
01392     }
01393 
01402     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01403     {
01404 
01405         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01406 
01407         if ( $blRemoveDuplicatedWords ) {
01408             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01409         }
01410 
01411         // removing in admin defined strings
01412 
01413         /*if ( is_array( $aSkipTags ) && $sString ) {
01414             $oStr = getStr();
01415             foreach ( $aSkipTags as $sSkip ) {
01416                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01417                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01418                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01419                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01420             }
01421         }*/
01422 
01423         return trim( $sString );
01424     }
01425 
01434     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01435     {
01436         $oStr = getStr();
01437         if ( is_array( $aInput ) ) {
01438             $aStrings = $aInput;
01439         } else {
01440             //is String
01441             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01442         }
01443 
01444         if ( $sCount = count( $aSkipTags ) ) {
01445             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01446                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01447             }
01448         }
01449         $sCount = count($aStrings);
01450         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01451             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01452             // removing in admin defined strings
01453             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01454                 unset( $aStrings[$iNum] );
01455             }
01456         }
01457 
01458         // duplicates
01459         $aStrings = array_unique($aStrings);
01460 
01461         return implode( ', ', $aStrings );
01462     }
01463 
01471     public function getNavigationParams()
01472     {
01473         $aParams['cnid'] = $this->getCategoryId();
01474         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01475 
01476         $aParams['listtype'] = $this->getListType();
01477         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01478 
01479         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01480         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01481         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01482 
01483         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01484         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01485         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01486 
01487         return $aParams;
01488     }
01489 
01499     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01500     {
01501         $aSorting = oxSession::getVar( 'aSorting' );
01502         $aSorting[$sCnid]['sortby']  = $sSortBy;
01503         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01504 
01505         oxSession::setVar( 'aSorting', $aSorting );
01506     }
01507 
01515     public function getSorting( $sCnid )
01516     {
01517         $aSorting = oxSession::getVar( 'aSorting' );
01518         if ( isset( $aSorting[$sCnid] ) ) {
01519             return $aSorting[$sCnid];
01520         }
01521     }
01522 
01530     public function getSortingSql( $sCnid )
01531     {
01532         $aSorting = $this->getSorting( $sCnid );
01533         if ( is_array( $aSorting ) ) {
01534             return implode( " ", $aSorting );
01535         }
01536     }
01537 
01543     public function getTitleSuffix()
01544     {
01545         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01546     }
01547 
01554     public function getTitlePrefix()
01555     {
01556         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01557     }
01558 
01567     protected function _getSubject( $iLang )
01568     {
01569         return null;
01570     }
01571 
01577     public function getDynUrlParams()
01578     {
01579         $sRet = '';
01580         $sListType = $this->getListType();
01581 
01582         switch ($sListType) {
01583             default:
01584                 break;
01585             case 'search':
01586                 $sRet .= "&amp;listtype={$sListType}";
01587                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01588                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01589                 }
01590 
01591                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01592                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01593                 }
01594                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01595                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01596                 }
01597                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01598                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01599                 }
01600                 break;
01601             case 'tag':
01602                 $sRet .= "&amp;listtype={$sListType}";
01603                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01604                     $sRet .= "&amp;searchtag={$sParam}";
01605                 }
01606                 break;
01607         }
01608 
01609         return $sRet;
01610     }
01611 
01619     public function getLink( $iLang = null )
01620     {
01621         if ( !isset( $iLang ) ) {
01622             $iLang = oxLang::getInstance()->getBaseLanguage();
01623         }
01624 
01625         $oDisplayObj = null;
01626         $blTrySeo = false;
01627         if ( oxUtils::getInstance()->seoIsActive() ) {
01628             $blTrySeo = true;
01629             $oDisplayObj = $this->_getSubject( $iLang );
01630         }
01631         $iActPageNr = $this->getActPage();
01632 
01633         if ( $oDisplayObj ) {
01634             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01635         }
01636 
01637         $myConfig = $this->getConfig();
01638 
01639         if ( $blTrySeo ) {
01640             $oEncoder = oxSeoEncoder::getInstance();
01641             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01642                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01643             }
01644         }
01645 
01646         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01647 
01648         // fallback to old non seo url
01649         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01650     }
01651 
01657     public function getCanonicalUrl()
01658     {
01659     }
01660 
01667     public function getSimilarRecommLists()
01668     {
01669     }
01670 
01678     protected function _getRequestParams( $blAddPageNr  = true )
01679     {
01680         $sClass = $this->getClassName();
01681         $sFnc   = $this->getFncName();
01682 
01683         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01684         if ( in_array( $sFnc, $aFnc ) ) {
01685             $sFnc = '';
01686         }
01687 
01688         // #680
01689         $sURL = "cl={$sClass}";
01690         if ( $sFnc ) {
01691             $sURL .= "&amp;fnc={$sFnc}";
01692         }
01693         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01694             $sURL .= "&amp;cnid={$sVal}";
01695         }
01696         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01697             $sURL .= "&amp;mnid={$sVal}";
01698         }
01699         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01700             $sURL .= "&amp;anid={$sVal}";
01701         }
01702 
01703         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01704             $sURL .= "&amp;page={$sVal}";
01705         }
01706 
01707         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01708             $sURL .= "&amp;tpl={$sVal}";
01709         }
01710 
01711         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01712         // don't include page number for navigation
01713         // it will be done in oxubase::generatePageNavigation
01714         if ( $blAddPageNr && $iPgNr > 0 ) {
01715             $sURL .= "&amp;pgNr={$iPgNr}";
01716         }
01717 
01718         // #1184M - specialchar search
01719         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01720             $sURL .= "&amp;searchparam={$sVal}";
01721         }
01722 
01723         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01724             $sURL .= "&amp;searchcnid={$sVal}";
01725         }
01726 
01727         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01728             $sURL .= "&amp;searchvendor={$sVal}";
01729         }
01730 
01731         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01732             $sURL .= "&amp;searchmanufacturer={$sVal}";
01733         }
01734 
01735         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01736             $sURL .= "&amp;searchrecomm={$sVal}";
01737         }
01738 
01739         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01740             $sURL .= "&amp;searchtag={$sVal}";
01741         }
01742 
01743         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01744             $sURL .= "&amp;recommid={$sVal}";
01745         }
01746 
01747         return $sURL;
01748     }
01749 
01755     protected function _getSeoRequestParams()
01756     {
01757         $sClass = $this->getClassName();
01758         $sFnc   = $this->getFncName();
01759 
01760         // #921 S
01761         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01762         if ( in_array( $sFnc, $aFnc ) ) {
01763             $sFnc = '';
01764         }
01765 
01766         // #680
01767         $sURL = "cl={$sClass}";
01768         if ( $sFnc ) {
01769             $sURL .= "&amp;fnc={$sFnc}";
01770         }
01771         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01772             $sURL .= "&amp;page={$sVal}";
01773         }
01774 
01775         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01776             $sURL .= "&amp;tpl={$sVal}";
01777         }
01778 
01779         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01780         if ( $iPgNr > 0 ) {
01781             $sURL .= "&amp;pgNr={$iPgNr}";
01782         }
01783 
01784         return $sURL;
01785     }
01786 
01792     public function showSearch()
01793     {
01794         $blShow = true;
01795         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01796             $blShow = false;
01797         }
01798         return (int) $blShow;
01799     }
01800 
01806     public function getRssLinks()
01807     {
01808         return $this->_aRssLinks;
01809     }
01810 
01816     public function getSortColumns()
01817     {
01818         return $this->_aSortColumns;
01819     }
01820 
01826     public function getEditTags()
01827     {
01828     }
01829 
01835     public function getRecommSearch()
01836     {
01837     }
01838 
01846     public function getReviewUserId()
01847     {
01848     }
01849 
01855     public function getPaymentList()
01856     {
01857     }
01858 
01864     public function getActiveRecommList()
01865     {
01866         if ( $this->_oActiveRecommList === null ) {
01867             $this->_oActiveRecommList = false;
01868             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01869                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01870                 $this->_oActiveRecommList->load( $sOxid );
01871             }
01872         }
01873         return $this->_oActiveRecommList;
01874     }
01875 
01881     public function getAccessoires()
01882     {
01883     }
01884 
01890     public function getCrossSelling()
01891     {
01892     }
01893 
01899     public function getSimilarProducts()
01900     {
01901     }
01902 
01910     public function getAlsoBoughtThiesProducts()
01911     {
01912     }
01913 
01919     public function getAlsoBoughtTheseProducts()
01920     {
01921     }
01922 
01928     public function getArticleId()
01929     {
01930     }
01931 
01937     public function isMoreTagsVisible()
01938     {
01939         return false;
01940     }
01941 
01947     public function getTitle()
01948     {
01949     }
01950 
01956     public function getActiveLangAbbr()
01957     {
01958         // Performance
01959         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01960             return;
01961         }
01962 
01963         if ( !isset($this->_sActiveLangAbbr ) ) {
01964             $aLanguages = oxLang::getInstance()->getLanguageArray();
01965             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01966                 if ( $oVal->selected ) {
01967                     $this->_sActiveLangAbbr = $oVal->abbr;
01968                     break;
01969                 }
01970             }
01971         }
01972 
01973         return $this->_sActiveLangAbbr;
01974     }
01975 
01989     public function addGlobalParams( $oShop = null)
01990     {
01991         $myConfig = $this->getConfig();
01992 
01993         $oViewConf = parent::addGlobalParams( $oShop );
01994 
01995         $this->_aViewData['isfiltering'] = true;
01996         $this->_aViewData['isnewsletter'] = true;
01997         $this->_aViewData['isvarianten'] = true;
01998         $this->_aViewData['isreview'] = true;
01999         $this->_aViewData['isaddsales'] = true;
02000         $this->_aViewData['isvoucher'] = true;
02001         $this->_aViewData['ispricealarm'] = true;
02002         $this->_aViewData['iswishlist'] = true;
02003         $this->_aViewData['isipayment'] = true;
02004         $this->_aViewData['istrusted'] = true;
02005         $this->_aViewData['isfiltering'] = true;
02006         $this->_aViewData['isgooglestats'] = true;
02007         $this->_aViewData['iswishlist'] = true;
02008 
02009 
02010         // show baskets
02011         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02012         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02013         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02014 
02015         // allow currency swiching
02016         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02017 
02018         // show/hide vendors
02019         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02020 
02021         // show/hide Manufacturers
02022         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02023 
02024         // show/hide empty categories
02025         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02026 
02027         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02028 
02029         // used for compatibility with older templates
02030         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02031         $this->_aViewData['urlsign']    = '&';
02032         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02033         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02034 
02035         $this->_aViewData['sListType'] = $this->getListType();
02036         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02037 
02038         // new navigation ?
02039         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02040         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02041 
02042         $this->_setNrOfArtPerPage();
02043 
02044 
02045         return $oViewConf;
02046     }
02047 
02053     public function getAdditionalParams()
02054     {
02055         if ( $this->_sAdditionalParams === null ) {
02056             // #1018A
02057             $this->_sAdditionalParams  = parent::getAdditionalParams();
02058             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02059 
02060             // #1834M - specialchar search
02061             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02062             if ( isset( $sSearchParamForLink ) ) {
02063                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02064             }
02065             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02066                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02067             }
02068             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02069                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02070             }
02071             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02072                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02073             }
02074             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02075                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02076             }
02077             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02078                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02079             }
02080             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02081                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02082             }
02083         }
02084 
02085         return $this->_sAdditionalParams;
02086     }
02087 
02093     public function generatePageNavigationUrl()
02094     {
02095         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02096     }
02097 
02107     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02108     {
02109         if ( $iPage ) {
02110             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02111         }
02112         return $sUrl;
02113     }
02114 
02120     public function generatePageNavigation()
02121     {
02122         startProfile('generatePageNavigation');
02123         // generate the page navigation
02124         $pageNavigation = new stdClass();
02125         $pageNavigation->NrOfPages = $this->_iCntPages;
02126         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02127         $iActPage = $this->getActPage();
02128         $pageNavigation->actPage   = $iActPage + 1;
02129 
02130         $sUrl = $this->generatePageNavigationUrl();
02131 
02132         if ( $iActPage > 0) {
02133             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02134         }
02135 
02136         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02137             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02138         }
02139 
02140         if ( $pageNavigation->NrOfPages > 1 ) {
02141             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02142                 $page = new Oxstdclass();
02143                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02144                 $page->selected = 0;
02145                 if ( $i == $pageNavigation->actPage ) {
02146                     $page->selected = 1;
02147                 }
02148                 $pageNavigation->changePage[$i] = $page;
02149             }
02150 
02151             // first/last one
02152             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02153             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02154         }
02155 
02156         stopProfile('generatePageNavigation');
02157 
02158         return $pageNavigation;
02159     }
02160 
02168     public function prepareMinimumOrderPrice4View()
02169     {
02170         $myConfig = $this->getConfig();
02171         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02172         if ( isset( $iMinOrderPrice ) && is_numeric($iMinOrderPrice)) {
02173             $oBasket = $this->getSession()->getBasket();
02174             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02175                 return;
02176             }
02177             $oCur    = $myConfig->getActShopCurrencyObject();
02178             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02179             // Coupons and discounts should be considered in "Min order price" check
02180             $dVoucherDiscount = 0;
02181             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02182                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02183             }
02184             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02185                 $this->_iLowOrderPrice = 1;
02186                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02187             }
02188         }
02189     }
02190 
02197     public function render()
02198     {
02199         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02200             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02201         }
02202 
02203         parent::render();
02204 
02205         if ( $this->getIsOrderStep() ) {
02206 
02207             // disabling navigation during order ...
02208             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02209                 $this->_iNewsRealStatus = 1;
02210                 $this->setShowNewsletter( 0 );
02211                 // for old tpl. will be removed later
02212                 $this->_aViewData['isnewsletter'] = 0;
02213                 $this->setShowRightBasket( 0 );
02214                 $this->setShowLeftBasket( 0 );
02215                 $this->setShowTopBasket( 0 );
02216             }
02217             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02218             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02219         }
02220 
02221         // meta data
02222         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02223         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02224 
02225         // show baskets
02226         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02227         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02228         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02229 
02230         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02231 
02232         $this->_aViewData['noindex'] = $this->noIndex();
02233 
02234         return $this->_sThisTemplate;
02235     }
02236 
02242     public function getViewProduct()
02243     {
02244         return $this->getProduct();
02245     }
02246 
02254     public function setViewProduct( $oProduct )
02255     {
02256         $this->_oProduct = $oProduct;
02257     }
02258 
02264     public function getViewProductList()
02265     {
02266         return $this->_aArticleList;
02267     }
02268 
02274     public function getActPage()
02275     {
02276         if ( $this->_iActPage === null ) {
02277             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02278             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02279         }
02280         return $this->_iActPage;
02281     }
02282 
02290     public function getActTag()
02291     {
02292         if ( $this->_oActTag === null ) {
02293             $this->_oActTag = new Oxstdclass();
02294             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02295             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02296 
02297             if ( oxUtils::getInstance()->seoIsActive() ) {
02298                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02299             } else {
02300                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02301             }
02302 
02303         }
02304         return $this->_oActTag;
02305     }
02306 
02314     public function getActVendor()
02315     {
02316         // if active vendor is not set yet - trying to load it from request params
02317         // this may be usefull when category component was unable to load active vendor
02318         // and we still need some object to mount navigation info
02319         if ( $this->_oActVendor === null ) {
02320             $this->_oActVendor = false;
02321             $sVendorId = oxConfig::getParameter( 'cnid' );
02322             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02323             $oVendor = oxNew( 'oxvendor' );
02324             if ( $oVendor->load( $sVendorId ) ) {
02325                 $this->_oActVendor = $oVendor;
02326             }
02327         }
02328 
02329         return $this->_oActVendor;
02330     }
02331 
02339     public function getActManufacturer()
02340     {
02341         // if active Manufacturer is not set yet - trying to load it from request params
02342         // this may be usefull when category component was unable to load active Manufacturer
02343         // and we still need some object to mount navigation info
02344         if ( $this->_oActManufacturer === null ) {
02345 
02346             $this->_oActManufacturer = false;
02347             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02348             $oManufacturer = oxNew( 'oxmanufacturer' );
02349             if ( $oManufacturer->load( $sManufacturerId ) ) {
02350                 $this->_oActManufacturer = $oManufacturer;
02351             }
02352         }
02353 
02354         return $this->_oActManufacturer;
02355     }
02356 
02364     public function setActVendor( $oVendor )
02365     {
02366         $this->_oActVendor = $oVendor;
02367     }
02368 
02376     public function setActManufacturer( $oManufacturer )
02377     {
02378         $this->_oActManufacturer = $oManufacturer;
02379     }
02380 
02386     public function getActSearch()
02387     {
02388         if ( $this->_oActSearch === null ) {
02389             $this->_oActSearch = new oxStdClass();
02390             $sUrl = $this->getConfig()->getShopHomeURL();
02391             $this->_oActSearch->link = "{$sUrl}cl=search";
02392         }
02393         return $this->_oActSearch;
02394     }
02395 
02403     public function getActRecommList()
02404     {
02405         return $this->getActiveRecommList();
02406     }
02407 
02413     public function getCategoryTree()
02414     {
02415         return $this->_oCategoryTree;
02416     }
02417 
02425     public function setCategoryTree( $oCatTree )
02426     {
02427         $this->_oCategoryTree = $oCatTree;
02428     }
02429 
02435     public function getVendorTree()
02436     {
02437         return $this->_oVendorTree;
02438     }
02439 
02447     public function setVendorTree( $oVendorTree )
02448     {
02449         $this->_oVendorTree = $oVendorTree;
02450     }
02451 
02457     public function getManufacturerTree()
02458     {
02459         return $this->_oManufacturerTree;
02460     }
02461 
02469     public function setManufacturerTree( $oManufacturerTree )
02470     {
02471         $this->_oManufacturerTree = $oManufacturerTree;
02472     }
02482     protected function _loadActions()
02483     {
02484         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02485         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02486     }
02487 
02493     public function getAddUrlParams()
02494     {
02495     }
02496 
02503     public function getTop5ArticleList()
02504     {
02505         if ( $this->_blTop5Action ) {
02506             if ( $this->_aTop5ArticleList === null ) {
02507                 $this->_aTop5ArticleList = false;
02508                 $myConfig = $this->getConfig();
02509                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02510                     // top 5 articles
02511                     $oArtList = oxNew( 'oxarticlelist' );
02512                     $oArtList->loadTop5Articles();
02513                     if ( $oArtList->count() ) {
02514                         $this->_aTop5ArticleList = $oArtList;
02515                     }
02516                 }
02517             }
02518         }
02519         return $this->_aTop5ArticleList;
02520     }
02521 
02528     public function getBargainArticleList()
02529     {
02530         if ( $this->_blBargainAction ) {
02531             if ( $this->_aBargainArticleList === null ) {
02532                 $this->_aBargainArticleList = array();
02533                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02534                     $oArtList = oxNew( 'oxarticlelist' );
02535                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02536                     if ( $oArtList->count() ) {
02537                         $this->_aBargainArticleList = $oArtList;
02538                     }
02539                 }
02540             }
02541         }
02542         return $this->_aBargainArticleList;
02543     }
02544 
02551     public function isLowOrderPrice()
02552     {
02553         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02554             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02555         }
02556 
02557         return $this->_blLowOrderPrice;
02558     }
02559 
02565     public function getMinOrderPrice()
02566     {
02567         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02568             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02569             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02570         }
02571         return $this->_sMinOrderPrice;
02572     }
02573 
02579     public function getNewsRealStatus()
02580     {
02581         return $this->_iNewsRealStatus;
02582     }
02583 
02589     protected function _canRedirect()
02590     {
02591         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02592             if ( oxConfig::getParameter( $sParam ) !== null ) {
02593                 return false;
02594             }
02595         }
02596 
02597         return true;
02598     }
02599 
02605     public function getProduct()
02606     {
02607     }
02608 
02614     public function getVendorlist()
02615     {
02616         return $this->_aVendorlist;
02617     }
02618 
02626     public function setVendorlist( $aList )
02627     {
02628         $this->_aVendorlist = $aList;
02629     }
02630 
02636     public function getManufacturerlist()
02637     {
02638         return $this->_aManufacturerlist;
02639     }
02640 
02648     public function setManufacturerlist( $aList )
02649     {
02650         $this->_aManufacturerlist = $aList;
02651     }
02652 
02660     public function setRootVendor( $oVendor )
02661     {
02662         $this->_oRootVendor = $oVendor;
02663     }
02664 
02670     public function getRootVendor()
02671     {
02672         return $this->_oRootVendor;
02673     }
02674 
02682     public function setRootManufacturer( $oManufacturer )
02683     {
02684         $this->_oRootManufacturer = $oManufacturer;
02685     }
02686 
02692     public function getRootManufacturer()
02693     {
02694         return $this->_oRootManufacturer;
02695     }
02696 
02702     public function getVendorId()
02703     {
02704         if ( $this->_sVendorId === null ) {
02705             $this->_sVendorId = false;
02706             if ( ( $oVendor = $this->getActVendor() ) ) {
02707                 $this->_sVendorId = $oVendor->getId();
02708             }
02709         }
02710         return $this->_sVendorId;
02711     }
02712 
02718     public function getManufacturerId()
02719     {
02720         if ( $this->_sManufacturerId === null ) {
02721             $this->_sManufacturerId = false;
02722             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02723                 $this->_sManufacturerId = $oManufacturer->getId();
02724             }
02725         }
02726         return $this->_sManufacturerId;
02727     }
02728 
02734     public function getSearchCatTree()
02735     {
02736         return $this->_aSearchCatTree;
02737     }
02738 
02746     public function setSearchCatTree( $aTree )
02747     {
02748         $this->_aSearchCatTree = $aTree;
02749     }
02750 
02756     public function getCatMore()
02757     {
02758         return $this->_oCatMore;
02759     }
02760 
02768     public function setCatMore( $oCat )
02769     {
02770         $this->_oCatMore = $oCat;
02771     }
02772 
02778     public function getCatTreePath()
02779     {
02780         return $this->_sCatTreePath;
02781     }
02782 
02790     public function getContentByIdent( $sIdent )
02791     {
02792         if ( !isset( $this->_aContents[$sIdent] ) ) {
02793             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02794             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02795         }
02796         return $this->_aContents[$sIdent];
02797     }
02798 
02804     public function getContentCategory()
02805     {
02806         return false;
02807     }
02808 
02814     public function getMustFillFields()
02815     {
02816         if ( $this->_aMustFillFields === null ) {
02817             $this->_aMustFillFields = false;
02818 
02819             // passing must-be-filled-fields info
02820             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02821             if ( is_array( $aMustFillFields ) ) {
02822                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02823             }
02824         }
02825         return $this->_aMustFillFields;
02826     }
02827 
02835     public function isFieldRequired( $sField )
02836     {
02837         if ( $aMustFillFields = $this->getMustFillFields() ) {
02838             if ( isset( $aMustFillFields[$sField] ) ) {
02839                 return true;
02840             }
02841         }
02842 
02843         return false;
02844     }
02845 
02851     public function getFormId()
02852     {
02853         if ( $this->_sFormId === null ) {
02854             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02855             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02856         }
02857 
02858         return $this->_sFormId;
02859     }
02860 
02866     public function canAcceptFormData()
02867     {
02868         if ( $this->_blCanAcceptFormData === null ) {
02869             $this->_blCanAcceptFormData = false;
02870 
02871             $sFormId = oxConfig::getParameter( "uformid" );
02872             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02873 
02874             // testing if form and session ids matches
02875             if ( $sFormId && $sFormId === $sSessionFormId ) {
02876                 $this->_blCanAcceptFormData = true;
02877             }
02878 
02879             // regenerating form data
02880             $this->getFormId();
02881         }
02882         return $this->_blCanAcceptFormData;
02883     }
02884 
02890     public function getPromoFinishedList()
02891     {
02892         if (isset($this->_oPromoFinishedList)) {
02893             return $this->_oPromoFinishedList;
02894         }
02895         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02896         $this->_oPromoFinishedList->loadFinishedByCount(2);
02897         return $this->_oPromoFinishedList;
02898     }
02899 
02905     public function getPromoCurrentList()
02906     {
02907         if (isset($this->_oPromoCurrentList)) {
02908             return $this->_oPromoCurrentList;
02909         }
02910         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02911         $this->_oPromoCurrentList->loadCurrent();
02912         return $this->_oPromoCurrentList;
02913     }
02914 
02920     public function getPromoFutureList()
02921     {
02922         if (isset($this->_oPromoFutureList)) {
02923             return $this->_oPromoFutureList;
02924         }
02925         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02926         $this->_oPromoFutureList->loadFutureByCount(2);
02927         return $this->_oPromoFutureList;
02928     }
02929 
02935     public function getShowPromotionList()
02936     {
02937         if (isset($this->_blShowPromotions)) {
02938             return $this->_blShowPromotions;
02939         }
02940         $this->_blShowPromotions = false;
02941         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02942             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02943         }
02944         return $this->_blShowPromotions;
02945     }
02946 
02947 }