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 
00220     protected $_blEnabledPrivateSales = null;
00221 
00228     protected $_blCommonAdded = false;
00229 
00236     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00237 
00244     protected $_blForceNoIndex = false;
00245 
00250     protected $_sWishlistName = null;
00251 
00256     protected $_iCompItemsCnt = null;
00257 
00263     protected $_sContentId = null;
00264 
00270     protected $_oContent = null;
00271 
00277     protected $_sViewResetID = null;
00278 
00283     protected $_blActiveSorting = null;
00284 
00289     protected $_aMenueList = null;
00290 
00296     protected $_aComponentNames = array(
00297                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00298                                     'oxcmp_lang'       => 1,
00299                                     'oxcmp_cur'        => 1,
00300                                     'oxcmp_shop'       => 1,
00301                                     'oxcmp_categories' => 0,
00302                                     'oxcmp_utils'      => 1,
00303                                     'oxcmp_news'       => 0,
00304                                     'oxcmp_basket'     => 1
00305                                   );
00306 
00312     protected $_aUserComponentNames = array();
00313 
00319     protected $_oProduct = null;
00320 
00325     protected $_iActPage = null;
00326 
00331     protected $_aArticleList = null;
00332 
00337     protected $_oVendorTree  = null;
00338 
00343     protected $_oManufacturerTree  = null;
00344 
00349     protected $_oCategoryTree  = null;
00350 
00355     protected $_aTop5ArticleList  = null;
00356 
00361     protected $_aBargainArticleList  = null;
00362 
00367     protected $_blLowOrderPrice = null;
00368 
00376     protected $_iLowOrderPrice  = null;
00377 
00382     protected $_sMinOrderPrice  = null;
00383 
00388     protected $_iNewsRealStatus  = null;
00389 
00394     protected $_aBlockRedirectParams = array( 'fnc' );
00395 
00400     protected $_aVendorlist = null;
00401 
00406     protected $_oRootVendor = null;
00407 
00412     protected $_sVendorId = null;
00413 
00418     protected $_aManufacturerlist = null;
00419 
00424     protected $_oRootManufacturer = null;
00425 
00430     protected $_sManufacturerId = null;
00431 
00436     protected $_aSearchCatTree = null;
00437 
00442     protected $_oCatMore = null;
00443 
00448     protected $_blNewsSubscribed = null;
00449 
00454     protected $_blShowShipAddress = null;
00455 
00460     protected $_oDelAddress = null;
00461 
00466     protected $_sCatTreePath = null;
00467 
00472     protected $_aContents = array();
00473 
00478     protected $_blTop5Action = false;
00479 
00484     protected $_blBargainAction = false;
00485 
00491     protected $_aMustFillFields = null;
00492 
00501     protected function _processRequest()
00502     {
00503         $myUtils = oxUtils::getInstance();
00504 
00505         // non admin, request is not empty and was not processed by seo engine
00506         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00507 
00508             // fetching standard url and looking for it in seo table
00509             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00510                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00511             } else {
00512                 // forcing to set noindex/follow meta
00513                 $this->_forceNoIndex();
00514 
00515                 $sShopId = $this->getConfig()->getShopId();
00516                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00517                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00518 
00519                 // logging "not found" url
00520                 $oDb = oxDb::getDb();
00521                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00522                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00523             }
00524         }
00525     }
00526 
00533     public function init()
00534     {
00535         $this->_processRequest();
00536 
00537         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00538             unset( $this->_aComponentNames['oxcmp_basket'] );
00539         }
00540 
00541         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00542         if ( !$this->_blCommonAdded ) {
00543             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00544             $this->_blCommonAdded = true;
00545         }
00546 
00547         // storing current view
00548         $blInit = true;
00549 
00550 
00551         // init all components if there are any
00552         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00553             // do not override initiated components
00554             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00555                 // component objects MUST be created to support user called functions
00556                 $oComponent = oxNew( $sComponentName );
00557                 $oComponent->setParent( $this );
00558                 $oComponent->setThisAction( $sComponentName );
00559                 $this->_oaComponents[$sComponentName] = $oComponent;
00560             }
00561 
00562             // do we really need to initiate them ?
00563             if ( $blInit ) {
00564                 $this->_oaComponents[$sComponentName]->init();
00565 
00566                 // executing only is view does not have action method
00567                 if ( !method_exists( $this, $this->getFncName() ) ) {
00568                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00569                 }
00570             }
00571         }
00572 
00573         parent::init();
00574 
00575         // enable sorting ?
00576         if ( $this->showSorting() ) {
00577             $this->prepareSortColumns();
00578         }
00579         $this->_aViewData['showsorting']    = $this->isSortingActive();
00580         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00581         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00582         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00583     }
00584 
00591     public function getViewId()
00592     {
00593         if ( $this->_sViewId ) {
00594             return $this->_sViewId;
00595         }
00596 
00597         $iLang = oxLang::getInstance()->getBaseLanguage();
00598         $iCur  = (int) oxConfig::getParameter( 'currency' );
00599 
00600 
00601             $this->_sViewId =  "ox|$iLang|$iCur";
00602 
00603         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex );
00604 
00605         return $this->_sViewId;
00606     }
00607 
00608 
00614     public function showSorting()
00615     {
00616         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00617     }
00618 
00626     public function setComponents( $aComponents = null )
00627     {
00628         $this->_oaComponents = $aComponents;
00629     }
00630 
00636     public function getComponents()
00637     {
00638         return $this->_oaComponents;
00639     }
00640 
00648     public function setIsOrderStep( $blIsOrderStep = null )
00649     {
00650         $this->_blIsOrderStep = $blIsOrderStep;
00651     }
00652 
00658     public function getIsOrderStep()
00659     {
00660         return $this->_blIsOrderStep;
00661     }
00662 
00663 
00671     public function setActiveCategory( $oCategory )
00672     {
00673         $this->_oActCategory = $oCategory;
00674     }
00675 
00681     public function getActiveCategory()
00682     {
00683         return $this->_oActCategory;
00684     }
00685 
00693     public function setIsCallForCache( $blIsCallForCache = null )
00694     {
00695         $this->_blIsCallForCache = $blIsCallForCache;
00696     }
00697 
00703     public function getIsCallForCache()
00704     {
00705         return $this->_blIsCallForCache;
00706     }
00707 
00713     public function getListType()
00714     {
00715         if ( $this->_sListType == null ) {
00716             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00717                 $this->_sListType = $sListType;
00718             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00719                 $this->_sListType = $sListType;
00720             }
00721         }
00722         return $this->_sListType;
00723     }
00724 
00732     public function setListType( $sType )
00733     {
00734         $this->_sListType = $sType;
00735         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00736     }
00737 
00743     public function showRightBasket()
00744     {
00745         if ( $this->_blShowRightBasket === null ) {
00746             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00747                 $this->_blShowRightBasket = $blShowRightBasket;
00748             }
00749         }
00750         return $this->_blShowRightBasket;
00751     }
00752 
00760     public function setShowRightBasket( $blShowBasket )
00761     {
00762         $this->_blShowRightBasket = $blShowBasket;
00763     }
00764 
00770     public function showLeftBasket()
00771     {
00772         if ( $this->_blShowLeftBasket === null ) {
00773             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00774                 $this->_blShowLeftBasket = $blShowLeftBasket;
00775             }
00776         }
00777         return $this->_blShowLeftBasket;
00778     }
00779 
00787     public function setShowLeftBasket( $blShowBasket )
00788     {
00789         $this->_blShowLeftBasket = $blShowBasket;
00790     }
00791 
00797     public function showTopBasket()
00798     {
00799         if ( $this->_blShowTopBasket === null ) {
00800             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00801                 $this->_blShowTopBasket = $blShowTopBasket;
00802             }
00803         }
00804         return $this->_blShowTopBasket;
00805     }
00806 
00814     public function setShowTopBasket( $blShowBasket )
00815     {
00816         $this->_blShowTopBasket = $blShowBasket;
00817     }
00818 
00824     public function loadCurrency()
00825     {
00826         if ( $this->_blLoadCurrency == null ) {
00827             $this->_blLoadCurrency = false;
00828             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00829                 $this->_blLoadCurrency = $blLoadCurrency;
00830             }
00831         }
00832         return $this->_blLoadCurrency;
00833     }
00834 
00840     public function loadVendorTree()
00841     {
00842         if ( $this->_blLoadVendorTree == null ) {
00843             $this->_blLoadVendorTree = false;
00844             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00845                 $this->_blLoadVendorTree = $blLoadVendorTree;
00846             }
00847         }
00848         return $this->_blLoadVendorTree;
00849     }
00850 
00856     public function loadManufacturerTree()
00857     {
00858         if ( $this->_blLoadManufacturerTree == null ) {
00859             $this->_blLoadManufacturerTree = false;
00860             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00861                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00862             }
00863         }
00864         return $this->_blLoadManufacturerTree;
00865     }
00866 
00872     public function dontShowEmptyCategories()
00873     {
00874         if ( $this->_blDontShowEmptyCats == null ) {
00875             $this->_blDontShowEmptyCats = false;
00876             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00877                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00878             }
00879         }
00880         return $this->_blDontShowEmptyCats;
00881     }
00882 
00888     public function isLanguageLoaded()
00889     {
00890         if ( $this->_blLoadLanguage == null ) {
00891             $this->_blLoadLanguage = false;
00892             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00893                 $this->_blLoadLanguage = $blLoadLanguage;
00894             }
00895         }
00896         return $this->_blLoadLanguage;
00897     }
00898 
00904     public function showTopCatNavigation()
00905     {
00906         if ( $this->_blShowTopCatNav == null ) {
00907             $this->_blShowTopCatNav = false;
00908             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00909                 $this->_blShowTopCatNav = $blShowTopCatNav;
00910             }
00911         }
00912         return $this->_blShowTopCatNav;
00913     }
00914 
00920     public function getTopNavigationCatCnt()
00921     {
00922         if ( $this->_iTopCatNavItmCnt == null ) {
00923             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00924             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00925         }
00926         return $this->_iTopCatNavItmCnt;
00927     }
00928 
00938     public function addRssFeed($sTitle, $sUrl, $key = null)
00939     {
00940         if (!is_array($this->_aRssLinks)) {
00941             $this->_aRssLinks = array();
00942         }
00943         if ($key === null) {
00944             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00945         } else {
00946             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00947         }
00948 
00949         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00950     }
00951 
00966     public function prepareSortColumns()
00967     {
00968         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00969         if ( count( $aSortColumns ) > 0 ) {
00970 
00971             $this->_blActiveSorting = true;
00972             $this->_aSortColumns = $aSortColumns;
00973 
00974             $sCnid = oxConfig::getParameter( 'cnid' );
00975 
00976             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00977             $sSortDir = oxConfig::getParameter( 'listorder' );
00978 
00979             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00980                 $sSortBy  = $aSorting['sortby'];
00981                 $sSortDir = $aSorting['sortdir'];
00982             }
00983 
00984             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00985                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00986 
00987                 $this->_sListOrderBy  = $sSortBy;
00988                 $this->_sListOrderDir = $sSortDir;
00989 
00990                 // caching sorting config
00991                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00992             }
00993         }
00994     }
00995 
01001     public function getListOrderBy()
01002     {
01003         return $this->_sListOrderBy;
01004     }
01005 
01011     public function getListOrderDirection()
01012     {
01013         return $this->_sListOrderDir;
01014     }
01015 
01023     public function setMetaDescription ( $sDescription )
01024     {
01025         return $this->_sMetaDescription = $sDescription;
01026     }
01027 
01035     public function setMetaKeywords( $sKeywords )
01036     {
01037         return $this->_sMetaKeywords = $sKeywords;
01038     }
01039 
01048     protected function _getMetaSeoParam()
01049     {
01050     }
01051 
01059     protected function _getMetaFromSeo( $sDataType )
01060     {
01061         $sOxid  = $this->_getSeoObjectId();
01062         $iLang  = oxLang::getInstance()->getBaseLanguage();
01063         $sShop  = $this->getConfig()->getShopId();
01064 
01065         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01066              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01067             return $sKeywords;
01068         }
01069     }
01070 
01078     protected function _getMetaFromContent( $sMetaIdent )
01079     {
01080         if ( $sMetaIdent ) {
01081             $oContent = oxNew( 'oxcontent' );
01082             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01083                  $oContent->oxcontents__oxactive->value ) {
01084                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01085             }
01086         }
01087     }
01088 
01094     public function getMetaKeywords()
01095     {
01096         if ( $this->_sMetaKeywords === null ) {
01097             $this->_sMetaKeywords = false;
01098 
01099             // set special meta keywords ?
01100             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01101                 $this->_sMetaKeywords = $sKeywords;
01102             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01103                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01104             } else {
01105                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01106             }
01107         }
01108 
01109         return $this->_sMetaKeywords;
01110     }
01111 
01117     public function getMetaDescription()
01118     {
01119         if ( $this->_sMetaDescription === null ) {
01120             $this->_sMetaDescription = false;
01121 
01122             // set special meta description ?
01123             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01124                 $this->_sMetaDescription = $sDescription;
01125             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01126                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01127             } else {
01128                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01129             }
01130         }
01131 
01132         return $this->_sMetaDescription;
01133     }
01134 
01140     public function getActCurrency()
01141     {
01142         return $this->_oActCurrency;
01143     }
01144 
01152     public function setActCurrency( $oCur )
01153     {
01154         $this->_oActCurrency = $oCur;
01155     }
01156 
01162     public function getCompareItemsCnt()
01163     {
01164         return $this->_iCompItemsCnt;
01165     }
01166 
01174     public function setCompareItemsCnt( $iCount )
01175     {
01176         $this->_iCompItemsCnt = $iCount;
01177     }
01178 
01184     public function getWishlistName()
01185     {
01186         return $this->_sWishlistName;
01187     }
01188 
01196     public function setWishlistName( $sName )
01197     {
01198         $this->_sWishlistName = $sName;
01199     }
01200 
01206     protected function _forceNoIndex()
01207     {
01208         $this->_blForceNoIndex = true;
01209     }
01210 
01217     public function noIndex()
01218     {
01219         if ( $this->_blForceNoIndex ) {
01220             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01221         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01222             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01223         } else {
01224             switch ( oxConfig::getParameter( 'fnc' ) ) {
01225                 case 'tocomparelist':
01226                 case 'tobasket':
01227                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01228                     break;
01229             }
01230         }
01231         return $this->_iViewIndexState;
01232     }
01233 
01240     public function getContentId()
01241     {
01242         if ( $this->_sContentId === null) {
01243             $oContent = oxNew( 'oxcontent' );
01244             $oContent->loadByIdent( 'oximpressum' );
01245             $this->_sContentId = $oContent->getId();
01246         }
01247 
01248         return $this->_sContentId;
01249     }
01250 
01257     public function getContent()
01258     {
01259         if ( $this->_oContent === null) {
01260             $oContent = oxNew( 'oxcontent' );
01261             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01262                 $this->_oContent = $oContent;
01263             }
01264         }
01265 
01266         return $this->_oContent;
01267     }
01268 
01274     public function isSortingActive()
01275     {
01276         return $this->_blActiveSorting;
01277     }
01278 
01284     public function getMenueList()
01285     {
01286         return $this->_aMenueList;
01287     }
01288 
01296     public function setMenueList( $aMenue )
01297     {
01298         $this->_aMenueList = $aMenue;
01299     }
01300 
01301 
01307     protected function _setNrOfArtPerPage()
01308     {
01309         $myConfig  = $this->getConfig();
01310         $aViewData = array();
01311 
01312         //setting default values to avoid possible errors showing article list
01313         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01314         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01315 
01316         // checking if all needed data is set
01317         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01318         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01319             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01320         } else {
01321             $iNrofCatArticles = $aNrofCatArticles[0];
01322         }
01323 
01324         $oViewConf = $this->getViewConfig();
01325         //value from user input
01326         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01327             // M45 Possibility to push any "Show articles per page" number parameter
01328             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01329             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01330             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01331         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01332             // M45 Possibility to push any "Show articles per page" number parameter
01333             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01334             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01335             $iNrofCatArticles = $iSessArtPerPage;
01336         } else {
01337             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01338         }
01339 
01340         //setting number of articles per page to config value
01341         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01342 
01343         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01344     }
01345 
01351     protected function _getSeoObjectId()
01352     {
01353     }
01354 
01364     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01365     {
01366         if ( $sMeta ) {
01367 
01368             $oStr = getStr();
01369             if ( $iLength != -1 ) {
01370                 /* *
01371                  * performance - we dont need a huge amount of initial text.
01372                  * assume that effective text may be double longer than $iLength
01373                  * and simple turncate it
01374                  */
01375                 $iELength = ( $iLength * 2 );
01376                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01377             }
01378 
01379             // decoding html entities
01380             $sMeta = $oStr->html_entity_decode( $sMeta );
01381             // stripping HTML tags
01382             $sMeta = strip_tags( $sMeta );
01383 
01384             // removing some special chars
01385             $sMeta = $oStr->cleanStr( $sMeta );
01386 
01387             // removing duplicate words
01388             if ( $blRemoveDuplicatedWords ) {
01389                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01390             }
01391 
01392             // some special cases
01393             $sMeta = str_replace( ' ,', ',', $sMeta );
01394             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01395             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01396             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01397 
01398             return trim( $sMeta );
01399         }
01400     }
01401 
01410     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01411     {
01412 
01413         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01414 
01415         if ( $blRemoveDuplicatedWords ) {
01416             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01417         }
01418 
01419         // removing in admin defined strings
01420 
01421         /*if ( is_array( $aSkipTags ) && $sString ) {
01422             $oStr = getStr();
01423             foreach ( $aSkipTags as $sSkip ) {
01424                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01425                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01426                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01427                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01428             }
01429         }*/
01430 
01431         return trim( $sString );
01432     }
01433 
01442     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01443     {
01444         $oStr = getStr();
01445         if ( is_array( $aInput ) ) {
01446             $aStrings = $aInput;
01447         } else {
01448             //is String
01449             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01450         }
01451 
01452         if ( $sCount = count( $aSkipTags ) ) {
01453             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01454                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01455             }
01456         }
01457         $sCount = count($aStrings);
01458         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01459             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01460             // removing in admin defined strings
01461             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01462                 unset( $aStrings[$iNum] );
01463             }
01464         }
01465 
01466         // duplicates
01467         $aStrings = array_unique($aStrings);
01468 
01469         return implode( ', ', $aStrings );
01470     }
01471 
01479     public function getNavigationParams()
01480     {
01481         $aParams['cnid'] = $this->getCategoryId();
01482         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01483 
01484         $aParams['listtype'] = $this->getListType();
01485         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01486 
01487         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01488         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01489         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01490 
01491         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01492         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01493         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01494 
01495         return $aParams;
01496     }
01497 
01507     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01508     {
01509         $aSorting = oxSession::getVar( 'aSorting' );
01510         $aSorting[$sCnid]['sortby']  = $sSortBy;
01511         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01512 
01513         oxSession::setVar( 'aSorting', $aSorting );
01514     }
01515 
01523     public function getSorting( $sCnid )
01524     {
01525         $aSorting = oxSession::getVar( 'aSorting' );
01526         if ( isset( $aSorting[$sCnid] ) ) {
01527             return $aSorting[$sCnid];
01528         }
01529     }
01530 
01538     public function getSortingSql( $sCnid )
01539     {
01540         $aSorting = $this->getSorting( $sCnid );
01541         if ( is_array( $aSorting ) ) {
01542             return implode( " ", $aSorting );
01543         }
01544     }
01545 
01551     public function getTitleSuffix()
01552     {
01553         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01554     }
01555 
01562     public function getTitlePrefix()
01563     {
01564         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01565     }
01566 
01575     protected function _getSubject( $iLang )
01576     {
01577         return null;
01578     }
01579 
01585     public function getDynUrlParams()
01586     {
01587         $sRet = '';
01588         $sListType = $this->getListType();
01589 
01590         switch ($sListType) {
01591             default:
01592                 break;
01593             case 'search':
01594                 $sRet .= "&amp;listtype={$sListType}";
01595                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01596                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01597                 }
01598 
01599                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01600                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01601                 }
01602                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01603                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01604                 }
01605                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01606                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01607                 }
01608                 break;
01609             case 'tag':
01610                 $sRet .= "&amp;listtype={$sListType}";
01611                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01612                     $sRet .= "&amp;searchtag={$sParam}";
01613                 }
01614                 break;
01615         }
01616 
01617         return $sRet;
01618     }
01619 
01627     public function getLink( $iLang = null )
01628     {
01629         if ( !isset( $iLang ) ) {
01630             $iLang = oxLang::getInstance()->getBaseLanguage();
01631         }
01632 
01633         $oDisplayObj = null;
01634         $blTrySeo = false;
01635         if ( oxUtils::getInstance()->seoIsActive() ) {
01636             $blTrySeo = true;
01637             $oDisplayObj = $this->_getSubject( $iLang );
01638         }
01639         $iActPageNr = $this->getActPage();
01640 
01641         if ( $oDisplayObj ) {
01642             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01643         }
01644 
01645         $myConfig = $this->getConfig();
01646 
01647         if ( $blTrySeo ) {
01648             $oEncoder = oxSeoEncoder::getInstance();
01649             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01650                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01651             }
01652         }
01653 
01654         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01655 
01656         // fallback to old non seo url
01657         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01658     }
01659 
01665     public function getCanonicalUrl()
01666     {
01667     }
01668 
01675     public function getSimilarRecommLists()
01676     {
01677     }
01678 
01686     protected function _getRequestParams( $blAddPageNr  = true )
01687     {
01688         $sClass = $this->getClassName();
01689         $sFnc   = $this->getFncName();
01690 
01691         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01692         if ( in_array( $sFnc, $aFnc ) ) {
01693             $sFnc = '';
01694         }
01695 
01696         // #680
01697         $sURL = "cl={$sClass}";
01698         if ( $sFnc ) {
01699             $sURL .= "&amp;fnc={$sFnc}";
01700         }
01701         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01702             $sURL .= "&amp;cnid={$sVal}";
01703         }
01704         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01705             $sURL .= "&amp;mnid={$sVal}";
01706         }
01707         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01708             $sURL .= "&amp;anid={$sVal}";
01709         }
01710 
01711         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01712             $sURL .= "&amp;page={$sVal}";
01713         }
01714 
01715         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01716             $sURL .= "&amp;tpl={$sVal}";
01717         }
01718 
01719         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01720         // don't include page number for navigation
01721         // it will be done in oxubase::generatePageNavigation
01722         if ( $blAddPageNr && $iPgNr > 0 ) {
01723             $sURL .= "&amp;pgNr={$iPgNr}";
01724         }
01725 
01726         // #1184M - specialchar search
01727         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01728             $sURL .= "&amp;searchparam={$sVal}";
01729         }
01730 
01731         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01732             $sURL .= "&amp;searchcnid={$sVal}";
01733         }
01734 
01735         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01736             $sURL .= "&amp;searchvendor={$sVal}";
01737         }
01738 
01739         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01740             $sURL .= "&amp;searchmanufacturer={$sVal}";
01741         }
01742 
01743         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01744             $sURL .= "&amp;searchrecomm={$sVal}";
01745         }
01746 
01747         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01748             $sURL .= "&amp;searchtag={$sVal}";
01749         }
01750 
01751         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01752             $sURL .= "&amp;recommid={$sVal}";
01753         }
01754 
01755         return $sURL;
01756     }
01757 
01763     protected function _getSeoRequestParams()
01764     {
01765         $sClass = $this->getClassName();
01766         $sFnc   = $this->getFncName();
01767 
01768         // #921 S
01769         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01770         if ( in_array( $sFnc, $aFnc ) ) {
01771             $sFnc = '';
01772         }
01773 
01774         // #680
01775         $sURL = "cl={$sClass}";
01776         if ( $sFnc ) {
01777             $sURL .= "&amp;fnc={$sFnc}";
01778         }
01779         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01780             $sURL .= "&amp;page={$sVal}";
01781         }
01782 
01783         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01784             $sURL .= "&amp;tpl={$sVal}";
01785         }
01786 
01787         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01788         if ( $iPgNr > 0 ) {
01789             $sURL .= "&amp;pgNr={$iPgNr}";
01790         }
01791 
01792         return $sURL;
01793     }
01794 
01800     public function showSearch()
01801     {
01802         $blShow = true;
01803         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01804             $blShow = false;
01805         }
01806         return (int) $blShow;
01807     }
01808 
01814     public function getRssLinks()
01815     {
01816         return $this->_aRssLinks;
01817     }
01818 
01824     public function getSortColumns()
01825     {
01826         return $this->_aSortColumns;
01827     }
01828 
01834     public function getEditTags()
01835     {
01836     }
01837 
01843     public function getRecommSearch()
01844     {
01845     }
01846 
01854     public function getReviewUserId()
01855     {
01856     }
01857 
01863     public function getPaymentList()
01864     {
01865     }
01866 
01872     public function getActiveRecommList()
01873     {
01874         if ( $this->_oActiveRecommList === null ) {
01875             $this->_oActiveRecommList = false;
01876             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01877                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01878                 $this->_oActiveRecommList->load( $sOxid );
01879             }
01880         }
01881         return $this->_oActiveRecommList;
01882     }
01883 
01889     public function getAccessoires()
01890     {
01891     }
01892 
01898     public function getCrossSelling()
01899     {
01900     }
01901 
01907     public function getSimilarProducts()
01908     {
01909     }
01910 
01918     public function getAlsoBoughtThiesProducts()
01919     {
01920     }
01921 
01927     public function getAlsoBoughtTheseProducts()
01928     {
01929     }
01930 
01936     public function getArticleId()
01937     {
01938     }
01939 
01945     public function isMoreTagsVisible()
01946     {
01947         return false;
01948     }
01949 
01955     public function getTitle()
01956     {
01957     }
01958 
01964     public function getActiveLangAbbr()
01965     {
01966         // Performance
01967         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01968             return;
01969         }
01970 
01971         if ( !isset($this->_sActiveLangAbbr ) ) {
01972             $aLanguages = oxLang::getInstance()->getLanguageArray();
01973             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01974                 if ( $oVal->selected ) {
01975                     $this->_sActiveLangAbbr = $oVal->abbr;
01976                     break;
01977                 }
01978             }
01979         }
01980 
01981         return $this->_sActiveLangAbbr;
01982     }
01983 
01997     public function addGlobalParams( $oShop = null)
01998     {
01999         $myConfig = $this->getConfig();
02000 
02001         $oViewConf = parent::addGlobalParams( $oShop );
02002 
02003         $this->_aViewData['isfiltering'] = true;
02004         $this->_aViewData['isnewsletter'] = true;
02005         $this->_aViewData['isvarianten'] = true;
02006         $this->_aViewData['isreview'] = true;
02007         $this->_aViewData['isaddsales'] = true;
02008         $this->_aViewData['isvoucher'] = true;
02009         $this->_aViewData['ispricealarm'] = true;
02010         $this->_aViewData['iswishlist'] = true;
02011         $this->_aViewData['isipayment'] = true;
02012         $this->_aViewData['istrusted'] = true;
02013         $this->_aViewData['isfiltering'] = true;
02014         $this->_aViewData['isgooglestats'] = true;
02015         $this->_aViewData['iswishlist'] = true;
02016 
02017 
02018         // show baskets
02019         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02020         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02021         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02022 
02023         // allow currency swiching
02024         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02025 
02026         // show/hide vendors
02027         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02028 
02029         // show/hide Manufacturers
02030         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02031 
02032         // show/hide empty categories
02033         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02034 
02035         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02036 
02037         // used for compatibility with older templates
02038         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02039         $this->_aViewData['urlsign']    = '&';
02040         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02041         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02042 
02043         $this->_aViewData['sListType'] = $this->getListType();
02044         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02045 
02046         // new navigation ?
02047         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02048         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02049 
02050         $this->_setNrOfArtPerPage();
02051 
02052 
02053         return $oViewConf;
02054     }
02055 
02061     public function getAdditionalParams()
02062     {
02063         if ( $this->_sAdditionalParams === null ) {
02064             // #1018A
02065             $this->_sAdditionalParams  = parent::getAdditionalParams();
02066             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02067 
02068             // #1834M - specialchar search
02069             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02070             if ( isset( $sSearchParamForLink ) ) {
02071                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02072             }
02073             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02074                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02075             }
02076             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02077                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02078             }
02079             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02080                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02081             }
02082             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02083                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02084             }
02085             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02086                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02087             }
02088             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02089                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02090             }
02091         }
02092 
02093         return $this->_sAdditionalParams;
02094     }
02095 
02101     public function generatePageNavigationUrl()
02102     {
02103         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02104     }
02105 
02115     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02116     {
02117         if ( $iPage ) {
02118             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02119         }
02120         return $sUrl;
02121     }
02122 
02128     public function generatePageNavigation()
02129     {
02130         startProfile('generatePageNavigation');
02131         // generate the page navigation
02132         $pageNavigation = new stdClass();
02133         $pageNavigation->NrOfPages = $this->_iCntPages;
02134         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02135         $iActPage = $this->getActPage();
02136         $pageNavigation->actPage   = $iActPage + 1;
02137 
02138         $sUrl = $this->generatePageNavigationUrl();
02139 
02140         if ( $iActPage > 0) {
02141             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02142         }
02143 
02144         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02145             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02146         }
02147 
02148         if ( $pageNavigation->NrOfPages > 1 ) {
02149             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02150                 $page = new Oxstdclass();
02151                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02152                 $page->selected = 0;
02153                 if ( $i == $pageNavigation->actPage ) {
02154                     $page->selected = 1;
02155                 }
02156                 $pageNavigation->changePage[$i] = $page;
02157             }
02158 
02159             // first/last one
02160             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02161             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02162         }
02163 
02164         stopProfile('generatePageNavigation');
02165 
02166         return $pageNavigation;
02167     }
02168 
02176     public function prepareMinimumOrderPrice4View()
02177     {
02178         $myConfig = $this->getConfig();
02179         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02180         if ( isset( $iMinOrderPrice ) && is_numeric($iMinOrderPrice)) {
02181             $oBasket = $this->getSession()->getBasket();
02182             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02183                 return;
02184             }
02185             $oCur    = $myConfig->getActShopCurrencyObject();
02186             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02187             // Coupons and discounts should be considered in "Min order price" check
02188             $dVoucherDiscount = 0;
02189             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02190                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02191             }
02192             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02193                 $this->_iLowOrderPrice = 1;
02194                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02195             }
02196         }
02197     }
02198 
02205     public function render()
02206     {
02207         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02208             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02209         }
02210 
02211         parent::render();
02212 
02213         if ( $this->getIsOrderStep() ) {
02214 
02215             // disabling navigation during order ...
02216             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02217                 $this->_iNewsRealStatus = 1;
02218                 $this->setShowNewsletter( 0 );
02219                 // for old tpl. will be removed later
02220                 $this->_aViewData['isnewsletter'] = 0;
02221                 $this->setShowRightBasket( 0 );
02222                 $this->setShowLeftBasket( 0 );
02223                 $this->setShowTopBasket( 0 );
02224             }
02225             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02226             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02227         }
02228 
02229         // meta data
02230         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02231         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02232 
02233         // show baskets
02234         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02235         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02236         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02237 
02238         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02239 
02240         $this->_aViewData['noindex'] = $this->noIndex();
02241 
02242         return $this->_sThisTemplate;
02243     }
02244 
02250     public function getViewProduct()
02251     {
02252         return $this->getProduct();
02253     }
02254 
02262     public function setViewProduct( $oProduct )
02263     {
02264         $this->_oProduct = $oProduct;
02265     }
02266 
02272     public function getViewProductList()
02273     {
02274         return $this->_aArticleList;
02275     }
02276 
02282     public function getActPage()
02283     {
02284         if ( $this->_iActPage === null ) {
02285             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02286             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02287         }
02288         return $this->_iActPage;
02289     }
02290 
02298     public function getActTag()
02299     {
02300         if ( $this->_oActTag === null ) {
02301             $this->_oActTag = new Oxstdclass();
02302             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02303             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02304 
02305             $sLink = false;
02306             if ( oxUtils::getInstance()->seoIsActive() ) {
02307                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02308             }
02309 
02310             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02311         }
02312         return $this->_oActTag;
02313     }
02314 
02322     public function getActVendor()
02323     {
02324         // if active vendor is not set yet - trying to load it from request params
02325         // this may be usefull when category component was unable to load active vendor
02326         // and we still need some object to mount navigation info
02327         if ( $this->_oActVendor === null ) {
02328             $this->_oActVendor = false;
02329             $sVendorId = oxConfig::getParameter( 'cnid' );
02330             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02331             $oVendor = oxNew( 'oxvendor' );
02332             if ( $oVendor->load( $sVendorId ) ) {
02333                 $this->_oActVendor = $oVendor;
02334             }
02335         }
02336 
02337         return $this->_oActVendor;
02338     }
02339 
02347     public function getActManufacturer()
02348     {
02349         // if active Manufacturer is not set yet - trying to load it from request params
02350         // this may be usefull when category component was unable to load active Manufacturer
02351         // and we still need some object to mount navigation info
02352         if ( $this->_oActManufacturer === null ) {
02353 
02354             $this->_oActManufacturer = false;
02355             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02356             $oManufacturer = oxNew( 'oxmanufacturer' );
02357             if ( $oManufacturer->load( $sManufacturerId ) ) {
02358                 $this->_oActManufacturer = $oManufacturer;
02359             }
02360         }
02361 
02362         return $this->_oActManufacturer;
02363     }
02364 
02372     public function setActVendor( $oVendor )
02373     {
02374         $this->_oActVendor = $oVendor;
02375     }
02376 
02384     public function setActManufacturer( $oManufacturer )
02385     {
02386         $this->_oActManufacturer = $oManufacturer;
02387     }
02388 
02394     public function getActSearch()
02395     {
02396         if ( $this->_oActSearch === null ) {
02397             $this->_oActSearch = new oxStdClass();
02398             $sUrl = $this->getConfig()->getShopHomeURL();
02399             $this->_oActSearch->link = "{$sUrl}cl=search";
02400         }
02401         return $this->_oActSearch;
02402     }
02403 
02411     public function getActRecommList()
02412     {
02413         return $this->getActiveRecommList();
02414     }
02415 
02421     public function getCategoryTree()
02422     {
02423         return $this->_oCategoryTree;
02424     }
02425 
02433     public function setCategoryTree( $oCatTree )
02434     {
02435         $this->_oCategoryTree = $oCatTree;
02436     }
02437 
02443     public function getVendorTree()
02444     {
02445         return $this->_oVendorTree;
02446     }
02447 
02455     public function setVendorTree( $oVendorTree )
02456     {
02457         $this->_oVendorTree = $oVendorTree;
02458     }
02459 
02465     public function getManufacturerTree()
02466     {
02467         return $this->_oManufacturerTree;
02468     }
02469 
02477     public function setManufacturerTree( $oManufacturerTree )
02478     {
02479         $this->_oManufacturerTree = $oManufacturerTree;
02480     }
02490     protected function _loadActions()
02491     {
02492         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02493         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02494     }
02495 
02501     public function getAddUrlParams()
02502     {
02503     }
02504 
02511     public function getTop5ArticleList()
02512     {
02513         if ( $this->_blTop5Action ) {
02514             if ( $this->_aTop5ArticleList === null ) {
02515                 $this->_aTop5ArticleList = false;
02516                 $myConfig = $this->getConfig();
02517                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02518                     // top 5 articles
02519                     $oArtList = oxNew( 'oxarticlelist' );
02520                     $oArtList->loadTop5Articles();
02521                     if ( $oArtList->count() ) {
02522                         $this->_aTop5ArticleList = $oArtList;
02523                     }
02524                 }
02525             }
02526         }
02527         return $this->_aTop5ArticleList;
02528     }
02529 
02536     public function getBargainArticleList()
02537     {
02538         if ( $this->_blBargainAction ) {
02539             if ( $this->_aBargainArticleList === null ) {
02540                 $this->_aBargainArticleList = array();
02541                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02542                     $oArtList = oxNew( 'oxarticlelist' );
02543                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02544                     if ( $oArtList->count() ) {
02545                         $this->_aBargainArticleList = $oArtList;
02546                     }
02547                 }
02548             }
02549         }
02550         return $this->_aBargainArticleList;
02551     }
02552 
02559     public function isLowOrderPrice()
02560     {
02561         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02562             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02563         }
02564 
02565         return $this->_blLowOrderPrice;
02566     }
02567 
02573     public function getMinOrderPrice()
02574     {
02575         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02576             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02577             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02578         }
02579         return $this->_sMinOrderPrice;
02580     }
02581 
02587     public function getNewsRealStatus()
02588     {
02589         return $this->_iNewsRealStatus;
02590     }
02591 
02597     protected function _canRedirect()
02598     {
02599         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02600             if ( oxConfig::getParameter( $sParam ) !== null ) {
02601                 return false;
02602             }
02603         }
02604 
02605         return true;
02606     }
02607 
02613     public function getProduct()
02614     {
02615     }
02616 
02622     public function getVendorlist()
02623     {
02624         return $this->_aVendorlist;
02625     }
02626 
02634     public function setVendorlist( $aList )
02635     {
02636         $this->_aVendorlist = $aList;
02637     }
02638 
02644     public function getManufacturerlist()
02645     {
02646         return $this->_aManufacturerlist;
02647     }
02648 
02656     public function setManufacturerlist( $aList )
02657     {
02658         $this->_aManufacturerlist = $aList;
02659     }
02660 
02668     public function setRootVendor( $oVendor )
02669     {
02670         $this->_oRootVendor = $oVendor;
02671     }
02672 
02678     public function getRootVendor()
02679     {
02680         return $this->_oRootVendor;
02681     }
02682 
02690     public function setRootManufacturer( $oManufacturer )
02691     {
02692         $this->_oRootManufacturer = $oManufacturer;
02693     }
02694 
02700     public function getRootManufacturer()
02701     {
02702         return $this->_oRootManufacturer;
02703     }
02704 
02710     public function getVendorId()
02711     {
02712         if ( $this->_sVendorId === null ) {
02713             $this->_sVendorId = false;
02714             if ( ( $oVendor = $this->getActVendor() ) ) {
02715                 $this->_sVendorId = $oVendor->getId();
02716             }
02717         }
02718         return $this->_sVendorId;
02719     }
02720 
02726     public function getManufacturerId()
02727     {
02728         if ( $this->_sManufacturerId === null ) {
02729             $this->_sManufacturerId = false;
02730             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02731                 $this->_sManufacturerId = $oManufacturer->getId();
02732             }
02733         }
02734         return $this->_sManufacturerId;
02735     }
02736 
02742     public function getSearchCatTree()
02743     {
02744         return $this->_aSearchCatTree;
02745     }
02746 
02754     public function setSearchCatTree( $aTree )
02755     {
02756         $this->_aSearchCatTree = $aTree;
02757     }
02758 
02764     public function getCatMore()
02765     {
02766         return $this->_oCatMore;
02767     }
02768 
02776     public function setCatMore( $oCat )
02777     {
02778         $this->_oCatMore = $oCat;
02779     }
02780 
02786     public function getCatTreePath()
02787     {
02788         return $this->_sCatTreePath;
02789     }
02790 
02798     public function getContentByIdent( $sIdent )
02799     {
02800         if ( !isset( $this->_aContents[$sIdent] ) ) {
02801             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02802             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02803         }
02804         return $this->_aContents[$sIdent];
02805     }
02806 
02812     public function getContentCategory()
02813     {
02814         return false;
02815     }
02816 
02822     public function getMustFillFields()
02823     {
02824         if ( $this->_aMustFillFields === null ) {
02825             $this->_aMustFillFields = false;
02826 
02827             // passing must-be-filled-fields info
02828             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02829             if ( is_array( $aMustFillFields ) ) {
02830                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02831             }
02832         }
02833         return $this->_aMustFillFields;
02834     }
02835 
02843     public function isFieldRequired( $sField )
02844     {
02845         if ( $aMustFillFields = $this->getMustFillFields() ) {
02846             if ( isset( $aMustFillFields[$sField] ) ) {
02847                 return true;
02848             }
02849         }
02850 
02851         return false;
02852     }
02853 
02859     public function getFormId()
02860     {
02861         if ( $this->_sFormId === null ) {
02862             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02863             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02864         }
02865 
02866         return $this->_sFormId;
02867     }
02868 
02874     public function canAcceptFormData()
02875     {
02876         if ( $this->_blCanAcceptFormData === null ) {
02877             $this->_blCanAcceptFormData = false;
02878 
02879             $sFormId = oxConfig::getParameter( "uformid" );
02880             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02881 
02882             // testing if form and session ids matches
02883             if ( $sFormId && $sFormId === $sSessionFormId ) {
02884                 $this->_blCanAcceptFormData = true;
02885             }
02886 
02887             // regenerating form data
02888             $this->getFormId();
02889         }
02890         return $this->_blCanAcceptFormData;
02891     }
02892 
02898     public function getPromoFinishedList()
02899     {
02900         if (isset($this->_oPromoFinishedList)) {
02901             return $this->_oPromoFinishedList;
02902         }
02903         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02904         $this->_oPromoFinishedList->loadFinishedByCount(2);
02905         return $this->_oPromoFinishedList;
02906     }
02907 
02913     public function getPromoCurrentList()
02914     {
02915         if (isset($this->_oPromoCurrentList)) {
02916             return $this->_oPromoCurrentList;
02917         }
02918         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02919         $this->_oPromoCurrentList->loadCurrent();
02920         return $this->_oPromoCurrentList;
02921     }
02922 
02928     public function getPromoFutureList()
02929     {
02930         if (isset($this->_oPromoFutureList)) {
02931             return $this->_oPromoFutureList;
02932         }
02933         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02934         $this->_oPromoFutureList->loadFutureByCount(2);
02935         return $this->_oPromoFutureList;
02936     }
02937 
02943     public function getShowPromotionList()
02944     {
02945         if (isset($this->_blShowPromotions)) {
02946             return $this->_blShowPromotions;
02947         }
02948         $this->_blShowPromotions = false;
02949         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02950             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02951         }
02952         return $this->_blShowPromotions;
02953     }
02954 
02960     public function isEnabledPrivateSales()
02961     {
02962         if ( $this->_blEnabledPrivateSales === null ) {
02963             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
02964             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxUtils::getInstance()->canPreview() ) !== null ) {
02965                 $this->_blEnabledPrivateSales = !$blCanPreview;
02966             }
02967         }
02968         return $this->_blEnabledPrivateSales;
02969     }
02970 
02971 }