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 = 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         if ( oxUtils::getInstance()->seoIsActive() ) {
01614             $blTrySeo = true;
01615             $oDisplayObj = $this->_getSubject( $iLang );
01616         }
01617         $iActPageNr = $this->getActPage();
01618 
01619         if ( $oDisplayObj ) {
01620             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01621         }
01622 
01623         $myConfig = $this->getConfig();
01624 
01625         if ( $blTrySeo ) {
01626             $oEncoder = oxSeoEncoder::getInstance();
01627             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01628                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01629             }
01630         }
01631 
01632         $sUrl = oxUtilsUrl::getInstance()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01633 
01634         // fallback to old non seo url
01635         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01636     }
01637 
01643     public function getCanonicalUrl()
01644     {
01645     }
01646 
01653     public function getSimilarRecommLists()
01654     {
01655     }
01656 
01664     protected function _getRequestParams( $blAddPageNr  = true )
01665     {
01666         $sClass = $this->getClassName();
01667         $sFnc   = $this->getFncName();
01668 
01669         // #921 S
01670         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01671         if ( in_array( $sFnc, $aFnc ) ) {
01672             $sFnc = '';
01673         }
01674 
01675         // #680
01676         $sURL = "cl={$sClass}";
01677         if ( $sFnc ) {
01678             $sURL .= "&amp;fnc={$sFnc}";
01679         }
01680         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01681             $sURL .= "&amp;cnid={$sVal}";
01682         }
01683         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01684             $sURL .= "&amp;mnid={$sVal}";
01685         }
01686         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01687             $sURL .= "&amp;anid={$sVal}";
01688         }
01689 
01690         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01691             $sURL .= "&amp;page={$sVal}";
01692         }
01693 
01694         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01695             $sURL .= "&amp;tpl={$sVal}";
01696         }
01697 
01698         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01699         // don't include page number for navigation
01700         // it will be done in oxubase::generatePageNavigation
01701         if ( $blAddPageNr && $iPgNr > 0 ) {
01702             $sURL .= "&amp;pgNr={$iPgNr}";
01703         }
01704 
01705         // #1184M - specialchar search
01706         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01707             $sURL .= "&amp;searchparam={$sVal}";
01708         }
01709 
01710         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01711             $sURL .= "&amp;searchcnid={$sVal}";
01712         }
01713 
01714         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01715             $sURL .= "&amp;searchvendor={$sVal}";
01716         }
01717 
01718         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01719             $sURL .= "&amp;searchmanufacturer={$sVal}";
01720         }
01721 
01722         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01723             $sURL .= "&amp;searchrecomm={$sVal}";
01724         }
01725 
01726         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01727             $sURL .= "&amp;searchtag={$sVal}";
01728         }
01729 
01730         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01731             $sURL .= "&amp;recommid={$sVal}";
01732         }
01733 
01734         return $sURL;
01735     }
01736 
01742     protected function _getSeoRequestParams()
01743     {
01744         $sClass = $this->getClassName();
01745         $sFnc   = $this->getFncName();
01746 
01747         // #921 S
01748         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01749         if ( in_array( $sFnc, $aFnc ) ) {
01750             $sFnc = '';
01751         }
01752 
01753         // #680
01754         $sURL = "cl={$sClass}";
01755         if ( $sFnc ) {
01756             $sURL .= "&amp;fnc={$sFnc}";
01757         }
01758         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01759             $sURL .= "&amp;page={$sVal}";
01760         }
01761 
01762         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01763             $sURL .= "&amp;tpl={$sVal}";
01764         }
01765 
01766         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01767         if ( $iPgNr > 0 ) {
01768             $sURL .= "&amp;pgNr={$iPgNr}";
01769         }
01770 
01771         return $sURL;
01772     }
01773 
01779     public function showSearch()
01780     {
01781         $blShow = true;
01782         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01783             $blShow = false;
01784         }
01785         return (int) $blShow;
01786     }
01787 
01793     public function getRssLinks()
01794     {
01795         return $this->_aRssLinks;
01796     }
01797 
01803     public function getSortColumns()
01804     {
01805         return $this->_aSortColumns;
01806     }
01807 
01813     public function getEditTags()
01814     {
01815     }
01816 
01822     public function getRecommSearch()
01823     {
01824     }
01825 
01831     public function getReviewUserId()
01832     {
01833     }
01834 
01840     public function getPaymentList()
01841     {
01842     }
01843 
01849     public function getActiveRecommList()
01850     {
01851         if ( $this->_oActiveRecommList === null ) {
01852             $this->_oActiveRecommList = false;
01853             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01854                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01855                 $this->_oActiveRecommList->load( $sOxid );
01856             }
01857         }
01858         return $this->_oActiveRecommList;
01859     }
01860 
01866     public function getAccessoires()
01867     {
01868     }
01869 
01875     public function getCrossSelling()
01876     {
01877     }
01878 
01884     public function getSimilarProducts()
01885     {
01886     }
01887 
01895     public function getAlsoBoughtThiesProducts()
01896     {
01897     }
01898 
01904     public function getAlsoBoughtTheseProducts()
01905     {
01906     }
01907 
01913     public function getArticleId()
01914     {
01915     }
01916 
01922     public function isMoreTagsVisible()
01923     {
01924         return false;
01925     }
01926 
01932     public function getTitle()
01933     {
01934     }
01935 
01941     public function getActiveLangAbbr()
01942     {
01943         // Performance
01944         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01945             return;
01946         }
01947 
01948         if ( !isset($this->_sActiveLangAbbr ) ) {
01949             $aLanguages = oxLang::getInstance()->getLanguageArray();
01950             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01951                 if ( $oVal->selected ) {
01952                     $this->_sActiveLangAbbr = $oVal->abbr;
01953                     break;
01954                 }
01955             }
01956         }
01957 
01958         return $this->_sActiveLangAbbr;
01959     }
01960 
01974     public function addGlobalParams( $oShop = null)
01975     {
01976         $myConfig = $this->getConfig();
01977 
01978         $oViewConf = parent::addGlobalParams( $oShop );
01979 
01980         $this->_aViewData['isfiltering'] = true;
01981         $this->_aViewData['isnewsletter'] = true;
01982         $this->_aViewData['isvarianten'] = true;
01983         $this->_aViewData['isreview'] = true;
01984         $this->_aViewData['isaddsales'] = true;
01985         $this->_aViewData['isvoucher'] = true;
01986         $this->_aViewData['ispricealarm'] = true;
01987         $this->_aViewData['iswishlist'] = true;
01988         $this->_aViewData['isipayment'] = true;
01989         $this->_aViewData['istrusted'] = true;
01990         $this->_aViewData['isfiltering'] = true;
01991         $this->_aViewData['isgooglestats'] = true;
01992         $this->_aViewData['iswishlist'] = true;
01993 
01994 
01995         // show baskets
01996         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01997         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01998         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01999 
02000         // allow currency swiching
02001         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
02002 
02003         // show/hide vendors
02004         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
02005 
02006         // show/hide Manufacturers
02007         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
02008 
02009         // show/hide empty categories
02010         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
02011 
02012         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
02013 
02014         // used for compatibility with older templates
02015         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
02016         $this->_aViewData['urlsign']    = '&';
02017         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
02018         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
02019 
02020         $this->_aViewData['sListType'] = $this->getListType();
02021         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
02022 
02023         // new navigation ?
02024         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
02025         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
02026 
02027         $this->_setNrOfArtPerPage();
02028 
02029 
02030         return $oViewConf;
02031     }
02032 
02038     public function getAdditionalParams()
02039     {
02040         if ( $this->_sAdditionalParams === null ) {
02041             // #1018A
02042             $this->_sAdditionalParams  = parent::getAdditionalParams();
02043             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02044 
02045             // #1834M - specialchar search
02046             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02047             if ( isset( $sSearchParamForLink ) ) {
02048                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02049             }
02050             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02051                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02052             }
02053             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02054                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02055             }
02056             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02057                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02058             }
02059             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02060                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02061             }
02062             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02063                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02064             }
02065             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02066                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02067             }
02068         }
02069 
02070         return $this->_sAdditionalParams;
02071     }
02072 
02078     public function generatePageNavigationUrl()
02079     {
02080         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02081     }
02082 
02092     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02093     {
02094         if ( $iPage ) {
02095             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02096         }
02097         return $sUrl;
02098     }
02099 
02105     public function generatePageNavigation()
02106     {
02107         startProfile('generatePageNavigation');
02108         // generate the page navigation
02109         $pageNavigation = new stdClass();
02110         $pageNavigation->NrOfPages = $this->_iCntPages;
02111         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02112         $iActPage = $this->getActPage();
02113         $pageNavigation->actPage   = $iActPage + 1;
02114 
02115         $sUrl = $this->generatePageNavigationUrl();
02116 
02117         if ( $iActPage > 0) {
02118             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02119         }
02120 
02121         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02122             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02123         }
02124 
02125         if ( $pageNavigation->NrOfPages > 1 ) {
02126             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02127                 $page = new Oxstdclass();
02128                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02129                 $page->selected = 0;
02130                 if ( $i == $pageNavigation->actPage ) {
02131                     $page->selected = 1;
02132                 }
02133                 $pageNavigation->changePage[$i] = $page;
02134             }
02135 
02136             // first/last one
02137             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02138             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02139         }
02140 
02141         stopProfile('generatePageNavigation');
02142 
02143         return $pageNavigation;
02144     }
02145 
02153     public function prepareMinimumOrderPrice4View()
02154     {
02155         $myConfig = $this->getConfig();
02156         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02157         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02158             $oBasket = $this->getSession()->getBasket();
02159             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02160                 return;
02161             }
02162             $oCur    = $myConfig->getActShopCurrencyObject();
02163             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02164             // Coupons and discounts should be considered in "Min order price" check
02165             $dVoucherDiscount = 0;
02166             if ( ( $oVoucherPrice = $oBasket->getVoucherDiscount() ) ) {
02167                 $dVoucherDiscount = $oVoucherPrice->getBruttoPrice();
02168             }
02169             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $dVoucherDiscount) ) {
02170                 $this->_iLowOrderPrice = 1;
02171                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02172             }
02173         }
02174     }
02175 
02182     public function render()
02183     {
02184         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02185             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02186         }
02187 
02188         parent::render();
02189 
02190         if ( $this->getIsOrderStep() ) {
02191 
02192             // disabling navigation during order ...
02193             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02194                 $this->_iNewsRealStatus = 1;
02195                 $this->setShowNewsletter( 0 );
02196                 // for old tpl. will be removed later
02197                 $this->_aViewData['isnewsletter'] = 0;
02198                 $this->setShowRightBasket( 0 );
02199                 $this->setShowLeftBasket( 0 );
02200                 $this->setShowTopBasket( 0 );
02201             }
02202             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02203             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02204         }
02205 
02206         // meta data
02207         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02208         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02209 
02210         // show baskets
02211         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02212         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02213         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02214 
02215         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02216 
02217         $this->_aViewData['noindex'] = $this->noIndex();
02218 
02219         return $this->_sThisTemplate;
02220     }
02221 
02227     public function getViewProduct()
02228     {
02229         return $this->getProduct();
02230     }
02231 
02239     public function setViewProduct( $oProduct )
02240     {
02241         $this->_oProduct = $oProduct;
02242     }
02243 
02249     public function getViewProductList()
02250     {
02251         return $this->_aArticleList;
02252     }
02253 
02259     public function getActPage()
02260     {
02261         if ( $this->_iActPage === null ) {
02262             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02263             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02264         }
02265         return $this->_iActPage;
02266     }
02267 
02275     public function getActTag()
02276     {
02277         if ( $this->_oActTag === null ) {
02278             $this->_oActTag = new Oxstdclass();
02279             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02280             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02281 
02282             if ( oxUtils::getInstance()->seoIsActive() ) {
02283                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02284             } else {
02285                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02286             }
02287 
02288         }
02289         return $this->_oActTag;
02290     }
02291 
02299     public function getActVendor()
02300     {
02301         // if active vendor is not set yet - trying to load it from request params
02302         // this may be usefull when category component was unable to load active vendor
02303         // and we still need some object to mount navigation info
02304         if ( $this->_oActVendor === null ) {
02305             $this->_oActVendor = false;
02306             $sVendorId = oxConfig::getParameter( 'cnid' );
02307             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02308             $oVendor = oxNew( 'oxvendor' );
02309             if ( $oVendor->load( $sVendorId ) ) {
02310                 $this->_oActVendor = $oVendor;
02311             }
02312         }
02313 
02314         return $this->_oActVendor;
02315     }
02316 
02324     public function getActManufacturer()
02325     {
02326         // if active Manufacturer is not set yet - trying to load it from request params
02327         // this may be usefull when category component was unable to load active Manufacturer
02328         // and we still need some object to mount navigation info
02329         if ( $this->_oActManufacturer === null ) {
02330 
02331             $this->_oActManufacturer = false;
02332             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02333             $oManufacturer = oxNew( 'oxmanufacturer' );
02334             if ( $oManufacturer->load( $sManufacturerId ) ) {
02335                 $this->_oActManufacturer = $oManufacturer;
02336             }
02337         }
02338 
02339         return $this->_oActManufacturer;
02340     }
02341 
02349     public function setActVendor( $oVendor )
02350     {
02351         $this->_oActVendor = $oVendor;
02352     }
02353 
02361     public function setActManufacturer( $oManufacturer )
02362     {
02363         $this->_oActManufacturer = $oManufacturer;
02364     }
02365 
02371     public function getActSearch()
02372     {
02373         if ( $this->_oActSearch === null ) {
02374             $this->_oActSearch = new oxStdClass();
02375             $sUrl = $this->getConfig()->getShopHomeURL();
02376             $this->_oActSearch->link = "{$sUrl}cl=search";
02377         }
02378         return $this->_oActSearch;
02379     }
02380 
02388     public function getActRecommList()
02389     {
02390         return $this->getActiveRecommList();
02391     }
02392 
02398     public function getCategoryTree()
02399     {
02400         return $this->_oCategoryTree;
02401     }
02402 
02410     public function setCategoryTree( $oCatTree )
02411     {
02412         $this->_oCategoryTree = $oCatTree;
02413     }
02414 
02420     public function getVendorTree()
02421     {
02422         return $this->_oVendorTree;
02423     }
02424 
02432     public function setVendorTree( $oVendorTree )
02433     {
02434         $this->_oVendorTree = $oVendorTree;
02435     }
02436 
02442     public function getManufacturerTree()
02443     {
02444         return $this->_oManufacturerTree;
02445     }
02446 
02454     public function setManufacturerTree( $oManufacturerTree )
02455     {
02456         $this->_oManufacturerTree = $oManufacturerTree;
02457     }
02467     protected function _loadActions()
02468     {
02469         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02470         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02471     }
02472 
02478     public function getAddUrlParams()
02479     {
02480     }
02481 
02488     public function getTop5ArticleList()
02489     {
02490         if ( $this->_blTop5Action ) {
02491             if ( $this->_aTop5ArticleList === null ) {
02492                 $this->_aTop5ArticleList = false;
02493                 $myConfig = $this->getConfig();
02494                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02495                     // top 5 articles
02496                     $oArtList = oxNew( 'oxarticlelist' );
02497                     $oArtList->loadTop5Articles();
02498                     if ( $oArtList->count() ) {
02499                         $this->_aTop5ArticleList = $oArtList;
02500                     }
02501                 }
02502             }
02503         }
02504         return $this->_aTop5ArticleList;
02505     }
02506 
02513     public function getBargainArticleList()
02514     {
02515         if ( $this->_blBargainAction ) {
02516             if ( $this->_aBargainArticleList === null ) {
02517                 $this->_aBargainArticleList = array();
02518                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02519                     $oArtList = oxNew( 'oxarticlelist' );
02520                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02521                     if ( $oArtList->count() ) {
02522                         $this->_aBargainArticleList = $oArtList;
02523                     }
02524                 }
02525             }
02526         }
02527         return $this->_aBargainArticleList;
02528     }
02529 
02536     public function isLowOrderPrice()
02537     {
02538         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02539             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02540         }
02541 
02542         return $this->_blLowOrderPrice;
02543     }
02544 
02550     public function getMinOrderPrice()
02551     {
02552         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02553             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02554             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02555         }
02556         return $this->_sMinOrderPrice;
02557     }
02558 
02564     public function getNewsRealStatus()
02565     {
02566         return $this->_iNewsRealStatus;
02567     }
02568 
02574     protected function _canRedirect()
02575     {
02576         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02577             if ( oxConfig::getParameter( $sParam ) !== null ) {
02578                 return false;
02579             }
02580         }
02581 
02582         return true;
02583     }
02584 
02590     public function getProduct()
02591     {
02592     }
02593 
02599     public function getVendorlist()
02600     {
02601         return $this->_aVendorlist;
02602     }
02603 
02611     public function setVendorlist( $aList )
02612     {
02613         $this->_aVendorlist = $aList;
02614     }
02615 
02621     public function getManufacturerlist()
02622     {
02623         return $this->_aManufacturerlist;
02624     }
02625 
02633     public function setManufacturerlist( $aList )
02634     {
02635         $this->_aManufacturerlist = $aList;
02636     }
02637 
02645     public function setRootVendor( $oVendor )
02646     {
02647         $this->_oRootVendor = $oVendor;
02648     }
02649 
02655     public function getRootVendor()
02656     {
02657         return $this->_oRootVendor;
02658     }
02659 
02667     public function setRootManufacturer( $oManufacturer )
02668     {
02669         $this->_oRootManufacturer = $oManufacturer;
02670     }
02671 
02677     public function getRootManufacturer()
02678     {
02679         return $this->_oRootManufacturer;
02680     }
02681 
02687     public function getVendorId()
02688     {
02689         if ( $this->_sVendorId === null ) {
02690             $this->_sVendorId = false;
02691             if ( ( $oVendor = $this->getActVendor() ) ) {
02692                 $this->_sVendorId = $oVendor->getId();
02693             }
02694         }
02695         return $this->_sVendorId;
02696     }
02697 
02703     public function getManufacturerId()
02704     {
02705         if ( $this->_sManufacturerId === null ) {
02706             $this->_sManufacturerId = false;
02707             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02708                 $this->_sManufacturerId = $oManufacturer->getId();
02709             }
02710         }
02711         return $this->_sManufacturerId;
02712     }
02713 
02719     public function getSearchCatTree()
02720     {
02721         return $this->_aSearchCatTree;
02722     }
02723 
02731     public function setSearchCatTree( $aTree )
02732     {
02733         $this->_aSearchCatTree = $aTree;
02734     }
02735 
02741     public function getCatMore()
02742     {
02743         return $this->_oCatMore;
02744     }
02745 
02753     public function setCatMore( $oCat )
02754     {
02755         $this->_oCatMore = $oCat;
02756     }
02757 
02763     public function getCatTreePath()
02764     {
02765         return $this->_sCatTreePath;
02766     }
02767 
02775     public function getContentByIdent( $sIdent )
02776     {
02777         if ( !isset( $this->_aContents[$sIdent] ) ) {
02778             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02779             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02780         }
02781         return $this->_aContents[$sIdent];
02782     }
02783 
02789     public function getContentCategory()
02790     {
02791         return false;
02792     }
02793 
02799     public function getMustFillFields()
02800     {
02801         if ( $this->_aMustFillFields === null ) {
02802             $this->_aMustFillFields = false;
02803 
02804             // passing must-be-filled-fields info
02805             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02806             if ( is_array( $aMustFillFields ) ) {
02807                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02808             }
02809         }
02810         return $this->_aMustFillFields;
02811     }
02812 
02820     public function isFieldRequired( $sField )
02821     {
02822         if ( $aMustFillFields = $this->getMustFillFields() ) {
02823             if ( isset( $aMustFillFields[$sField] ) ) {
02824                 return true;
02825             }
02826         }
02827 
02828         return false;
02829     }
02830 
02836     public function getFormId()
02837     {
02838         if ( $this->_sFormId === null ) {
02839             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02840             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02841         }
02842 
02843         return $this->_sFormId;
02844     }
02845 
02851     public function canAcceptFormData()
02852     {
02853         if ( $this->_blCanAcceptFormData === null ) {
02854             $this->_blCanAcceptFormData = false;
02855 
02856             $sFormId = oxConfig::getParameter( "uformid" );
02857             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02858 
02859             // testing if form and session ids matches
02860             if ( $sFormId && $sFormId === $sSessionFormId ) {
02861                 $this->_blCanAcceptFormData = true;
02862             }
02863 
02864             // regenerating form data
02865             $this->getFormId();
02866         }
02867         return $this->_blCanAcceptFormData;
02868     }
02869 
02870 }

Generated by  doxygen 1.6.2