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         // #921 S
01684         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01685         if ( in_array( $sFnc, $aFnc ) ) {
01686             $sFnc = '';
01687         }
01688 
01689         // #680
01690         $sURL = "cl={$sClass}";
01691         if ( $sFnc ) {
01692             $sURL .= "&amp;fnc={$sFnc}";
01693         }
01694         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01695             $sURL .= "&amp;cnid={$sVal}";
01696         }
01697         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01698             $sURL .= "&amp;mnid={$sVal}";
01699         }
01700         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01701             $sURL .= "&amp;anid={$sVal}";
01702         }
01703 
01704         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01705             $sURL .= "&amp;page={$sVal}";
01706         }
01707 
01708         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01709             $sURL .= "&amp;tpl={$sVal}";
01710         }
01711 
01712         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01713         // don't include page number for navigation
01714         // it will be done in oxubase::generatePageNavigation
01715         if ( $blAddPageNr && $iPgNr > 0 ) {
01716             $sURL .= "&amp;pgNr={$iPgNr}";
01717         }
01718 
01719         // #1184M - specialchar search
01720         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01721             $sURL .= "&amp;searchparam={$sVal}";
01722         }
01723 
01724         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01725             $sURL .= "&amp;searchcnid={$sVal}";
01726         }
01727 
01728         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01729             $sURL .= "&amp;searchvendor={$sVal}";
01730         }
01731 
01732         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01733             $sURL .= "&amp;searchmanufacturer={$sVal}";
01734         }
01735 
01736         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01737             $sURL .= "&amp;searchrecomm={$sVal}";
01738         }
01739 
01740         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01741             $sURL .= "&amp;searchtag={$sVal}";
01742         }
01743 
01744         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01745             $sURL .= "&amp;recommid={$sVal}";
01746         }
01747 
01748         return $sURL;
01749     }
01750 
01756     protected function _getSeoRequestParams()
01757     {
01758         $sClass = $this->getClassName();
01759         $sFnc   = $this->getFncName();
01760 
01761         // #921 S
01762         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01763         if ( in_array( $sFnc, $aFnc ) ) {
01764             $sFnc = '';
01765         }
01766 
01767         // #680
01768         $sURL = "cl={$sClass}";
01769         if ( $sFnc ) {
01770             $sURL .= "&amp;fnc={$sFnc}";
01771         }
01772         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01773             $sURL .= "&amp;page={$sVal}";
01774         }
01775 
01776         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01777             $sURL .= "&amp;tpl={$sVal}";
01778         }
01779 
01780         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01781         if ( $iPgNr > 0 ) {
01782             $sURL .= "&amp;pgNr={$iPgNr}";
01783         }
01784 
01785         return $sURL;
01786     }
01787 
01793     public function showSearch()
01794     {
01795         $blShow = true;
01796         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01797             $blShow = false;
01798         }
01799         return (int) $blShow;
01800     }
01801 
01807     public function getRssLinks()
01808     {
01809         return $this->_aRssLinks;
01810     }
01811 
01817     public function getSortColumns()
01818     {
01819         return $this->_aSortColumns;
01820     }
01821 
01827     public function getEditTags()
01828     {
01829     }
01830 
01836     public function getRecommSearch()
01837     {
01838     }
01839 
01847     public function getReviewUserId()
01848     {
01849     }
01850 
01856     public function getPaymentList()
01857     {
01858     }
01859 
01865     public function getActiveRecommList()
01866     {
01867         if ( $this->_oActiveRecommList === null ) {
01868             $this->_oActiveRecommList = false;
01869             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01870                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01871                 $this->_oActiveRecommList->load( $sOxid );
01872             }
01873         }
01874         return $this->_oActiveRecommList;
01875     }
01876 
01882     public function getAccessoires()
01883     {
01884     }
01885 
01891     public function getCrossSelling()
01892     {
01893     }
01894 
01900     public function getSimilarProducts()
01901     {
01902     }
01903 
01911     public function getAlsoBoughtThiesProducts()
01912     {
01913     }
01914 
01920     public function getAlsoBoughtTheseProducts()
01921     {
01922     }
01923 
01929     public function getArticleId()
01930     {
01931     }
01932 
01938     public function isMoreTagsVisible()
01939     {
01940         return false;
01941     }
01942 
01948     public function getTitle()
01949     {
01950     }
01951 
01957     public function getActiveLangAbbr()
01958     {
01959         // Performance
01960         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01961             return;
01962         }
01963 
01964         if ( !isset($this->_sActiveLangAbbr ) ) {
01965             $aLanguages = oxLang::getInstance()->getLanguageArray();
01966             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01967                 if ( $oVal->selected ) {
01968                     $this->_sActiveLangAbbr = $oVal->abbr;
01969                     break;
01970                 }
01971             }
01972         }
01973 
01974         return $this->_sActiveLangAbbr;
01975     }
01976 
01990     public function addGlobalParams( $oShop = null)
01991     {
01992         $myConfig = $this->getConfig();
01993 
01994         $oViewConf = parent::addGlobalParams( $oShop );
01995 
01996         $this->_aViewData['isfiltering'] = true;
01997         $this->_aViewData['isnewsletter'] = true;
01998         $this->_aViewData['isvarianten'] = true;
01999         $this->_aViewData['isreview'] = true;
02000         $this->_aViewData['isaddsales'] = true;
02001         $this->_aViewData['isvoucher'] = true;
02002         $this->_aViewData['ispricealarm'] = true;
02003         $this->_aViewData['iswishlist'] = true;
02004         $this->_aViewData['isipayment'] = true;
02005         $this->_aViewData['istrusted'] = true;
02006         $this->_aViewData['isfiltering'] = true;
02007         $this->_aViewData['isgooglestats'] = true;
02008         $this->_aViewData['iswishlist'] = true;
02009 
02010 
02011         // show baskets
02012         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02013         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02014         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02015 
02016         // allow currency swiching
02017         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02018 
02019         // show/hide vendors
02020         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02021 
02022         // show/hide Manufacturers
02023         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02024 
02025         // show/hide empty categories
02026         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02027 
02028         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02029 
02030         // used for compatibility with older templates
02031         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02032         $this->_aViewData['urlsign']    = '&';
02033         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02034         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02035 
02036         $this->_aViewData['sListType'] = $this->getListType();
02037         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02038 
02039         // new navigation ?
02040         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02041         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02042 
02043         $this->_setNrOfArtPerPage();
02044 
02045 
02046         return $oViewConf;
02047     }
02048 
02054     public function getAdditionalParams()
02055     {
02056         if ( $this->_sAdditionalParams === null ) {
02057             // #1018A
02058             $this->_sAdditionalParams  = parent::getAdditionalParams();
02059             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02060 
02061             // #1834M - specialchar search
02062             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02063             if ( isset( $sSearchParamForLink ) ) {
02064                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02065             }
02066             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02067                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02068             }
02069             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02070                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02071             }
02072             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02073                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02074             }
02075             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02076                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02077             }
02078             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02079                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02080             }
02081             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02082                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02083             }
02084         }
02085 
02086         return $this->_sAdditionalParams;
02087     }
02088 
02094     public function generatePageNavigationUrl()
02095     {
02096         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02097     }
02098 
02108     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02109     {
02110         if ( $iPage ) {
02111             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02112         }
02113         return $sUrl;
02114     }
02115 
02121     public function generatePageNavigation()
02122     {
02123         startProfile('generatePageNavigation');
02124         // generate the page navigation
02125         $pageNavigation = new stdClass();
02126         $pageNavigation->NrOfPages = $this->_iCntPages;
02127         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02128         $iActPage = $this->getActPage();
02129         $pageNavigation->actPage   = $iActPage + 1;
02130 
02131         $sUrl = $this->generatePageNavigationUrl();
02132 
02133         if ( $iActPage > 0) {
02134             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02135         }
02136 
02137         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02138             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02139         }
02140 
02141         if ( $pageNavigation->NrOfPages > 1 ) {
02142             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02143                 $page = new Oxstdclass();
02144                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02145                 $page->selected = 0;
02146                 if ( $i == $pageNavigation->actPage ) {
02147                     $page->selected = 1;
02148                 }
02149                 $pageNavigation->changePage[$i] = $page;
02150             }
02151 
02152             // first/last one
02153             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02154             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02155         }
02156 
02157         stopProfile('generatePageNavigation');
02158 
02159         return $pageNavigation;
02160     }
02161 
02169     public function prepareMinimumOrderPrice4View()
02170     {
02171         $myConfig = $this->getConfig();
02172         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02173         if ( isset( $iMinOrderPrice ) && is_numeric($iMinOrderPrice)) {
02174             $oBasket = $this->getSession()->getBasket();
02175             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02176                 return;
02177             }
02178             $oCur    = $myConfig->getActShopCurrencyObject();
02179             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02180             // Coupons and discounts should be considered in "Min order price" check
02181             $dVoucherDiscount = 0;
02182             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02183                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02184             }
02185             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02186                 $this->_iLowOrderPrice = 1;
02187                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02188             }
02189         }
02190     }
02191 
02198     public function render()
02199     {
02200         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02201             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02202         }
02203 
02204         parent::render();
02205 
02206         if ( $this->getIsOrderStep() ) {
02207 
02208             // disabling navigation during order ...
02209             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02210                 $this->_iNewsRealStatus = 1;
02211                 $this->setShowNewsletter( 0 );
02212                 // for old tpl. will be removed later
02213                 $this->_aViewData['isnewsletter'] = 0;
02214                 $this->setShowRightBasket( 0 );
02215                 $this->setShowLeftBasket( 0 );
02216                 $this->setShowTopBasket( 0 );
02217             }
02218             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02219             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02220         }
02221 
02222         // meta data
02223         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02224         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02225 
02226         // show baskets
02227         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02228         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02229         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02230 
02231         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02232 
02233         $this->_aViewData['noindex'] = $this->noIndex();
02234 
02235         return $this->_sThisTemplate;
02236     }
02237 
02243     public function getViewProduct()
02244     {
02245         return $this->getProduct();
02246     }
02247 
02255     public function setViewProduct( $oProduct )
02256     {
02257         $this->_oProduct = $oProduct;
02258     }
02259 
02265     public function getViewProductList()
02266     {
02267         return $this->_aArticleList;
02268     }
02269 
02275     public function getActPage()
02276     {
02277         if ( $this->_iActPage === null ) {
02278             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02279             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02280         }
02281         return $this->_iActPage;
02282     }
02283 
02291     public function getActTag()
02292     {
02293         if ( $this->_oActTag === null ) {
02294             $this->_oActTag = new Oxstdclass();
02295             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02296             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02297 
02298             if ( oxUtils::getInstance()->seoIsActive() ) {
02299                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02300             } else {
02301                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02302             }
02303 
02304         }
02305         return $this->_oActTag;
02306     }
02307 
02315     public function getActVendor()
02316     {
02317         // if active vendor is not set yet - trying to load it from request params
02318         // this may be usefull when category component was unable to load active vendor
02319         // and we still need some object to mount navigation info
02320         if ( $this->_oActVendor === null ) {
02321             $this->_oActVendor = false;
02322             $sVendorId = oxConfig::getParameter( 'cnid' );
02323             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02324             $oVendor = oxNew( 'oxvendor' );
02325             if ( $oVendor->load( $sVendorId ) ) {
02326                 $this->_oActVendor = $oVendor;
02327             }
02328         }
02329 
02330         return $this->_oActVendor;
02331     }
02332 
02340     public function getActManufacturer()
02341     {
02342         // if active Manufacturer is not set yet - trying to load it from request params
02343         // this may be usefull when category component was unable to load active Manufacturer
02344         // and we still need some object to mount navigation info
02345         if ( $this->_oActManufacturer === null ) {
02346 
02347             $this->_oActManufacturer = false;
02348             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02349             $oManufacturer = oxNew( 'oxmanufacturer' );
02350             if ( $oManufacturer->load( $sManufacturerId ) ) {
02351                 $this->_oActManufacturer = $oManufacturer;
02352             }
02353         }
02354 
02355         return $this->_oActManufacturer;
02356     }
02357 
02365     public function setActVendor( $oVendor )
02366     {
02367         $this->_oActVendor = $oVendor;
02368     }
02369 
02377     public function setActManufacturer( $oManufacturer )
02378     {
02379         $this->_oActManufacturer = $oManufacturer;
02380     }
02381 
02387     public function getActSearch()
02388     {
02389         if ( $this->_oActSearch === null ) {
02390             $this->_oActSearch = new oxStdClass();
02391             $sUrl = $this->getConfig()->getShopHomeURL();
02392             $this->_oActSearch->link = "{$sUrl}cl=search";
02393         }
02394         return $this->_oActSearch;
02395     }
02396 
02404     public function getActRecommList()
02405     {
02406         return $this->getActiveRecommList();
02407     }
02408 
02414     public function getCategoryTree()
02415     {
02416         return $this->_oCategoryTree;
02417     }
02418 
02426     public function setCategoryTree( $oCatTree )
02427     {
02428         $this->_oCategoryTree = $oCatTree;
02429     }
02430 
02436     public function getVendorTree()
02437     {
02438         return $this->_oVendorTree;
02439     }
02440 
02448     public function setVendorTree( $oVendorTree )
02449     {
02450         $this->_oVendorTree = $oVendorTree;
02451     }
02452 
02458     public function getManufacturerTree()
02459     {
02460         return $this->_oManufacturerTree;
02461     }
02462 
02470     public function setManufacturerTree( $oManufacturerTree )
02471     {
02472         $this->_oManufacturerTree = $oManufacturerTree;
02473     }
02483     protected function _loadActions()
02484     {
02485         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02486         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02487     }
02488 
02494     public function getAddUrlParams()
02495     {
02496     }
02497 
02504     public function getTop5ArticleList()
02505     {
02506         if ( $this->_blTop5Action ) {
02507             if ( $this->_aTop5ArticleList === null ) {
02508                 $this->_aTop5ArticleList = false;
02509                 $myConfig = $this->getConfig();
02510                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02511                     // top 5 articles
02512                     $oArtList = oxNew( 'oxarticlelist' );
02513                     $oArtList->loadTop5Articles();
02514                     if ( $oArtList->count() ) {
02515                         $this->_aTop5ArticleList = $oArtList;
02516                     }
02517                 }
02518             }
02519         }
02520         return $this->_aTop5ArticleList;
02521     }
02522 
02529     public function getBargainArticleList()
02530     {
02531         if ( $this->_blBargainAction ) {
02532             if ( $this->_aBargainArticleList === null ) {
02533                 $this->_aBargainArticleList = array();
02534                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02535                     $oArtList = oxNew( 'oxarticlelist' );
02536                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02537                     if ( $oArtList->count() ) {
02538                         $this->_aBargainArticleList = $oArtList;
02539                     }
02540                 }
02541             }
02542         }
02543         return $this->_aBargainArticleList;
02544     }
02545 
02552     public function isLowOrderPrice()
02553     {
02554         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02555             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02556         }
02557 
02558         return $this->_blLowOrderPrice;
02559     }
02560 
02566     public function getMinOrderPrice()
02567     {
02568         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02569             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02570             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02571         }
02572         return $this->_sMinOrderPrice;
02573     }
02574 
02580     public function getNewsRealStatus()
02581     {
02582         return $this->_iNewsRealStatus;
02583     }
02584 
02590     protected function _canRedirect()
02591     {
02592         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02593             if ( oxConfig::getParameter( $sParam ) !== null ) {
02594                 return false;
02595             }
02596         }
02597 
02598         return true;
02599     }
02600 
02606     public function getProduct()
02607     {
02608     }
02609 
02615     public function getVendorlist()
02616     {
02617         return $this->_aVendorlist;
02618     }
02619 
02627     public function setVendorlist( $aList )
02628     {
02629         $this->_aVendorlist = $aList;
02630     }
02631 
02637     public function getManufacturerlist()
02638     {
02639         return $this->_aManufacturerlist;
02640     }
02641 
02649     public function setManufacturerlist( $aList )
02650     {
02651         $this->_aManufacturerlist = $aList;
02652     }
02653 
02661     public function setRootVendor( $oVendor )
02662     {
02663         $this->_oRootVendor = $oVendor;
02664     }
02665 
02671     public function getRootVendor()
02672     {
02673         return $this->_oRootVendor;
02674     }
02675 
02683     public function setRootManufacturer( $oManufacturer )
02684     {
02685         $this->_oRootManufacturer = $oManufacturer;
02686     }
02687 
02693     public function getRootManufacturer()
02694     {
02695         return $this->_oRootManufacturer;
02696     }
02697 
02703     public function getVendorId()
02704     {
02705         if ( $this->_sVendorId === null ) {
02706             $this->_sVendorId = false;
02707             if ( ( $oVendor = $this->getActVendor() ) ) {
02708                 $this->_sVendorId = $oVendor->getId();
02709             }
02710         }
02711         return $this->_sVendorId;
02712     }
02713 
02719     public function getManufacturerId()
02720     {
02721         if ( $this->_sManufacturerId === null ) {
02722             $this->_sManufacturerId = false;
02723             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02724                 $this->_sManufacturerId = $oManufacturer->getId();
02725             }
02726         }
02727         return $this->_sManufacturerId;
02728     }
02729 
02735     public function getSearchCatTree()
02736     {
02737         return $this->_aSearchCatTree;
02738     }
02739 
02747     public function setSearchCatTree( $aTree )
02748     {
02749         $this->_aSearchCatTree = $aTree;
02750     }
02751 
02757     public function getCatMore()
02758     {
02759         return $this->_oCatMore;
02760     }
02761 
02769     public function setCatMore( $oCat )
02770     {
02771         $this->_oCatMore = $oCat;
02772     }
02773 
02779     public function getCatTreePath()
02780     {
02781         return $this->_sCatTreePath;
02782     }
02783 
02791     public function getContentByIdent( $sIdent )
02792     {
02793         if ( !isset( $this->_aContents[$sIdent] ) ) {
02794             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02795             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02796         }
02797         return $this->_aContents[$sIdent];
02798     }
02799 
02805     public function getContentCategory()
02806     {
02807         return false;
02808     }
02809 
02815     public function getMustFillFields()
02816     {
02817         if ( $this->_aMustFillFields === null ) {
02818             $this->_aMustFillFields = false;
02819 
02820             // passing must-be-filled-fields info
02821             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02822             if ( is_array( $aMustFillFields ) ) {
02823                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02824             }
02825         }
02826         return $this->_aMustFillFields;
02827     }
02828 
02836     public function isFieldRequired( $sField )
02837     {
02838         if ( $aMustFillFields = $this->getMustFillFields() ) {
02839             if ( isset( $aMustFillFields[$sField] ) ) {
02840                 return true;
02841             }
02842         }
02843 
02844         return false;
02845     }
02846 
02852     public function getFormId()
02853     {
02854         if ( $this->_sFormId === null ) {
02855             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02856             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02857         }
02858 
02859         return $this->_sFormId;
02860     }
02861 
02867     public function canAcceptFormData()
02868     {
02869         if ( $this->_blCanAcceptFormData === null ) {
02870             $this->_blCanAcceptFormData = false;
02871 
02872             $sFormId = oxConfig::getParameter( "uformid" );
02873             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02874 
02875             // testing if form and session ids matches
02876             if ( $sFormId && $sFormId === $sSessionFormId ) {
02877                 $this->_blCanAcceptFormData = true;
02878             }
02879 
02880             // regenerating form data
02881             $this->getFormId();
02882         }
02883         return $this->_blCanAcceptFormData;
02884     }
02885 
02891     public function getPromoFinishedList()
02892     {
02893         if (isset($this->_oPromoFinishedList)) {
02894             return $this->_oPromoFinishedList;
02895         }
02896         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02897         $this->_oPromoFinishedList->loadFinishedByCount(2);
02898         return $this->_oPromoFinishedList;
02899     }
02900 
02906     public function getPromoCurrentList()
02907     {
02908         if (isset($this->_oPromoCurrentList)) {
02909             return $this->_oPromoCurrentList;
02910         }
02911         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02912         $this->_oPromoCurrentList->loadCurrent();
02913         return $this->_oPromoCurrentList;
02914     }
02915 
02921     public function getPromoFutureList()
02922     {
02923         if (isset($this->_oPromoFutureList)) {
02924             return $this->_oPromoFutureList;
02925         }
02926         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02927         $this->_oPromoFutureList->loadFutureByCount(2);
02928         return $this->_oPromoFutureList;
02929     }
02930 
02936     public function getShowPromotionList()
02937     {
02938         if (isset($this->_blShowPromotions)) {
02939             return $this->_blShowPromotions;
02940         }
02941         $this->_blShowPromotions = false;
02942         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02943             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02944         }
02945         return $this->_blShowPromotions;
02946     }
02947 
02948 }

Generated by  doxygen 1.6.2