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 {
00025     protected $_oaComponents = array();
00026 
00032     protected $_blIsCallForCache = false;
00033 
00039     protected $_blIsOrderStep = false;
00040 
00046     protected $_sListType = null;
00047 
00053     protected $_oActCategory = null;
00054 
00060     protected $_oActManufacturer = null;
00061 
00067     protected $_oActVendor = null;
00068 
00073     protected $_oActiveRecommList = null;
00074 
00080     protected $_oActSearch = null;
00081 
00086     protected $_blShowSorting = false;
00087 
00092     protected $_blShowRightBasket = null;
00093 
00098     protected $_blShowTopBasket = null;
00099 
00104     protected $_blShowLeftBasket = null;
00105 
00110     protected $_blLoadCurrency = null;
00111 
00116     protected $_blLoadVendorTree = null;
00117 
00122     protected $_blLoadManufacturerTree = null;
00123 
00128     protected $_blDontShowEmptyCats = null;
00129 
00134     protected $_blLoadLanguage = null;
00135 
00140     protected $_blShowTopCatNav = null;
00141 
00146     protected $_iTopCatNavItmCnt = null;
00147 
00152     protected $_aRssLinks = null;
00153 
00158     protected $_sListOrderBy = null;
00159 
00164     protected $_sListOrderDir = null;
00165 
00170     protected $_sMetaDescription = null;
00171 
00176     protected $_sMetaKeywords = null;
00177 
00183     protected $_sMetaDescriptionIdent = null;
00184 
00190     protected $_sMetaKeywordsIdent = null;
00191 
00196     protected $_sAdditionalParams = null;
00197 
00202     protected $_oActCurrency = null;
00203 
00210     protected $_blCommonAdded = false;
00211 
00218     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00219 
00226     protected $_blForceNoIndex = false;
00227 
00232     protected $_sWishlistName = null;
00233 
00238     protected $_iCompItemsCnt = null;
00239 
00245     protected $_sContentId = null;
00246 
00252     protected $_oContent = null;
00253 
00259     protected $_sViewResetID = null;
00260 
00265     protected $_blActiveSorting = null;
00266 
00271     protected $_aMenueList = null;
00272 
00278     protected $_aComponentNames = array(
00279                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00280                                     'oxcmp_lang'       => 1,
00281                                     'oxcmp_cur'        => 1,
00282                                     'oxcmp_shop'       => 1,
00283                                     'oxcmp_categories' => 0,
00284                                     'oxcmp_utils'      => 1,
00285                                     'oxcmp_news'       => 0,
00286                                     'oxcmp_basket'     => 1
00287                                   );
00288 
00294     protected $_aUserComponentNames = array();
00295 
00301     protected $_oProduct = null;
00302 
00307     protected $_iActPage = null;
00308 
00313     protected $_aArticleList = null;
00314 
00319     protected $_oVendorTree  = null;
00320 
00325     protected $_oManufacturerTree  = null;
00326 
00331     protected $_oCategoryTree  = null;
00332 
00337     protected $_aTop5ArticleList  = null;
00338 
00343     protected $_aBargainArticleList  = null;
00344 
00349     protected $_blLowOrderPrice = null;
00350 
00358     protected $_iLowOrderPrice  = null;
00359 
00364     protected $_sMinOrderPrice  = null;
00365 
00370     protected $_iNewsRealStatus  = null;
00371 
00376     protected $_aBlockRedirectParams = array( 'fnc' );
00377 
00382     protected $_aVendorlist = null;
00383 
00388     protected $_oRootVendor = null;
00389 
00394     protected $_sVendorId = null;
00395 
00400     protected $_aManufacturerlist = null;
00401 
00406     protected $_oRootManufacturer = null;
00407 
00412     protected $_sManufacturerId = null;
00413 
00418     protected $_aSearchCatTree = null;
00419 
00424     protected $_oCatMore = null;
00425 
00430     protected $_blNewsSubscribed = null;
00431 
00436     protected $_blShowShipAddress = null;
00437 
00442     protected $_oDelAddress = null;
00443 
00448     protected $_sCatTreePath = null;
00449 
00454     protected $_aContents = array();
00455 
00460     protected $_blTop5Action = false;
00461 
00466     protected $_blBargainAction = false;
00467 
00473     protected $_aMustFillFields = null;
00474 
00483     protected function _processRequest()
00484     {
00485         $myUtils = oxUtils::getInstance();
00486 
00487         // non admin, request is not empty and was not processed by seo engine
00488         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00489 
00490             // fetching standard url and looking for it in seo table
00491             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00492                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00493             } else {
00494                 // forcing to set noindex/follow meta
00495                 $this->_forceNoIndex();
00496 
00497                 $sShopId = $this->getConfig()->getShopId();
00498                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00499                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00500 
00501                 // logging "not found" url
00502                 $oDb = oxDb::getDb();
00503                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00504                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00505             }
00506         }
00507     }
00508 
00515     public function init()
00516     {
00517         $this->_processRequest();
00518 
00519         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00520             unset( $this->_aComponentNames['oxcmp_basket'] );
00521         }
00522 
00523         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00524         if ( !$this->_blCommonAdded ) {
00525             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00526             $this->_blCommonAdded = true;
00527         }
00528 
00529         // storing current view
00530         $blInit = true;
00531 
00532 
00533         // init all components if there are any
00534         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00535             // do not override initiated components
00536             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00537                 // component objects MUST be created to support user called functions
00538                 $oComponent = oxNew( $sComponentName );
00539                 $oComponent->setParent( $this );
00540                 $oComponent->setThisAction( $sComponentName );
00541                 $this->_oaComponents[$sComponentName] = $oComponent;
00542             }
00543 
00544             // do we really need to initiate them ?
00545             if ( $blInit ) {
00546                 $this->_oaComponents[$sComponentName]->init();
00547 
00548                 // executing only is view does not have action method
00549                 if ( !method_exists( $this, $this->getFncName() ) ) {
00550                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00551                 }
00552             }
00553         }
00554 
00555         parent::init();
00556 
00557         // enable sorting ?
00558         if ( $this->showSorting() ) {
00559             $this->prepareSortColumns();
00560         }
00561         $this->_aViewData['showsorting']    = $this->isSortingActive();
00562         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00563         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00564         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00565     }
00566 
00573     public function getViewId()
00574     {
00575         if ( $this->_sViewId ) {
00576             return $this->_sViewId;
00577         }
00578 
00579         $iLang = oxLang::getInstance()->getBaseLanguage();
00580         $iCur  = (int) oxConfig::getParameter( 'currency' );
00581 
00582 
00583             $this->_sViewId =  "ox|$iLang|$iCur";
00584 
00585         return $this->_sViewId;
00586     }
00587 
00588 
00594     public function showSorting()
00595     {
00596         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00597     }
00598 
00606     public function setComponents( $aComponents = null )
00607     {
00608         $this->_oaComponents = $aComponents;
00609     }
00610 
00616     public function getComponents()
00617     {
00618         return $this->_oaComponents;
00619     }
00620 
00628     public function setIsOrderStep( $blIsOrderStep = null )
00629     {
00630         $this->_blIsOrderStep = $blIsOrderStep;
00631     }
00632 
00638     public function getIsOrderStep()
00639     {
00640         return $this->_blIsOrderStep;
00641     }
00642 
00643 
00651     public function setActiveCategory( $oCategory )
00652     {
00653         $this->_oActCategory = $oCategory;
00654     }
00655 
00661     public function getActiveCategory()
00662     {
00663         return $this->_oActCategory;
00664     }
00665 
00673     public function setIsCallForCache( $blIsCallForCache = null )
00674     {
00675         $this->_blIsCallForCache = $blIsCallForCache;
00676     }
00677 
00683     public function getIsCallForCache()
00684     {
00685         return $this->_blIsCallForCache;
00686     }
00687 
00693     public function getListType()
00694     {
00695         if ( $this->_sListType == null ) {
00696             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00697                 $this->_sListType = $sListType;
00698             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00699                 $this->_sListType = $sListType;
00700             }
00701         }
00702         return $this->_sListType;
00703     }
00704 
00712     public function setListType( $sType )
00713     {
00714         $this->_sListType = $sType;
00715         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00716     }
00717 
00723     public function showRightBasket()
00724     {
00725         if ( $this->_blShowRightBasket === null ) {
00726             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00727                 $this->_blShowRightBasket = $blShowRightBasket;
00728             }
00729         }
00730         return $this->_blShowRightBasket;
00731     }
00732 
00740     public function setShowRightBasket( $blShowBasket )
00741     {
00742         $this->_blShowRightBasket = $blShowBasket;
00743     }
00744 
00750     public function showLeftBasket()
00751     {
00752         if ( $this->_blShowLeftBasket === null ) {
00753             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00754                 $this->_blShowLeftBasket = $blShowLeftBasket;
00755             }
00756         }
00757         return $this->_blShowLeftBasket;
00758     }
00759 
00767     public function setShowLeftBasket( $blShowBasket )
00768     {
00769         $this->_blShowLeftBasket = $blShowBasket;
00770     }
00771 
00777     public function showTopBasket()
00778     {
00779         if ( $this->_blShowTopBasket === null ) {
00780             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00781                 $this->_blShowTopBasket = $blShowTopBasket;
00782             }
00783         }
00784         return $this->_blShowTopBasket;
00785     }
00786 
00794     public function setShowTopBasket( $blShowBasket )
00795     {
00796         $this->_blShowTopBasket = $blShowBasket;
00797     }
00798 
00804     public function loadCurrency()
00805     {
00806         if ( $this->_blLoadCurrency == null ) {
00807             $this->_blLoadCurrency = false;
00808             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00809                 $this->_blLoadCurrency = $blLoadCurrency;
00810             }
00811         }
00812         return $this->_blLoadCurrency;
00813     }
00814 
00820     public function loadVendorTree()
00821     {
00822         if ( $this->_blLoadVendorTree == null ) {
00823             $this->_blLoadVendorTree = false;
00824             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00825                 $this->_blLoadVendorTree = $blLoadVendorTree;
00826             }
00827         }
00828         return $this->_blLoadVendorTree;
00829     }
00830 
00836     public function loadManufacturerTree()
00837     {
00838         if ( $this->_blLoadManufacturerTree == null ) {
00839             $this->_blLoadManufacturerTree = false;
00840             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00841                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00842             }
00843         }
00844         return $this->_blLoadManufacturerTree;
00845     }
00846 
00852     public function dontShowEmptyCategories()
00853     {
00854         if ( $this->_blDontShowEmptyCats == null ) {
00855             $this->_blDontShowEmptyCats = false;
00856             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00857                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00858             }
00859         }
00860         return $this->_blDontShowEmptyCats;
00861     }
00862 
00868     public function isLanguageLoaded()
00869     {
00870         if ( $this->_blLoadLanguage == null ) {
00871             $this->_blLoadLanguage = false;
00872             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00873                 $this->_blLoadLanguage = $blLoadLanguage;
00874             }
00875         }
00876         return $this->_blLoadLanguage;
00877     }
00878 
00884     public function showTopCatNavigation()
00885     {
00886         if ( $this->_blShowTopCatNav == null ) {
00887             $this->_blShowTopCatNav = false;
00888             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00889                 $this->_blShowTopCatNav = $blShowTopCatNav;
00890             }
00891         }
00892         return $this->_blShowTopCatNav;
00893     }
00894 
00900     public function getTopNavigationCatCnt()
00901     {
00902         if ( $this->_iTopCatNavItmCnt == null ) {
00903             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00904             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00905         }
00906         return $this->_iTopCatNavItmCnt;
00907     }
00908 
00918     public function addRssFeed($sTitle, $sUrl, $key = null)
00919     {
00920         if (!is_array($this->_aRssLinks)) {
00921             $this->_aRssLinks = array();
00922         }
00923         if ($key === null) {
00924             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00925         } else {
00926             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00927         }
00928 
00929         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00930     }
00931 
00946     public function prepareSortColumns()
00947     {
00948         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00949         if ( count( $aSortColumns ) > 0 ) {
00950 
00951             $this->_blActiveSorting = true;
00952             $this->_aSortColumns = $aSortColumns;
00953 
00954             $sCnid = oxConfig::getParameter( 'cnid' );
00955 
00956             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00957             $sSortDir = oxConfig::getParameter( 'listorder' );
00958 
00959             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00960                 $sSortBy  = $aSorting['sortby'];
00961                 $sSortDir = $aSorting['sortdir'];
00962             }
00963 
00964             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00965                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00966 
00967                 $this->_sListOrderBy  = $sSortBy;
00968                 $this->_sListOrderDir = $sSortDir;
00969 
00970                 // caching sorting config
00971                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00972             }
00973         }
00974     }
00975 
00981     public function getListOrderBy()
00982     {
00983         return $this->_sListOrderBy;
00984     }
00985 
00991     public function getListOrderDirection()
00992     {
00993         return $this->_sListOrderDir;
00994     }
00995 
01003     public function setMetaDescription ( $sDescription )
01004     {
01005         return $this->_sMetaDescription = $sDescription;
01006     }
01007 
01015     public function setMetaKeywords( $sKeywords )
01016     {
01017         return $this->_sMetaKeywords = $sKeywords;
01018     }
01019 
01026     protected function _getMetaSeoParam()
01027     {
01028     }
01029 
01037     protected function _getMetaFromSeo( $sDataType )
01038     {
01039         $sOxid  = $this->_getSeoObjectId();
01040         $iLang  = oxLang::getInstance()->getBaseLanguage();
01041         $sShop  = $this->getConfig()->getShopId();
01042         $sParam = $this->_getMetaSeoParam();
01043 
01044         if ( $sOxid && oxUtils::getInstance()->seoIsActive() &&
01045              ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, $sDataType, $sShop, $iLang, $sParam ) ) ) {
01046             return $sKeywords;
01047         }
01048     }
01049 
01057     protected function _getMetaFromContent( $sMetaIdent )
01058     {
01059         if ( $sMetaIdent ) {
01060             $oContent = oxNew( 'oxcontent' );
01061             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01062                  $oContent->oxcontents__oxactive->value ) {
01063                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01064             }
01065         }
01066     }
01067 
01073     public function getMetaKeywords()
01074     {
01075         if ( $this->_sMetaKeywords === null ) {
01076             $this->_sMetaKeywords = false;
01077 
01078             // set special meta keywords ?
01079             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01080                 $this->_sMetaKeywords = $sKeywords;
01081             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01082                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01083             } else {
01084                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01085             }
01086         }
01087 
01088         return $this->_sMetaKeywords;
01089     }
01090 
01096     public function getMetaDescription()
01097     {
01098         if ( $this->_sMetaDescription === null ) {
01099             $this->_sMetaDescription = false;
01100 
01101             // set special meta description ?
01102             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01103                 $this->_sMetaDescription = $sDescription;
01104             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01105                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01106             } else {
01107                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01108             }
01109         }
01110 
01111         return $this->_sMetaDescription;
01112     }
01113 
01119     public function getActCurrency()
01120     {
01121         return $this->_oActCurrency;
01122     }
01123 
01131     public function setActCurrency( $oCur )
01132     {
01133         $this->_oActCurrency = $oCur;
01134     }
01135 
01141     public function getCompareItemsCnt()
01142     {
01143         return $this->_iCompItemsCnt;
01144     }
01145 
01153     public function setCompareItemsCnt( $iCount )
01154     {
01155         $this->_iCompItemsCnt = $iCount;
01156     }
01157 
01163     public function getWishlistName()
01164     {
01165         return $this->_sWishlistName;
01166     }
01167 
01175     public function setWishlistName( $sName )
01176     {
01177         $this->_sWishlistName = $sName;
01178     }
01179 
01185     protected function _forceNoIndex()
01186     {
01187         $this->_blForceNoIndex = true;
01188     }
01189 
01196     public function noIndex()
01197     {
01198         if ( $this->_blForceNoIndex ) {
01199             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01200         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01201             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01202         } else {
01203             switch ( oxConfig::getParameter( 'fnc' ) ) {
01204                 case 'tocomparelist':
01205                 case 'tobasket':
01206                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01207                     break;
01208             }
01209         }
01210         return $this->_iViewIndexState;
01211     }
01212 
01219     public function getContentId()
01220     {
01221         if ( $this->_sContentId === null) {
01222             $oContent = oxNew( 'oxcontent' );
01223             $oContent->loadByIdent( 'oximpressum' );
01224             $this->_sContentId = $oContent->getId();
01225         }
01226 
01227         return $this->_sContentId;
01228     }
01229 
01236     public function getContent()
01237     {
01238         if ( $this->_oContent === null) {
01239             $oContent = oxNew( 'oxcontent' );
01240             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01241                 $this->_oContent = $oContent;
01242             }
01243         }
01244 
01245         return $this->_oContent;
01246     }
01247 
01253     public function isSortingActive()
01254     {
01255         return $this->_blActiveSorting;
01256     }
01257 
01263     public function getMenueList()
01264     {
01265         return $this->_aMenueList;
01266     }
01267 
01275     public function setMenueList( $aMenue )
01276     {
01277         $this->_aMenueList = $aMenue;
01278     }
01279 
01280 
01286     protected function _setNrOfArtPerPage()
01287     {
01288         $myConfig  = $this->getConfig();
01289         $aViewData = array();
01290 
01291         //setting default values to avoid possible errors showing article list
01292         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01293         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01294 
01295         // checking if all needed data is set
01296         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01297         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01298             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01299         } else {
01300             $iNrofCatArticles = $aNrofCatArticles[0];
01301         }
01302 
01303         $oViewConf = $this->getViewConfig();
01304         //value from user input
01305         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01306             // M45 Possibility to push any "Show articles per page" number parameter
01307             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01308             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01309             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01310         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01311             // M45 Possibility to push any "Show articles per page" number parameter
01312             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01313             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01314             $iNrofCatArticles = $iSessArtPerPage;
01315         } else {
01316             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01317         }
01318 
01319         //setting number of articles per page to config value
01320         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01321 
01322         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01323     }
01324 
01330     protected function _getSeoObjectId()
01331     {
01332     }
01333 
01343     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01344     {
01345         if ( $sMeta ) {
01346 
01347             $oStr = getStr();
01348             if ( $iLength != -1 ) {
01349                 /* *
01350                  * performance - we dont need a huge amount of initial text.
01351                  * assume that effective text may be double longer than $iLength
01352                  * and simple turncate it
01353                  */
01354                 $iELength = ( $iLength * 2 );
01355                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01356             }
01357 
01358             // decoding html entities
01359             $sMeta = $oStr->html_entity_decode( $sMeta );
01360             // stripping HTML tags
01361             $sMeta = strip_tags( $sMeta );
01362 
01363             // removing some special chars
01364             $sMeta = $oStr->cleanStr( $sMeta );
01365 
01366             // removing duplicate words
01367             if ( $blRemoveDuplicatedWords ) {
01368                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01369             }
01370 
01371             // some special cases
01372             $sMeta = str_replace( ' ,', ',', $sMeta );
01373             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01374             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01375             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01376 
01377             return trim( $sMeta );
01378         }
01379     }
01380 
01389     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01390     {
01391 
01392         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01393 
01394         if ( $blRemoveDuplicatedWords ) {
01395             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01396         }
01397 
01398         // removing in admin defined strings
01399 
01400         /*if ( is_array( $aSkipTags ) && $sString ) {
01401             $oStr = getStr();
01402             foreach ( $aSkipTags as $sSkip ) {
01403                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01404                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01405                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01406                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01407             }
01408         }*/
01409 
01410         return trim( $sString );
01411     }
01412 
01421     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01422     {
01423         $oStr = getStr();
01424         if ( is_array( $aInput ) ) {
01425             $aStrings = $aInput;
01426         } else {
01427             //is String
01428             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01429         }
01430 
01431         if ( $sCount = count( $aSkipTags ) ) {
01432             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01433                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01434             }
01435         }
01436         $sCount = count($aStrings);
01437         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01438             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01439             // removing in admin defined strings
01440             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01441                 unset( $aStrings[$iNum] );
01442             }
01443         }
01444 
01445         // duplicates
01446         $aStrings = array_unique($aStrings);
01447 
01448         return implode( ', ', $aStrings );
01449     }
01450 
01458     public function getNavigationParams()
01459     {
01460         $aParams['cnid'] = $this->getCategoryId();
01461         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01462 
01463         $aParams['listtype'] = $this->getListType();
01464         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01465 
01466         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01467         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01468         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01469 
01470         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01471         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01472         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01473 
01474         return $aParams;
01475     }
01476 
01486     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01487     {
01488         $aSorting = oxSession::getVar( 'aSorting' );
01489         $aSorting[$sCnid]['sortby']  = $sSortBy;
01490         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01491 
01492         oxSession::setVar( 'aSorting', $aSorting );
01493     }
01494 
01502     public function getSorting( $sCnid )
01503     {
01504         $aSorting = oxSession::getVar( 'aSorting' );
01505         if ( isset( $aSorting[$sCnid] ) ) {
01506             return $aSorting[$sCnid];
01507         }
01508     }
01509 
01517     public function getSortingSql( $sCnid )
01518     {
01519         $aSorting = $this->getSorting( $sCnid );
01520         if ( is_array( $aSorting ) ) {
01521             return implode( " ", $aSorting );
01522         }
01523     }
01524 
01530     public function getTitleSuffix()
01531     {
01532         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01533     }
01534 
01541     public function getTitlePrefix()
01542     {
01543         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01544     }
01545 
01554     protected function _getSubject( $iLang )
01555     {
01556         return null;
01557     }
01558 
01564     public function getDynUrlParams()
01565     {
01566         $sRet = '';
01567         $sListType = $this->getListType();
01568 
01569         switch ($sListType) {
01570             default:
01571                 break;
01572             case 'search':
01573                 $sRet .= "&amp;listtype={$sListType}";
01574                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01575                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01576                 }
01577 
01578                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01579                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01580                 }
01581                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01582                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01583                 }
01584                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01585                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01586                 }
01587                 break;
01588             case 'tag':
01589                 $sRet .= "&amp;listtype={$sListType}";
01590                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01591                     $sRet .= "&amp;searchtag={$sParam}";
01592                 }
01593                 break;
01594         }
01595 
01596         return $sRet;
01597     }
01598 
01606     public function getLink( $iLang = null )
01607     {
01608         if ( !isset( $iLang ) ) {
01609             $iLang = oxLang::getInstance()->getBaseLanguage();
01610         }
01611 
01612         $oDisplayObj = null;
01613         $blTrySeo = false;
01614         if ( oxUtils::getInstance()->seoIsActive() ) {
01615             $blTrySeo = true;
01616             $oDisplayObj = $this->_getSubject( $iLang );
01617         }
01618         $iActPageNr = $this->getActPage();
01619 
01620         if ( $oDisplayObj ) {
01621             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01622         }
01623 
01624         $myConfig = $this->getConfig();
01625 
01626         if ( $blTrySeo ) {
01627             $oEncoder = oxSeoEncoder::getInstance();
01628             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01629                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01630             }
01631         }
01632 
01633         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01634 
01635         // fallback to old non seo url
01636         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01637     }
01638 
01644     public function getCanonicalUrl()
01645     {
01646     }
01647 
01654     public function getSimilarRecommLists()
01655     {
01656     }
01657 
01665     protected function _getRequestParams( $blAddPageNr  = true )
01666     {
01667         $sClass = $this->getClassName();
01668         $sFnc   = $this->getFncName();
01669 
01670         // #921 S
01671         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01672         if ( in_array( $sFnc, $aFnc ) ) {
01673             $sFnc = '';
01674         }
01675 
01676         // #680
01677         $sURL = "cl={$sClass}";
01678         if ( $sFnc ) {
01679             $sURL .= "&amp;fnc={$sFnc}";
01680         }
01681         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01682             $sURL .= "&amp;cnid={$sVal}";
01683         }
01684         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01685             $sURL .= "&amp;mnid={$sVal}";
01686         }
01687         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01688             $sURL .= "&amp;anid={$sVal}";
01689         }
01690 
01691         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01692             $sURL .= "&amp;page={$sVal}";
01693         }
01694 
01695         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01696             $sURL .= "&amp;tpl={$sVal}";
01697         }
01698 
01699         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01700         // don't include page number for navigation
01701         // it will be done in oxubase::generatePageNavigation
01702         if ( $blAddPageNr && $iPgNr > 0 ) {
01703             $sURL .= "&amp;pgNr={$iPgNr}";
01704         }
01705 
01706         // #1184M - specialchar search
01707         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01708             $sURL .= "&amp;searchparam={$sVal}";
01709         }
01710 
01711         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01712             $sURL .= "&amp;searchcnid={$sVal}";
01713         }
01714 
01715         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01716             $sURL .= "&amp;searchvendor={$sVal}";
01717         }
01718 
01719         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01720             $sURL .= "&amp;searchmanufacturer={$sVal}";
01721         }
01722 
01723         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01724             $sURL .= "&amp;searchrecomm={$sVal}";
01725         }
01726 
01727         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01728             $sURL .= "&amp;searchtag={$sVal}";
01729         }
01730 
01731         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01732             $sURL .= "&amp;recommid={$sVal}";
01733         }
01734 
01735         return $sURL;
01736     }
01737 
01743     protected function _getSeoRequestParams()
01744     {
01745         $sClass = $this->getClassName();
01746         $sFnc   = $this->getFncName();
01747 
01748         // #921 S
01749         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01750         if ( in_array( $sFnc, $aFnc ) ) {
01751             $sFnc = '';
01752         }
01753 
01754         // #680
01755         $sURL = "cl={$sClass}";
01756         if ( $sFnc ) {
01757             $sURL .= "&amp;fnc={$sFnc}";
01758         }
01759         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01760             $sURL .= "&amp;page={$sVal}";
01761         }
01762 
01763         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01764             $sURL .= "&amp;tpl={$sVal}";
01765         }
01766 
01767         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01768         if ( $iPgNr > 0 ) {
01769             $sURL .= "&amp;pgNr={$iPgNr}";
01770         }
01771 
01772         return $sURL;
01773     }
01774 
01780     public function showSearch()
01781     {
01782         $blShow = true;
01783         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01784             $blShow = false;
01785         }
01786         return (int) $blShow;
01787     }
01788 
01794     public function getRssLinks()
01795     {
01796         return $this->_aRssLinks;
01797     }
01798 
01804     public function getSortColumns()
01805     {
01806         return $this->_aSortColumns;
01807     }
01808 
01814     public function getEditTags()
01815     {
01816     }
01817 
01823     public function getRecommSearch()
01824     {
01825     }
01826 
01832     public function getReviewUserId()
01833     {
01834     }
01835 
01841     public function getPaymentList()
01842     {
01843     }
01844 
01850     public function getActiveRecommList()
01851     {
01852         if ( $this->_oActiveRecommList === null ) {
01853             $this->_oActiveRecommList = false;
01854             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01855                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01856                 $this->_oActiveRecommList->load( $sOxid );
01857             }
01858         }
01859         return $this->_oActiveRecommList;
01860     }
01861 
01867     public function getAccessoires()
01868     {
01869     }
01870 
01876     public function getCrossSelling()
01877     {
01878     }
01879 
01885     public function getSimilarProducts()
01886     {
01887     }
01888 
01896     public function getAlsoBoughtThiesProducts()
01897     {
01898     }
01899 
01905     public function getAlsoBoughtTheseProducts()
01906     {
01907     }
01908 
01914     public function getArticleId()
01915     {
01916     }
01917 
01923     public function isMoreTagsVisible()
01924     {
01925         return false;
01926     }
01927 
01933     public function getTitle()
01934     {
01935     }
01936 
01942     public function getActiveLangAbbr()
01943     {
01944         // Performance
01945         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01946             return;
01947         }
01948 
01949         if ( !isset($this->_sActiveLangAbbr ) ) {
01950             $aLanguages = oxLang::getInstance()->getLanguageArray();
01951             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01952                 if ( $oVal->selected ) {
01953                     $this->_sActiveLangAbbr = $oVal->abbr;
01954                     break;
01955                 }
01956             }
01957         }
01958 
01959         return $this->_sActiveLangAbbr;
01960     }
01961 
01975     public function addGlobalParams( $oShop = null)
01976     {
01977         $myConfig = $this->getConfig();
01978 
01979         $oViewConf = parent::addGlobalParams( $oShop );
01980 
01981         $this->_aViewData['isfiltering'] = true;
01982         $this->_aViewData['isnewsletter'] = true;
01983         $this->_aViewData['isvarianten'] = true;
01984         $this->_aViewData['isreview'] = true;
01985         $this->_aViewData['isaddsales'] = true;
01986         $this->_aViewData['isvoucher'] = true;
01987         $this->_aViewData['ispricealarm'] = true;
01988         $this->_aViewData['iswishlist'] = true;
01989         $this->_aViewData['isipayment'] = true;
01990         $this->_aViewData['istrusted'] = true;
01991         $this->_aViewData['isfiltering'] = true;
01992         $this->_aViewData['isgooglestats'] = true;
01993         $this->_aViewData['iswishlist'] = true;
01994 
01995 
01996         // show baskets
01997         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01998         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01999         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02000 
02001         // allow currency swiching
02002         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02003 
02004         // show/hide vendors
02005         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02006 
02007         // show/hide Manufacturers
02008         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02009 
02010         // show/hide empty categories
02011         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02012 
02013         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02014 
02015         // used for compatibility with older templates
02016         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02017         $this->_aViewData['urlsign']    = '&';
02018         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02019         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02020 
02021         $this->_aViewData['sListType'] = $this->getListType();
02022         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02023 
02024         // new navigation ?
02025         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02026         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02027 
02028         $this->_setNrOfArtPerPage();
02029 
02030 
02031         return $oViewConf;
02032     }
02033 
02039     public function getAdditionalParams()
02040     {
02041         if ( $this->_sAdditionalParams === null ) {
02042             // #1018A
02043             $this->_sAdditionalParams  = parent::getAdditionalParams();
02044             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02045 
02046             // #1834M - specialchar search
02047             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02048             if ( isset( $sSearchParamForLink ) ) {
02049                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02050             }
02051             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02052                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02053             }
02054             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02055                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02056             }
02057             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02058                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02059             }
02060             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02061                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02062             }
02063             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02064                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02065             }
02066             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02067                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02068             }
02069         }
02070 
02071         return $this->_sAdditionalParams;
02072     }
02073 
02079     public function generatePageNavigationUrl()
02080     {
02081         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02082     }
02083 
02093     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02094     {
02095         if ( $iPage ) {
02096             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02097         }
02098         return $sUrl;
02099     }
02100 
02106     public function generatePageNavigation()
02107     {
02108         startProfile('generatePageNavigation');
02109         // generate the page navigation
02110         $pageNavigation = new stdClass();
02111         $pageNavigation->NrOfPages = $this->_iCntPages;
02112         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02113         $iActPage = $this->getActPage();
02114         $pageNavigation->actPage   = $iActPage + 1;
02115 
02116         $sUrl = $this->generatePageNavigationUrl();
02117 
02118         if ( $iActPage > 0) {
02119             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02120         }
02121 
02122         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02123             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02124         }
02125 
02126         if ( $pageNavigation->NrOfPages > 1 ) {
02127             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02128                 $page = new Oxstdclass();
02129                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02130                 $page->selected = 0;
02131                 if ( $i == $pageNavigation->actPage ) {
02132                     $page->selected = 1;
02133                 }
02134                 $pageNavigation->changePage[$i] = $page;
02135             }
02136 
02137             // first/last one
02138             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02139             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02140         }
02141 
02142         stopProfile('generatePageNavigation');
02143 
02144         return $pageNavigation;
02145     }
02146 
02154     public function prepareMinimumOrderPrice4View()
02155     {
02156         $myConfig = $this->getConfig();
02157         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02158         if ( isset( $iMinOrderPrice ) && is_numeric($iMinOrderPrice)) {
02159             $oBasket = $this->getSession()->getBasket();
02160             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02161                 return;
02162             }
02163             $oCur    = $myConfig->getActShopCurrencyObject();
02164             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02165             // Coupons and discounts should be considered in "Min order price" check
02166             $dVoucherDiscount = 0;
02167             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02168                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02169             }
02170             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02171                 $this->_iLowOrderPrice = 1;
02172                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02173             }
02174         }
02175     }
02176 
02183     public function render()
02184     {
02185         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02186             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02187         }
02188 
02189         parent::render();
02190 
02191         if ( $this->getIsOrderStep() ) {
02192 
02193             // disabling navigation during order ...
02194             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02195                 $this->_iNewsRealStatus = 1;
02196                 $this->setShowNewsletter( 0 );
02197                 // for old tpl. will be removed later
02198                 $this->_aViewData['isnewsletter'] = 0;
02199                 $this->setShowRightBasket( 0 );
02200                 $this->setShowLeftBasket( 0 );
02201                 $this->setShowTopBasket( 0 );
02202             }
02203             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02204             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02205         }
02206 
02207         // meta data
02208         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02209         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02210 
02211         // show baskets
02212         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02213         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02214         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02215 
02216         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02217 
02218         $this->_aViewData['noindex'] = $this->noIndex();
02219 
02220         return $this->_sThisTemplate;
02221     }
02222 
02228     public function getViewProduct()
02229     {
02230         return $this->getProduct();
02231     }
02232 
02240     public function setViewProduct( $oProduct )
02241     {
02242         $this->_oProduct = $oProduct;
02243     }
02244 
02250     public function getViewProductList()
02251     {
02252         return $this->_aArticleList;
02253     }
02254 
02260     public function getActPage()
02261     {
02262         if ( $this->_iActPage === null ) {
02263             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02264             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02265         }
02266         return $this->_iActPage;
02267     }
02268 
02276     public function getActTag()
02277     {
02278         if ( $this->_oActTag === null ) {
02279             $this->_oActTag = new Oxstdclass();
02280             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02281             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02282 
02283             if ( oxUtils::getInstance()->seoIsActive() ) {
02284                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02285             } else {
02286                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02287             }
02288 
02289         }
02290         return $this->_oActTag;
02291     }
02292 
02300     public function getActVendor()
02301     {
02302         // if active vendor is not set yet - trying to load it from request params
02303         // this may be usefull when category component was unable to load active vendor
02304         // and we still need some object to mount navigation info
02305         if ( $this->_oActVendor === null ) {
02306             $this->_oActVendor = false;
02307             $sVendorId = oxConfig::getParameter( 'cnid' );
02308             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02309             $oVendor = oxNew( 'oxvendor' );
02310             if ( $oVendor->load( $sVendorId ) ) {
02311                 $this->_oActVendor = $oVendor;
02312             }
02313         }
02314 
02315         return $this->_oActVendor;
02316     }
02317 
02325     public function getActManufacturer()
02326     {
02327         // if active Manufacturer is not set yet - trying to load it from request params
02328         // this may be usefull when category component was unable to load active Manufacturer
02329         // and we still need some object to mount navigation info
02330         if ( $this->_oActManufacturer === null ) {
02331 
02332             $this->_oActManufacturer = false;
02333             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02334             $oManufacturer = oxNew( 'oxmanufacturer' );
02335             if ( $oManufacturer->load( $sManufacturerId ) ) {
02336                 $this->_oActManufacturer = $oManufacturer;
02337             }
02338         }
02339 
02340         return $this->_oActManufacturer;
02341     }
02342 
02350     public function setActVendor( $oVendor )
02351     {
02352         $this->_oActVendor = $oVendor;
02353     }
02354 
02362     public function setActManufacturer( $oManufacturer )
02363     {
02364         $this->_oActManufacturer = $oManufacturer;
02365     }
02366 
02372     public function getActSearch()
02373     {
02374         if ( $this->_oActSearch === null ) {
02375             $this->_oActSearch = new oxStdClass();
02376             $sUrl = $this->getConfig()->getShopHomeURL();
02377             $this->_oActSearch->link = "{$sUrl}cl=search";
02378         }
02379         return $this->_oActSearch;
02380     }
02381 
02389     public function getActRecommList()
02390     {
02391         return $this->getActiveRecommList();
02392     }
02393 
02399     public function getCategoryTree()
02400     {
02401         return $this->_oCategoryTree;
02402     }
02403 
02411     public function setCategoryTree( $oCatTree )
02412     {
02413         $this->_oCategoryTree = $oCatTree;
02414     }
02415 
02421     public function getVendorTree()
02422     {
02423         return $this->_oVendorTree;
02424     }
02425 
02433     public function setVendorTree( $oVendorTree )
02434     {
02435         $this->_oVendorTree = $oVendorTree;
02436     }
02437 
02443     public function getManufacturerTree()
02444     {
02445         return $this->_oManufacturerTree;
02446     }
02447 
02455     public function setManufacturerTree( $oManufacturerTree )
02456     {
02457         $this->_oManufacturerTree = $oManufacturerTree;
02458     }
02468     protected function _loadActions()
02469     {
02470         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02471         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02472     }
02473 
02479     public function getAddUrlParams()
02480     {
02481     }
02482 
02489     public function getTop5ArticleList()
02490     {
02491         if ( $this->_blTop5Action ) {
02492             if ( $this->_aTop5ArticleList === null ) {
02493                 $this->_aTop5ArticleList = false;
02494                 $myConfig = $this->getConfig();
02495                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02496                     // top 5 articles
02497                     $oArtList = oxNew( 'oxarticlelist' );
02498                     $oArtList->loadTop5Articles();
02499                     if ( $oArtList->count() ) {
02500                         $this->_aTop5ArticleList = $oArtList;
02501                     }
02502                 }
02503             }
02504         }
02505         return $this->_aTop5ArticleList;
02506     }
02507 
02514     public function getBargainArticleList()
02515     {
02516         if ( $this->_blBargainAction ) {
02517             if ( $this->_aBargainArticleList === null ) {
02518                 $this->_aBargainArticleList = array();
02519                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02520                     $oArtList = oxNew( 'oxarticlelist' );
02521                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02522                     if ( $oArtList->count() ) {
02523                         $this->_aBargainArticleList = $oArtList;
02524                     }
02525                 }
02526             }
02527         }
02528         return $this->_aBargainArticleList;
02529     }
02530 
02537     public function isLowOrderPrice()
02538     {
02539         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02540             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02541         }
02542 
02543         return $this->_blLowOrderPrice;
02544     }
02545 
02551     public function getMinOrderPrice()
02552     {
02553         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02554             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02555             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02556         }
02557         return $this->_sMinOrderPrice;
02558     }
02559 
02565     public function getNewsRealStatus()
02566     {
02567         return $this->_iNewsRealStatus;
02568     }
02569 
02575     protected function _canRedirect()
02576     {
02577         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02578             if ( oxConfig::getParameter( $sParam ) !== null ) {
02579                 return false;
02580             }
02581         }
02582 
02583         return true;
02584     }
02585 
02591     public function getProduct()
02592     {
02593     }
02594 
02600     public function getVendorlist()
02601     {
02602         return $this->_aVendorlist;
02603     }
02604 
02612     public function setVendorlist( $aList )
02613     {
02614         $this->_aVendorlist = $aList;
02615     }
02616 
02622     public function getManufacturerlist()
02623     {
02624         return $this->_aManufacturerlist;
02625     }
02626 
02634     public function setManufacturerlist( $aList )
02635     {
02636         $this->_aManufacturerlist = $aList;
02637     }
02638 
02646     public function setRootVendor( $oVendor )
02647     {
02648         $this->_oRootVendor = $oVendor;
02649     }
02650 
02656     public function getRootVendor()
02657     {
02658         return $this->_oRootVendor;
02659     }
02660 
02668     public function setRootManufacturer( $oManufacturer )
02669     {
02670         $this->_oRootManufacturer = $oManufacturer;
02671     }
02672 
02678     public function getRootManufacturer()
02679     {
02680         return $this->_oRootManufacturer;
02681     }
02682 
02688     public function getVendorId()
02689     {
02690         if ( $this->_sVendorId === null ) {
02691             $this->_sVendorId = false;
02692             if ( ( $oVendor = $this->getActVendor() ) ) {
02693                 $this->_sVendorId = $oVendor->getId();
02694             }
02695         }
02696         return $this->_sVendorId;
02697     }
02698 
02704     public function getManufacturerId()
02705     {
02706         if ( $this->_sManufacturerId === null ) {
02707             $this->_sManufacturerId = false;
02708             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02709                 $this->_sManufacturerId = $oManufacturer->getId();
02710             }
02711         }
02712         return $this->_sManufacturerId;
02713     }
02714 
02720     public function getSearchCatTree()
02721     {
02722         return $this->_aSearchCatTree;
02723     }
02724 
02732     public function setSearchCatTree( $aTree )
02733     {
02734         $this->_aSearchCatTree = $aTree;
02735     }
02736 
02742     public function getCatMore()
02743     {
02744         return $this->_oCatMore;
02745     }
02746 
02754     public function setCatMore( $oCat )
02755     {
02756         $this->_oCatMore = $oCat;
02757     }
02758 
02764     public function getCatTreePath()
02765     {
02766         return $this->_sCatTreePath;
02767     }
02768 
02776     public function getContentByIdent( $sIdent )
02777     {
02778         if ( !isset( $this->_aContents[$sIdent] ) ) {
02779             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02780             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02781         }
02782         return $this->_aContents[$sIdent];
02783     }
02784 
02790     public function getContentCategory()
02791     {
02792         return false;
02793     }
02794 
02800     public function getMustFillFields()
02801     {
02802         if ( $this->_aMustFillFields === null ) {
02803             $this->_aMustFillFields = false;
02804 
02805             // passing must-be-filled-fields info
02806             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02807             if ( is_array( $aMustFillFields ) ) {
02808                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02809             }
02810         }
02811         return $this->_aMustFillFields;
02812     }
02813 
02821     public function isFieldRequired( $sField )
02822     {
02823         if ( $aMustFillFields = $this->getMustFillFields() ) {
02824             if ( isset( $aMustFillFields[$sField] ) ) {
02825                 return true;
02826             }
02827         }
02828 
02829         return false;
02830     }
02831 
02837     public function getFormId()
02838     {
02839         if ( $this->_sFormId === null ) {
02840             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02841             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02842         }
02843 
02844         return $this->_sFormId;
02845     }
02846 
02852     public function canAcceptFormData()
02853     {
02854         if ( $this->_blCanAcceptFormData === null ) {
02855             $this->_blCanAcceptFormData = false;
02856 
02857             $sFormId = oxConfig::getParameter( "uformid" );
02858             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02859 
02860             // testing if form and session ids matches
02861             if ( $sFormId && $sFormId === $sSessionFormId ) {
02862                 $this->_blCanAcceptFormData = true;
02863             }
02864 
02865             // regenerating form data
02866             $this->getFormId();
02867         }
02868         return $this->_blCanAcceptFormData;
02869     }
02870 
02871 }

Generated by  doxygen 1.6.2