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 
00059     protected $_oClickCat = null;
00060 
00066     protected $_sCategoryId = null;
00067 
00073     protected $_oActManufacturer = null;
00074 
00080     protected $_oActVendor = null;
00081 
00087     protected $_oActSearch = null;
00088 
00093     protected $_blShowSorting = false;
00094 
00099     protected $_blShowRightBasket = null;
00100 
00105     protected $_blShowTopBasket = null;
00106 
00111     protected $_blShowLeftBasket = null;
00112 
00117     protected $_blLoadCurrency = null;
00118 
00123     protected $_blLoadVendorTree = null;
00124 
00129     protected $_blLoadManufacturerTree = null;
00130 
00135     protected $_blDontShowEmptyCats = null;
00136 
00141     protected $_blLoadLanguage = null;
00142 
00147     protected $_blShowTopCatNav = null;
00148 
00153     protected $_iTopCatNavItmCnt = null;
00154 
00159     protected $_aRssLinks = null;
00160 
00165     protected $_sListOrderBy = null;
00166 
00171     protected $_sListOrderDir = null;
00172 
00177     protected $_sMetaDescription = null;
00178 
00183     protected $_sMetaKeywords = null;
00184 
00190     protected $_sMetaDescriptionIdent = null;
00191 
00197     protected $_sMetaKeywordsIdent = null;
00198 
00203     protected $_sAdditionalParams = null;
00204 
00209     protected $_oActCurrency = null;
00210 
00217     protected $_blCommonAdded = false;
00218 
00225     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00226 
00233     protected $_blForceNoIndex = false;
00234 
00239     protected $_sWishlistName = null;
00240 
00245     protected $_iCompItemsCnt = null;
00246 
00252     protected $_sContentId = null;
00253 
00259     protected $_oContent = null;
00260 
00266     protected $_sViewResetID = null;
00267 
00272     protected $_blActiveSorting = null;
00273 
00278     protected $_aMenueList = null;
00279 
00285     protected $_aComponentNames = array(
00286                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00287                                     'oxcmp_lang'       => 1,
00288                                     'oxcmp_cur'        => 1,
00289                                     'oxcmp_shop'       => 1,
00290                                     'oxcmp_categories' => 0,
00291                                     'oxcmp_utils'      => 1,
00292                                     'oxcmp_news'       => 0,
00293                                     'oxcmp_basket'     => 1
00294                                   );
00295 
00301     protected $_aUserComponentNames = array();
00302 
00308     protected $_oProduct = null;
00309 
00314     protected $_iActPage = null;
00315 
00320     protected $_aArticleList = null;
00321 
00326     protected $_oVendorTree  = null;
00327 
00332     protected $_oManufacturerTree  = null;
00333 
00338     protected $_oCategoryTree  = null;
00339 
00344     protected $_aTop5ArticleList  = null;
00345 
00350     protected $_aBargainArticleList  = null;
00351 
00356     protected $_iLowOrderPrice  = null;
00357 
00362     protected $_sMinOrderPrice  = null;
00363 
00368     protected $_iNewsRealStatus  = null;
00369 
00374     protected $_aBlockRedirectParams = array( 'fnc' );
00375 
00380     protected $_aVendorlist = null;
00381 
00386     protected $_oRootVendor = null;
00387 
00392     protected $_sVendorId = null;
00393 
00398     protected $_aManufacturerlist = null;
00399 
00404     protected $_oRootManufacturer = null;
00405 
00410     protected $_sManufacturerId = null;
00411 
00416     protected $_aSearchCatTree = null;
00417 
00422     protected $_oCatMore = null;
00423 
00428     protected $_blNewsSubscribed = null;
00429 
00434     protected $_blShowShipAddress = null;
00435 
00440     protected $_oDelAddress = null;
00441 
00446     protected $_sCatTreePath = null;
00447 
00452     protected $_aContents = array();
00453 
00458     protected $_blTop5Action = false;
00459 
00464     protected $_blBargainAction = false;
00465 
00474     protected function _processRequest()
00475     {
00476         $myUtils = oxUtils::getInstance();
00477 
00478         // non admin, request is not empty and was not processed by seo engine
00479         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00480 
00481             // fetching standard url and looking for it in seo table
00482             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00483                 $myUtils->redirect( $this->getConfig()->getShopURL() . $sRedirectUrl, false );
00484             } else {
00485                 // forcing to set noindex/follow meta
00486                 $this->_forceNoIndex();
00487 
00488                 $sShopId = $this->getConfig()->getShopId();
00489                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00490                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00491 
00492                 // logging "not found" url
00493                 $oDb = oxDb::getDb();
00494                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00495                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00496             }
00497         }
00498     }
00499 
00506     public function init()
00507     {
00508         $this->_processRequest();
00509 
00510         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00511             unset( $this->_aComponentNames['oxcmp_basket'] );
00512         }
00513 
00514         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00515         if ( !$this->_blCommonAdded ) {
00516             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00517             $this->_blCommonAdded = true;
00518         }
00519 
00520         // storing current view
00521         $blInit = true;
00522 
00523 
00524         // init all components if there are any
00525         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00526             // do not override initiated components
00527             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00528                 // component objects MUST be created to support user called functions
00529                 $oComponent = oxNew( $sComponentName );
00530                 $oComponent->setParent( $this );
00531                 $oComponent->setThisAction( $sComponentName );
00532                 $this->_oaComponents[$sComponentName] = $oComponent;
00533             }
00534 
00535             // do we really need to initiate them ?
00536             if ( $blInit ) {
00537                 $this->_oaComponents[$sComponentName]->init();
00538 
00539                 // executing only is view does not have action method
00540                 if ( !method_exists( $this, $this->getFncName() ) ) {
00541                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00542                 }
00543             }
00544         }
00545 
00546         parent::init();
00547 
00548         // enable sorting ?
00549         if ( $this->showSorting() ) {
00550             $this->prepareSortColumns();
00551         }
00552         $this->_aViewData['showsorting']    = $this->isSortingActive();
00553         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00554         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00555         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00556     }
00557 
00564     public function getViewId()
00565     {
00566         if ( $this->_sViewId ) {
00567             return $this->_sViewId;
00568         }
00569 
00570         $iLang = oxLang::getInstance()->getBaseLanguage();
00571         $iCur  = (int) oxConfig::getParameter( 'currency' );
00572 
00573 
00574             $this->_sViewId =  "ox|$iLang|$iCur";
00575 
00576         return $this->_sViewId;
00577     }
00578 
00579 
00585     public function showSorting()
00586     {
00587         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00588     }
00589 
00597     public function setComponents( $aComponents = null )
00598     {
00599         $this->_oaComponents = $aComponents;
00600     }
00601 
00607     public function getComponents()
00608     {
00609         return $this->_oaComponents;
00610     }
00611 
00619     public function setIsOrderStep( $blIsOrderStep = null )
00620     {
00621         $this->_blIsOrderStep = $blIsOrderStep;
00622     }
00623 
00629     public function getIsOrderStep()
00630     {
00631         return $this->_blIsOrderStep;
00632     }
00633 
00634 
00642     public function setActiveCategory( $oCategory )
00643     {
00644         $this->_oActCategory = $oCategory;
00645     }
00646 
00652     public function getActiveCategory()
00653     {
00654         return $this->_oActCategory;
00655     }
00656 
00664     public function setIsCallForCache( $blIsCallForCache = null )
00665     {
00666         $this->_blIsCallForCache = $blIsCallForCache;
00667     }
00668 
00674     public function getIsCallForCache()
00675     {
00676         return $this->_blIsCallForCache;
00677     }
00678 
00684     public function getListType()
00685     {
00686         if ( $this->_sListType == null ) {
00687             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00688                 $this->_sListType = $sListType;
00689             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00690                 $this->_sListType = $sListType;
00691             }
00692         }
00693         return $this->_sListType;
00694     }
00695 
00703     public function setListType( $sType )
00704     {
00705         $this->_sListType = $sType;
00706         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00707     }
00708 
00714     public function getCategoryId()
00715     {
00716         if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00717             $this->_sCategoryId = $sCatId;
00718         }
00719 
00720         return $this->_sCategoryId;
00721     }
00722 
00730     public function setCategoryId( $sCategoryId )
00731     {
00732         $this->_sCategoryId = $sCategoryId;
00733     }
00734 
00735 
00741     public function showRightBasket()
00742     {
00743         if ( $this->_blShowRightBasket === null ) {
00744             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00745                 $this->_blShowRightBasket = $blShowRightBasket;
00746             }
00747         }
00748         return $this->_blShowRightBasket;
00749     }
00750 
00758     public function setShowRightBasket( $blShowBasket )
00759     {
00760         $this->_blShowRightBasket = $blShowBasket;
00761     }
00762 
00768     public function showLeftBasket()
00769     {
00770         if ( $this->_blShowLeftBasket === null ) {
00771             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00772                 $this->_blShowLeftBasket = $blShowLeftBasket;
00773             }
00774         }
00775         return $this->_blShowLeftBasket;
00776     }
00777 
00785     public function setShowLeftBasket( $blShowBasket )
00786     {
00787         $this->_blShowLeftBasket = $blShowBasket;
00788     }
00789 
00795     public function showTopBasket()
00796     {
00797         if ( $this->_blShowTopBasket === null ) {
00798             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00799                 $this->_blShowTopBasket = $blShowTopBasket;
00800             }
00801         }
00802         return $this->_blShowTopBasket;
00803     }
00804 
00812     public function setShowTopBasket( $blShowBasket )
00813     {
00814         $this->_blShowTopBasket = $blShowBasket;
00815     }
00816 
00822     public function loadCurrency()
00823     {
00824         if ( $this->_blLoadCurrency == null ) {
00825             $this->_blLoadCurrency = false;
00826             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00827                 $this->_blLoadCurrency = $blLoadCurrency;
00828             }
00829         }
00830         return $this->_blLoadCurrency;
00831     }
00832 
00838     public function loadVendorTree()
00839     {
00840         if ( $this->_blLoadVendorTree == null ) {
00841             $this->_blLoadVendorTree = false;
00842             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00843                 $this->_blLoadVendorTree = $blLoadVendorTree;
00844             }
00845         }
00846         return $this->_blLoadVendorTree;
00847     }
00848 
00854     public function loadManufacturerTree()
00855     {
00856         if ( $this->_blLoadManufacturerTree == null ) {
00857             $this->_blLoadManufacturerTree = false;
00858             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00859                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00860             }
00861         }
00862         return $this->_blLoadManufacturerTree;
00863     }
00864 
00870     public function dontShowEmptyCategories()
00871     {
00872         if ( $this->_blDontShowEmptyCats == null ) {
00873             $this->_blDontShowEmptyCats = false;
00874             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00875                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00876             }
00877         }
00878         return $this->_blDontShowEmptyCats;
00879     }
00880 
00886     public function isLanguageLoaded()
00887     {
00888         if ( $this->_blLoadLanguage == null ) {
00889             $this->_blLoadLanguage = false;
00890             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00891                 $this->_blLoadLanguage = $blLoadLanguage;
00892             }
00893         }
00894         return $this->_blLoadLanguage;
00895     }
00896 
00902     public function showTopCatNavigation()
00903     {
00904         if ( $this->_blShowTopCatNav == null ) {
00905             $this->_blShowTopCatNav = false;
00906             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00907                 $this->_blShowTopCatNav = $blShowTopCatNav;
00908             }
00909         }
00910         return $this->_blShowTopCatNav;
00911     }
00912 
00918     public function getTopNavigationCatCnt()
00919     {
00920         if ( $this->_iTopCatNavItmCnt == null ) {
00921             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00922             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00923         }
00924         return $this->_iTopCatNavItmCnt;
00925     }
00926 
00936     public function addRssFeed($sTitle, $sUrl, $key = null)
00937     {
00938         if (!is_array($this->_aRssLinks)) {
00939             $this->_aRssLinks = array();
00940         }
00941         if ($key === null) {
00942             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00943         } else {
00944             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00945         }
00946 
00947         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00948     }
00949 
00964     public function prepareSortColumns()
00965     {
00966         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00967         if ( count( $aSortColumns ) > 0 ) {
00968 
00969             $this->_blActiveSorting = true;
00970             $this->_aSortColumns = $aSortColumns;
00971 
00972             $sCnid = oxConfig::getParameter( 'cnid' );
00973 
00974             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00975             $sSortDir = oxConfig::getParameter( 'listorder' );
00976 
00977             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00978                 $sSortBy  = $aSorting['sortby'];
00979                 $sSortDir = $aSorting['sortdir'];
00980             }
00981 
00982             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00983                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00984 
00985                 $this->_sListOrderBy  = $sSortBy;
00986                 $this->_sListOrderDir = $sSortDir;
00987 
00988                 // caching sorting config
00989                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00990             }
00991         }
00992     }
00993 
00999     public function getListOrderBy()
01000     {
01001         return $this->_sListOrderBy;
01002     }
01003 
01009     public function getListOrderDirection()
01010     {
01011         return $this->_sListOrderDir;
01012     }
01013 
01021     public function setMetaDescription ( $sDescription )
01022     {
01023         return $this->_sMetaDescription = $sDescription;
01024     }
01025 
01033     public function setMetaKeywords( $sKeywords )
01034     {
01035         return $this->_sMetaKeywords = $sKeywords;
01036     }
01037 
01043     public function getMetaKeywords()
01044     {
01045         if ( $this->_sMetaKeywords === null ) {
01046             $this->_sMetaKeywords = false;
01047             $blRemoveDuplicatedWords = true;
01048             // set special meta keywords ?
01049             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01050                  ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
01051                 return $this->_sMetaKeywords = $sKeywords;
01052             } elseif ( $this->_sMetaKeywordsIdent ) {
01053                 $oContent = oxNew( 'oxcontent' );
01054                 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
01055                     $this->_sMetaKeywords = strip_tags( $oContent->oxcontents__oxcontent->value );
01056                     $blRemoveDuplicatedWords = false;
01057                 }
01058             }
01059 
01060             $this->_sMetaKeywords = $this->_prepareMetaKeyword( $this->_sMetaKeywords, $blRemoveDuplicatedWords );
01061         }
01062         
01063         return $this->_sMetaKeywords;
01064     }
01065 
01071     public function getMetaDescription()
01072     {
01073         if ( $this->_sMetaDescription === null ) {
01074             $this->_sMetaDescription = false;
01075             // set special meta description ?
01076             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01077                  ( $sMeta = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxdescription' ) ) ) {
01078                      return $this->_sMetaDescription = $sMeta;
01079             } elseif ( $this->_sMetaDescriptionIdent ) {
01080                 $oContent = oxNew( 'oxcontent' );
01081                 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
01082                     $this->_sMetaDescription = strip_tags( $oContent->oxcontents__oxcontent->value );
01083                 }
01084             }
01085 
01086             $this->_sMetaDescription = $this->_prepareMetaDescription( $this->_sMetaDescription );
01087         }
01088 
01089         return $this->_sMetaDescription;
01090     }
01091 
01097     public function getActCurrency()
01098     {
01099         return $this->_oActCurrency;
01100     }
01101 
01109     public function setActCurrency( $oCur )
01110     {
01111         $this->_oActCurrency = $oCur;
01112     }
01113 
01119     public function getCompareItemsCnt()
01120     {
01121         return $this->_iCompItemsCnt;
01122     }
01123 
01131     public function setCompareItemsCnt( $iCount )
01132     {
01133         $this->_iCompItemsCnt = $iCount;
01134     }
01135 
01141     public function getWishlistName()
01142     {
01143         return $this->_sWishlistName;
01144     }
01145 
01153     public function setWishlistName( $sName )
01154     {
01155         $this->_sWishlistName = $sName;
01156     }
01157 
01163     protected function _forceNoIndex()
01164     {
01165         $this->_blForceNoIndex = true;
01166     }
01167 
01174     public function noIndex()
01175     {
01176         if ( $this->_blForceNoIndex ) {
01177             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01178         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01179             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01180         } else {
01181             switch ( oxConfig::getParameter( 'fnc' ) ) {
01182                 case 'tocomparelist':
01183                 case 'tobasket':
01184                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01185                     break;
01186             }
01187         }
01188         return $this->_iViewIndexState;
01189     }
01190 
01197     public function getContentId()
01198     {
01199         if ( $this->_sContentId === null) {
01200             $oContent = oxNew( 'oxcontent' );
01201             $oContent->loadByIdent( 'oximpressum' );
01202             $this->_sContentId = $oContent->getId();
01203         }
01204 
01205         return $this->_sContentId;
01206     }
01207 
01214     public function getContent()
01215     {
01216         if ( $this->_oContent === null) {
01217             $oContent = oxNew( 'oxcontent' );
01218             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01219                 $this->_oContent = $oContent;
01220             }
01221         }
01222 
01223         return $this->_oContent;
01224     }
01225 
01231     public function isSortingActive()
01232     {
01233         return $this->_blActiveSorting;
01234     }
01235 
01241     public function getMenueList()
01242     {
01243         return $this->_aMenueList;
01244     }
01245 
01253     public function setMenueList( $aMenue )
01254     {
01255         $this->_aMenueList = $aMenue;
01256     }
01257 
01258 
01264     protected function _setNrOfArtPerPage()
01265     {
01266         $myConfig  = $this->getConfig();
01267         $aViewData = array();
01268 
01269         //setting default values to avoid possible errors showing article list
01270         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01271         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01272 
01273         // checking if all needed data is set
01274         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01275         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01276             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01277         } else {
01278             $iNrofCatArticles = $aNrofCatArticles[0];
01279         }
01280 
01281         $oViewConf = $this->getViewConfig();
01282         //value from user input
01283         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01284             // performing floor() to skip such variants as 7.5 etc
01285             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
01286             // M45 Possibility to push any "Show articles per page" number parameter
01287             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01288             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01289             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01290         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01291             // M45 Possibility to push any "Show articles per page" number parameter
01292             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01293             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01294             $iNrofCatArticles = $iSessArtPerPage;
01295         } else {
01296             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01297         }
01298 
01299         //setting number of articles per page to config value
01300         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01301 
01302         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01303     }
01304 
01310     protected function _getSeoObjectId()
01311     {
01312     }
01313 
01323     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01324     {
01325         if ( $sMeta ) {
01326 
01327             $oStr = getStr();
01328             if ( $iLength != -1 ) {
01329                 /* *
01330                  * performance - we dont need a huge amount of initial text.
01331                  * assume that effective text may be double longer than $iLength
01332                  * and simple turncate it
01333                  */
01334                 $iELength = ( $iLength * 2 );
01335                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01336             }
01337 
01338             // decoding html entities
01339             $sMeta = $oStr->html_entity_decode( $sMeta );
01340             // stripping HTML tags
01341             $sMeta = strip_tags( $sMeta );
01342 
01343             // removing some special chars
01344             $sMeta = $oStr->cleanStr( $sMeta );
01345 
01346             // removing duplicate words
01347             if ( $blRemoveDuplicatedWords ) {
01348                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01349             }
01350 
01351             // some special cases
01352             $sMeta = str_replace( ' ,', ',', $sMeta );
01353             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01354             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01355             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01356 
01357             return trim( $sMeta );
01358         }
01359     }
01360 
01369     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01370     {
01371 
01372         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01373 
01374         if ( $blRemoveDuplicatedWords ) {
01375             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01376         }
01377 
01378         // removing in admin defined strings
01379 
01380         /*if ( is_array( $aSkipTags ) && $sString ) {
01381             $oStr = getStr();
01382             foreach ( $aSkipTags as $sSkip ) {
01383                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01384                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01385                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01386                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01387             }
01388         }*/
01389 
01390         return trim( $sString );
01391     }
01392 
01401     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01402     {
01403         $oStr = getStr();
01404         if ( is_array( $aInput ) ) {
01405             $aStrings = $aInput;
01406         } else {
01407             //is String
01408             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01409         }
01410 
01411         if ( $sCount = count( $aSkipTags ) ) {
01412             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01413                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01414             }
01415         }
01416         $sCount = count($aStrings);
01417         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01418             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01419             // removing in admin defined strings
01420             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01421                 unset( $aStrings[$iNum] );
01422             }
01423         }
01424 
01425         // duplicates
01426         $aStrings = array_unique($aStrings);
01427 
01428         return implode( ', ', $aStrings );
01429     }
01430 
01438     public function getNavigationParams()
01439     {
01440         $aParams['cnid'] = $this->getCategoryId();
01441         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01442 
01443         $aParams['listtype'] = $this->getListType();
01444         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01445 
01446         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01447         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01448         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01449 
01450         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01451         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01452         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01453 
01454         return $aParams;
01455     }
01456 
01466     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01467     {
01468         $aSorting = oxSession::getVar( 'aSorting' );
01469         $aSorting[$sCnid]['sortby']  = $sSortBy;
01470         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01471 
01472         oxSession::setVar( 'aSorting', $aSorting );
01473     }
01474 
01482     public function getSorting( $sCnid )
01483     {
01484         $aSorting = oxSession::getVar( 'aSorting' );
01485         if ( isset( $aSorting[$sCnid] ) ) {
01486             return $aSorting[$sCnid];
01487         }
01488     }
01489 
01497     public function getSortingSql( $sCnid )
01498     {
01499         $aSorting = $this->getSorting( $sCnid );
01500         if ( is_array( $aSorting ) ) {
01501             return implode( " ", $aSorting );
01502         }
01503     }
01504 
01510     public function getTitleSuffix()
01511     {
01512         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01513     }
01514 
01521     public function getTitlePrefix()
01522     {
01523         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01524     }
01525 
01534     protected function _getSubject( $iLang )
01535     {
01536         return null;
01537     }
01538 
01544     public function getDynUrlParams()
01545     {
01546         $sRet = '';
01547         $sListType = $this->getListType();
01548 
01549         switch ($sListType) {
01550             default:
01551                 break;
01552             case 'search':
01553                 $sRet .= "&amp;listtype={$sListType}";
01554                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01555                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01556                 }
01557 
01558                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01559                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01560                 }
01561                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01562                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01563                 }
01564                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01565                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01566                 }
01567                 break;
01568             case 'tag':
01569                 $sRet .= "&amp;listtype={$sListType}";
01570                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01571                     $sRet .= "&amp;searchtag={$sParam}";
01572                 }
01573                 break;
01574         }
01575 
01576         return $sRet;
01577     }
01578 
01586     public function getLink( $iLang = null )
01587     {
01588         if ( !isset( $iLang ) ) {
01589             $iLang = oxLang::getInstance()->getBaseLanguage();
01590         }
01591 
01592         $oDisplayObj = null;
01593         if ( oxUtils::getInstance()->seoIsActive() ) {
01594             $blTrySeo = true;
01595             $oDisplayObj = $this->_getSubject( $iLang );
01596         }
01597         $iActPageNr = $this->getActPage();
01598 
01599         if ( $oDisplayObj ) {
01600 
01601             // if languages do not match object must be reload, but reference to view object should be broken
01602             if ( $oDisplayObj->getLanguage() != $iLang ) {
01603                 $sOxId = $oDisplayObj->getId();
01604                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01605                 $oDisplayObj->loadInLang( $iLang, $sOxId );
01606             }
01607 
01608             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01609         } else {
01610             $myConfig = $this->getConfig();
01611 
01612             if ( $blTrySeo ) {
01613                 $oEncoder = oxSeoEncoder::getInstance();
01614                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01615                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01616                 }
01617             }
01618 
01619             $sForceLangChange = '';
01620             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01621                 $sForceLangChange = "&amp;lang={$iLang}";
01622             }
01623 
01624             // fallback to old non seo url
01625             return $this->_addPageNrParam( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange, $iActPageNr, $iLang );
01626         }
01627     }
01628 
01635     public function getSimilarRecommLists()
01636     {
01637     }
01638 
01646     protected function _getRequestParams( $blAddPageNr  = true )
01647     {
01648         $sClass = $this->getClassName();
01649         $sFnc   = $this->getFncName();
01650 
01651         // #921 S
01652         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01653         if ( in_array( $sFnc, $aFnc ) ) {
01654             $sFnc = '';
01655         }
01656 
01657         // #680
01658         $sURL = "cl={$sClass}";
01659         if ( $sFnc ) {
01660             $sURL .= "&amp;fnc={$sFnc}";
01661         }
01662         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01663             $sURL .= "&amp;cnid={$sVal}";
01664         }
01665         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01666             $sURL .= "&amp;mnid={$sVal}";
01667         }
01668         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01669             $sURL .= "&amp;anid={$sVal}";
01670         }
01671 
01672         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01673             $sURL .= "&amp;page={$sVal}";
01674         }
01675 
01676         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01677             $sURL .= "&amp;tpl={$sVal}";
01678         }
01679 
01680         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01681         // don't include page number for navigation
01682         // it will be done in oxubase::generatePageNavigation
01683         if ( $blAddPageNr && $iPgNr > 0 ) {
01684             $sURL .= "&amp;pgNr={$iPgNr}";
01685         }
01686 
01687         // #1184M - specialchar search
01688         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01689             $sURL .= "&amp;searchparam={$sVal}";
01690         }
01691 
01692         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01693             $sURL .= "&amp;searchcnid={$sVal}";
01694         }
01695 
01696         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01697             $sURL .= "&amp;searchvendor={$sVal}";
01698         }
01699 
01700         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01701             $sURL .= "&amp;searchmanufacturer={$sVal}";
01702         }
01703 
01704         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01705             $sURL .= "&amp;searchrecomm={$sVal}";
01706         }
01707 
01708         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01709             $sURL .= "&amp;searchtag={$sVal}";
01710         }
01711 
01712         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01713             $sURL .= "&amp;recommid={$sVal}";
01714         }
01715 
01716         return $sURL;
01717     }
01718 
01724     protected function _getSeoRequestParams()
01725     {
01726         $sClass = $this->getClassName();
01727         $sFnc   = $this->getFncName();
01728 
01729         // #921 S
01730         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01731         if ( in_array( $sFnc, $aFnc ) ) {
01732             $sFnc = '';
01733         }
01734 
01735         // #680
01736         $sURL = "cl={$sClass}";
01737         if ( $sFnc ) {
01738             $sURL .= "&amp;fnc={$sFnc}";
01739         }
01740         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01741             $sURL .= "&amp;page={$sVal}";
01742         }
01743 
01744         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01745             $sURL .= "&amp;tpl={$sVal}";
01746         }
01747 
01748         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01749         if ( $iPgNr > 0 ) {
01750             $sURL .= "&amp;pgNr={$iPgNr}";
01751         }
01752 
01753         return $sURL;
01754     }
01755 
01761     public function showSearch()
01762     {
01763         $blShow = true;
01764         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01765             $blShow = false;
01766         }
01767         return (int) $blShow;
01768     }
01769 
01775     public function getRssLinks()
01776     {
01777         return $this->_aRssLinks;
01778     }
01779 
01785     public function getSortColumns()
01786     {
01787         return $this->_aSortColumns;
01788     }
01789 
01795     public function getEditTags()
01796     {
01797     }
01798 
01804     public function getRecommSearch()
01805     {
01806     }
01807 
01813     public function getReviewUserId()
01814     {
01815     }
01816 
01822     public function getPaymentList()
01823     {
01824     }
01825 
01831     public function getActiveRecommList()
01832     {
01833     }
01834 
01840     public function getAccessoires()
01841     {
01842     }
01843 
01849     public function getCrossSelling()
01850     {
01851     }
01852 
01858     public function getSimilarProducts()
01859     {
01860     }
01861 
01867     public function getAlsoBoughtThiesProducts()
01868     {
01869     }
01870 
01876     public function getArticleId()
01877     {
01878     }
01879 
01885     public function isMoreTagsVisible()
01886     {
01887         return false;
01888     }
01889 
01895     public function getTitle()
01896     {
01897     }
01898 
01904     public function getActiveLangAbbr()
01905     {
01906         // Performance
01907         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01908             return;
01909         }
01910 
01911         if ( !isset($this->_sActiveLangAbbr ) ) {
01912             $aLanguages = oxLang::getInstance()->getLanguageArray();
01913             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01914                 if ( $oVal->selected ) {
01915                     $this->_sActiveLangAbbr = $oVal->abbr;
01916                     break;
01917                 }
01918             }
01919         }
01920 
01921         return $this->_sActiveLangAbbr;
01922     }
01923 
01937     public function addGlobalParams( $oShop = null)
01938     {
01939         $myConfig = $this->getConfig();
01940 
01941         $oViewConf = parent::addGlobalParams( $oShop );
01942 
01943         $this->_aViewData['isfiltering'] = true;
01944         $this->_aViewData['isnewsletter'] = true;
01945         $this->_aViewData['isvarianten'] = true;
01946         $this->_aViewData['isreview'] = true;
01947         $this->_aViewData['isaddsales'] = true;
01948         $this->_aViewData['isvoucher'] = true;
01949         $this->_aViewData['ispricealarm'] = true;
01950         $this->_aViewData['iswishlist'] = true;
01951         $this->_aViewData['isipayment'] = true;
01952         $this->_aViewData['istrusted'] = true;
01953         $this->_aViewData['isfiltering'] = true;
01954         $this->_aViewData['isgooglestats'] = true;
01955         $this->_aViewData['iswishlist'] = true;
01956 
01957 
01958         // show baskets
01959         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01960         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01961         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01962 
01963         // allow currency swiching
01964         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01965 
01966         // show/hide vendors
01967         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01968 
01969         // show/hide Manufacturers
01970         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01971 
01972         // show/hide empty categories
01973         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01974 
01975         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01976 
01977         // used for compatibility with older templates
01978         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01979         $this->_aViewData['urlsign']    = '&';
01980         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01981         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01982 
01983         $this->_aViewData['sListType'] = $this->getListType();
01984         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01985 
01986         // new navigation ?
01987         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01988         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01989 
01990         $this->_setNrOfArtPerPage();
01991 
01992 
01993         return $oViewConf;
01994     }
01995 
02001     public function getAdditionalParams()
02002     {
02003         if ( $this->_sAdditionalParams === null ) {
02004             // #1018A
02005             $this->_sAdditionalParams  = parent::getAdditionalParams();
02006             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02007 
02008             // #1834M - specialchar search
02009             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02010             if ( isset( $sSearchParamForLink ) ) {
02011                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02012             }
02013             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02014                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02015             }
02016             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02017                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02018             }
02019             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02020                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02021             }
02022             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02023                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02024             }
02025             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02026                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02027             }
02028             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02029                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02030             }
02031         }
02032 
02033         return $this->_sAdditionalParams;
02034     }
02035 
02041     public function generatePageNavigationUrl()
02042     {
02043         // $sClass = $this->_sThisAction;
02044         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02045     }
02046 
02056     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02057     {
02058         if ( $iPage ) {
02059             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02060         }
02061         return $sUrl;
02062     }
02063 
02069     public function generatePageNavigation()
02070     {
02071         startProfile('generatePageNavigation');
02072         // generate the page navigation
02073         $pageNavigation = new stdClass();
02074         $pageNavigation->NrOfPages = $this->_iCntPages;
02075         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02076         $iActPage = $this->getActPage();
02077         $pageNavigation->actPage   = $iActPage + 1;
02078 
02079         $sUrl = $this->generatePageNavigationUrl();
02080 
02081         if ( $iActPage > 0) {
02082             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02083         }
02084 
02085         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02086             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02087         }
02088 
02089         if ( $pageNavigation->NrOfPages > 1 ) {
02090             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02091                 $page = new Oxstdclass();
02092                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02093                 $page->selected = 0;
02094                 if ( $i == $pageNavigation->actPage ) {
02095                     $page->selected = 1;
02096                 }
02097                 $pageNavigation->changePage[$i] = $page;
02098             }
02099 
02100             // first/last one
02101             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02102             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02103         }
02104 
02105         stopProfile('generatePageNavigation');
02106 
02107         return $pageNavigation;
02108     }
02109 
02115     public function prepareMinimumOrderPrice4View()
02116     {
02117         $myConfig = $this->getConfig();
02118         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02119         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02120             $oBasket = $this->getSession()->getBasket();
02121             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02122                 return;
02123             }
02124             $oCur    = $myConfig->getActShopCurrencyObject();
02125             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02126             // Coupons and discounts should be considered in "Min order price" check
02127             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02128                 $this->_iLowOrderPrice = 1;
02129                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02130             }
02131         }
02132     }
02133 
02140     public function render()
02141     {
02142         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02143             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02144         }
02145 
02146         parent::render();
02147 
02148         if ( $this->getIsOrderStep() ) {
02149 
02150             // min. order price check
02151             $this->prepareMinimumOrderPrice4View();
02152 
02153             // disabling navigation during order ...
02154             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02155                 $this->_iNewsRealStatus = 1;
02156                 $this->setShowNewsletter( 0 );
02157                 // for old tpl. will be removed later
02158                 $this->_aViewData['isnewsletter'] = 0;
02159                 $this->setShowRightBasket( 0 );
02160                 $this->setShowLeftBasket( 0 );
02161                 $this->setShowTopBasket( 0 );
02162             }
02163             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02164             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02165         }
02166 
02167         // meta data
02168         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02169         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02170 
02171         // show baskets
02172         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02173         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02174         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02175 
02176         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02177 
02178         $this->_aViewData['noindex'] = $this->noIndex();
02179 
02180         return $this->_sThisTemplate;
02181     }
02182 
02188     public function getViewProduct()
02189     {
02190         return $this->getProduct();
02191     }
02192 
02200     public function setViewProduct( $oProduct )
02201     {
02202         $this->_oProduct = $oProduct;
02203     }
02204 
02210     public function getViewProductList()
02211     {
02212         return $this->_aArticleList;
02213     }
02214 
02220     public function getActPage()
02221     {
02222         if ( $this->_iActPage === null ) {
02223             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02224             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02225         }
02226         return $this->_iActPage;
02227     }
02228 
02236     public function getActCategory()
02237     {
02238         // if active category is not set yet - trying to load it from request params
02239         // this may be usefull when category component was unable to load active category
02240         // and we still need some object to mount navigation info
02241         if ( $this->_oClickCat === null ) {
02242 
02243             $this->_oClickCat = false;
02244             $oCategory = oxNew( 'oxcategory' );
02245             if ( $oCategory->load( $this->getCategoryId() ) ) {
02246                 $this->_oClickCat = $oCategory;
02247             }
02248         }
02249 
02250         return $this->_oClickCat;
02251     }
02252 
02260     public function setActCategory( $oCategory )
02261     {
02262         $this->_oClickCat = $oCategory;
02263     }
02264 
02272     public function getActTag()
02273     {
02274         if ( $this->_oActTag === null ) {
02275             $this->_oActTag = new Oxstdclass();
02276             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02277             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02278 
02279             if ( oxUtils::getInstance()->seoIsActive() ) {
02280                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02281             } else {
02282                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02283             }
02284 
02285         }
02286         return $this->_oActTag;
02287     }
02288 
02296     public function getActVendor()
02297     {
02298         // if active vendor is not set yet - trying to load it from request params
02299         // this may be usefull when category component was unable to load active vendor
02300         // and we still need some object to mount navigation info
02301         if ( $this->_oActVendor === null ) {
02302             $this->_oActVendor = false;
02303             $sVendorId = oxConfig::getParameter( 'cnid' );
02304             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02305             $oVendor = oxNew( 'oxvendor' );
02306             if ( $oVendor->load( $sVendorId ) ) {
02307                 $this->_oActVendor = $oVendor;
02308             }
02309         }
02310 
02311         return $this->_oActVendor;
02312     }
02313 
02321     public function getActManufacturer()
02322     {
02323         // if active Manufacturer is not set yet - trying to load it from request params
02324         // this may be usefull when category component was unable to load active Manufacturer
02325         // and we still need some object to mount navigation info
02326         if ( $this->_oActManufacturer === null ) {
02327 
02328             $this->_oActManufacturer = false;
02329             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02330             $oManufacturer = oxNew( 'oxmanufacturer' );
02331             if ( $oManufacturer->load( $sManufacturerId ) ) {
02332                 $this->_oActManufacturer = $oManufacturer;
02333             }
02334         }
02335 
02336         return $this->_oActManufacturer;
02337     }
02338 
02346     public function setActVendor( $oVendor )
02347     {
02348         $this->_oActVendor = $oVendor;
02349     }
02350 
02358     public function setActManufacturer( $oManufacturer )
02359     {
02360         $this->_oActManufacturer = $oManufacturer;
02361     }
02362 
02368     public function getActSearch()
02369     {
02370         if ( $this->_oActSearch === null ) {
02371             $this->_oActSearch = new oxStdClass();
02372             $sUrl = $this->getConfig()->getShopHomeURL();
02373             $this->_oActSearch->link = "{$sUrl}cl=search";
02374         }
02375         return $this->_oActSearch;
02376     }
02377 
02383     public function getActRecommList()
02384     {
02385         if ( $this->_oActRecomm === null ) {
02386             $this->_oActRecomm = false;
02387             $sRecommId = oxConfig::getParameter( 'recommid' );
02388 
02389             $oRecommList = oxNew( 'oxrecommlist' );
02390 
02391             if ( $oRecommList->load( $sRecommId ) ) {
02392                 $this->_oActRecomm = $oRecommList;
02393             }
02394         }
02395         return $this->_oActRecomm;
02396     }
02397 
02403     public function getCategoryTree()
02404     {
02405         return $this->_oCategoryTree;
02406     }
02407 
02415     public function setCategoryTree( $oCatTree )
02416     {
02417         $this->_oCategoryTree = $oCatTree;
02418     }
02419 
02425     public function getVendorTree()
02426     {
02427         return $this->_oVendorTree;
02428     }
02429 
02437     public function setVendorTree( $oVendorTree )
02438     {
02439         $this->_oVendorTree = $oVendorTree;
02440     }
02441 
02447     public function getManufacturerTree()
02448     {
02449         return $this->_oManufacturerTree;
02450     }
02451 
02459     public function setManufacturerTree( $oManufacturerTree )
02460     {
02461         $this->_oManufacturerTree = $oManufacturerTree;
02462     }
02472     protected function _loadActions()
02473     {
02474         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02475         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02476     }
02477 
02486     public function setSessionCategoryId( $sCategoryId )
02487     {
02488         oxSession::setVar( 'cnid', $sCategoryId );
02489     }
02490 
02496     public function getSessionCategoryId()
02497     {
02498         return oxSession::getVar( 'cnid' );
02499     }
02500 
02506     protected function _processListArticles()
02507     {
02508         $sAddParams = $this->getAddUrlParams();
02509         if ( $sAddParams && ( $oArticleList = $this->getArticleList() ) ) {
02510             foreach ( $oArticleList as $oArticle ) {
02511                 $oArticle->appendLink( $sAddParams );
02512             }
02513         }
02514     }
02515 
02521     public function getAddUrlParams()
02522     {
02523     }
02524 
02531     public function getTop5ArticleList()
02532     {
02533         if ( $this->_blTop5Action ) {
02534             if ( $this->_aTop5ArticleList === null ) {
02535                 $this->_aTop5ArticleList = false;
02536                 $myConfig = $this->getConfig();
02537                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02538                     // top 5 articles
02539                     $oArtList = oxNew( 'oxarticlelist' );
02540                     $oArtList->loadTop5Articles();
02541                     if ( $oArtList->count() ) {
02542                         $this->_aTop5ArticleList = $oArtList;
02543                     }
02544                 }
02545             }
02546         }
02547         return $this->_aTop5ArticleList;
02548     }
02549 
02556     public function getBargainArticleList()
02557     {
02558         if ( $this->_blBargainAction ) {
02559             if ( $this->_aBargainArticleList === null ) {
02560                 $this->_aBargainArticleList = array();
02561                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02562                     $oArtList = oxNew( 'oxarticlelist' );
02563                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02564                     if ( $oArtList->count() ) {
02565                         $this->_aBargainArticleList = $oArtList;
02566                     }
02567                 }
02568             }
02569         }
02570         return $this->_aBargainArticleList;
02571     }
02572 
02578     public function isLowOrderPrice()
02579     {
02580         return $this->_iLowOrderPrice;
02581     }
02582 
02588     public function getMinOrderPrice()
02589     {
02590         return $this->_sMinOrderPrice;
02591     }
02592 
02598     public function getNewsRealStatus()
02599     {
02600         return $this->_iNewsRealStatus;
02601     }
02602 
02608     protected function _canRedirect()
02609     {
02610         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02611             if ( oxConfig::getParameter( $sParam ) !== null ) {
02612                 return false;
02613             }
02614         }
02615 
02616         return true;
02617     }
02618 
02624     public function getProduct()
02625     {
02626     }
02627 
02633     public function getVendorlist()
02634     {
02635         return $this->_aVendorlist;
02636     }
02637 
02645     public function setVendorlist( $aList )
02646     {
02647         $this->_aVendorlist = $aList;
02648     }
02649 
02655     public function getManufacturerlist()
02656     {
02657         return $this->_aManufacturerlist;
02658     }
02659 
02667     public function setManufacturerlist( $aList )
02668     {
02669         $this->_aManufacturerlist = $aList;
02670     }
02671 
02679     public function setRootVendor( $oVendor )
02680     {
02681         $this->_oRootVendor = $oVendor;
02682     }
02683 
02689     public function getRootVendor()
02690     {
02691         return $this->_oRootVendor;
02692     }
02693 
02701     public function setRootManufacturer( $oManufacturer )
02702     {
02703         $this->_oRootManufacturer = $oManufacturer;
02704     }
02705 
02711     public function getRootManufacturer()
02712     {
02713         return $this->_oRootManufacturer;
02714     }
02715 
02721     public function getVendorId()
02722     {
02723         if ( $this->_sVendorId === null ) {
02724             $this->_sVendorId = false;
02725             if ( ( $oVendor = $this->getActVendor() ) ) {
02726                 $this->_sVendorId = $oVendor->getId();
02727             }
02728         }
02729         return $this->_sVendorId;
02730     }
02731 
02737     public function getManufacturerId()
02738     {
02739         if ( $this->_sManufacturerId === null ) {
02740             $this->_sManufacturerId = false;
02741             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02742                 $this->_sManufacturerId = $oManufacturer->getId();
02743             }
02744         }
02745         return $this->_sManufacturerId;
02746     }
02747 
02753     public function getSearchCatTree()
02754     {
02755         return $this->_aSearchCatTree;
02756     }
02757 
02765     public function setSearchCatTree( $aTree )
02766     {
02767         $this->_aSearchCatTree = $aTree;
02768     }
02769 
02775     public function getCatMore()
02776     {
02777         return $this->_oCatMore;
02778     }
02779 
02787     public function setCatMore( $oCat )
02788     {
02789         $this->_oCatMore = $oCat;
02790     }
02791 
02797     public function isNewsSubscribed()
02798     {
02799         return $this->_blNewsSubscribed;
02800     }
02801 
02809     public function setNewsSubscribed( $blNewsSubscribed )
02810     {
02811         $this->_blNewsSubscribed = $blNewsSubscribed;
02812     }
02813 
02819     public function showShipAddress()
02820     {
02821         return $this->_blShowShipAddress;
02822     }
02823 
02831     public function setShowShipAddress( $blShowShipAddress )
02832     {
02833         $this->_blShowShipAddress = $blShowShipAddress;
02834     }
02835 
02841     public function getDelAddress()
02842     {
02843         return $this->_oDelAddress;
02844     }
02845 
02853     public function setDelAddress( $oDelAddress )
02854     {
02855         $this->_oDelAddress = $oDelAddress;
02856     }
02857 
02863     public function getCatTreePath()
02864     {
02865         return $this->_sCatTreePath;
02866     }
02867 
02875     public function getContentByIdent( $sIdent )
02876     {
02877         if ( !isset( $this->_aContents[$sIdent] ) ) {
02878             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02879             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02880         }
02881         return $this->_aContents[$sIdent];
02882     }
02883 
02889     public function getContentCategory()
02890     {
02891         return false;
02892     }
02893 }

Generated on Tue Aug 4 09:10:00 2009 for OXID eShop CE by  doxygen 1.5.5