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             // set special meta keywords ?
01048             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01049                  ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
01050                 return $this->_sMetaKeywords = $sKeywords;
01051             } elseif ( $this->_sMetaKeywordsIdent ) {
01052                 $oContent = oxNew( 'oxcontent' );
01053                 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
01054                     $this->_sMetaKeywords = strip_tags( $oContent->oxcontents__oxcontent->value );
01055                 }
01056             }
01057 
01058             $this->_sMetaKeywords = $this->_prepareMetaKeyword( $this->_sMetaKeywords );
01059         }
01060         return $this->_sMetaKeywords;
01061     }
01062 
01068     public function getMetaDescription()
01069     {
01070         if ( $this->_sMetaDescription === null ) {
01071             $this->_sMetaDescription = false;
01072             // set special meta description ?
01073             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01074                  ( $sMeta = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxdescription' ) ) ) {
01075                      return $this->_sMetaDescription = $sMeta;
01076             } elseif ( $this->_sMetaDescriptionIdent ) {
01077                 $oContent = oxNew( 'oxcontent' );
01078                 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
01079                     $this->_sMetaDescription = strip_tags( $oContent->oxcontents__oxcontent->value );
01080                 }
01081             }
01082 
01083             $this->_sMetaDescription = $this->_prepareMetaDescription( $this->_sMetaDescription );
01084         }
01085 
01086         return $this->_sMetaDescription;
01087     }
01088 
01094     public function getActCurrency()
01095     {
01096         return $this->_oActCurrency;
01097     }
01098 
01106     public function setActCurrency( $oCur )
01107     {
01108         $this->_oActCurrency = $oCur;
01109     }
01110 
01116     public function getCompareItemsCnt()
01117     {
01118         return $this->_iCompItemsCnt;
01119     }
01120 
01128     public function setCompareItemsCnt( $iCount )
01129     {
01130         $this->_iCompItemsCnt = $iCount;
01131     }
01132 
01138     public function getWishlistName()
01139     {
01140         return $this->_sWishlistName;
01141     }
01142 
01150     public function setWishlistName( $sName )
01151     {
01152         $this->_sWishlistName = $sName;
01153     }
01154 
01160     protected function _forceNoIndex()
01161     {
01162         $this->_blForceNoIndex = true;
01163     }
01164 
01171     public function noIndex()
01172     {
01173         if ( $this->_blForceNoIndex ) {
01174             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01175         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01176             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01177         } else {
01178             switch ( oxConfig::getParameter( 'fnc' ) ) {
01179                 case 'tocomparelist':
01180                 case 'tobasket':
01181                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01182                     break;
01183             }
01184         }
01185         return $this->_iViewIndexState;
01186     }
01187 
01194     public function getContentId()
01195     {
01196         if ( $this->_sContentId === null) {
01197             $oContent = oxNew( 'oxcontent' );
01198             $oContent->loadByIdent( 'oximpressum' );
01199             $this->_sContentId = $oContent->getId();
01200         }
01201 
01202         return $this->_sContentId;
01203     }
01204 
01211     public function getContent()
01212     {
01213         if ( $this->_oContent === null) {
01214             $oContent = oxNew( 'oxcontent' );
01215             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01216                 $this->_oContent = $oContent;
01217             }
01218         }
01219 
01220         return $this->_oContent;
01221     }
01222 
01228     public function isSortingActive()
01229     {
01230         return $this->_blActiveSorting;
01231     }
01232 
01238     public function getMenueList()
01239     {
01240         return $this->_aMenueList;
01241     }
01242 
01250     public function setMenueList( $aMenue )
01251     {
01252         $this->_aMenueList = $aMenue;
01253     }
01254 
01255 
01261     protected function _setNrOfArtPerPage()
01262     {
01263         $myConfig  = $this->getConfig();
01264         $aViewData = array();
01265 
01266         //setting default values to avoid possible errors showing article list
01267         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01268         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01269 
01270         // checking if all needed data is set
01271         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01272         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01273             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01274         } else {
01275             $iNrofCatArticles = $aNrofCatArticles[0];
01276         }
01277 
01278         $oViewConf = $this->getViewConfig();
01279         //value from user input
01280         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01281             // performing floor() to skip such variants as 7.5 etc
01282             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
01283             // M45 Possibility to push any "Show articles per page" number parameter
01284             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01285             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01286             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01287         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01288             // M45 Possibility to push any "Show articles per page" number parameter
01289             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01290             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01291             $iNrofCatArticles = $iSessArtPerPage;
01292         } else {
01293             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01294         }
01295 
01296         //setting number of articles per page to config value
01297         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01298 
01299         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01300     }
01301 
01307     protected function _getSeoObjectId()
01308     {
01309     }
01310 
01320     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01321     {
01322         if ( $sMeta ) {
01323 
01324             $oStr = getStr();
01325             if ( $iLength != -1 ) {
01326                 /* *
01327                  * performance - we dont need a huge amount of initial text.
01328                  * assume that effective text may be double longer than $iLength
01329                  * and simple turncate it
01330                  */
01331                 $iELength = ( $iLength * 2 );
01332                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01333             }
01334 
01335             // decoding html entities
01336             $sMeta = $oStr->html_entity_decode( $sMeta );
01337             // stripping HTML tags
01338             $sMeta = strip_tags( $sMeta );
01339 
01340             // removing some special chars
01341             $sMeta = $oStr->cleanStr( $sMeta );
01342 
01343             // removing duplicate words
01344             if ( $blRemoveDuplicatedWords ) {
01345                 $sMeta = $this->_removeDuplicatedWords( $sMeta );
01346             }
01347 
01348             // some special cases
01349             $sMeta = str_replace( ' ,', ',', $sMeta );
01350             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01351             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01352             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01353 
01354             return trim( $sMeta );
01355         }
01356     }
01357 
01365     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01366     {
01367 
01368         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01369 
01370         $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
01371 
01372         if ( $blRemoveDuplicatedWords ) {
01373             $sString = $this->_removeDuplicatedWords( $sString, $aSkipTags );
01374         }
01375 
01376         // removing in admin defined strings
01377 
01378         /*if ( is_array( $aSkipTags ) && $sString ) {
01379             $oStr = getStr();
01380             foreach ( $aSkipTags as $sSkip ) {
01381                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01382                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01383                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01384                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01385             }
01386         }*/
01387 
01388         return trim( $sString );
01389     }
01390 
01399     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01400     {
01401         $oStr = getStr();
01402         if ( is_array( $aInput ) ) {
01403             $aStrings = $aInput;
01404         } else {
01405             //is String
01406             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01407         }
01408 
01409         if ( $sCount = count( $aSkipTags ) ) {
01410             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01411                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01412             }
01413         }
01414         $sCount = count($aStrings);
01415         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01416             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01417             // removing in admin defined strings
01418             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01419               unset( $aStrings[$iNum] );
01420             }
01421         }
01422 
01423         // duplicates
01424         $aStrings = array_unique($aStrings);
01425 
01426         return implode( ', ', $aStrings );
01427     }
01428 
01436     public function getNavigationParams()
01437     {
01438         $aParams['cnid'] = $this->getCategoryId();
01439         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01440 
01441         $aParams['listtype'] = $this->getListType();
01442         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01443 
01444         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01445         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01446         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01447 
01448         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01449         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01450         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01451 
01452         return $aParams;
01453     }
01454 
01464     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01465     {
01466         $aSorting = oxSession::getVar( 'aSorting' );
01467         $aSorting[$sCnid]['sortby']  = $sSortBy;
01468         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01469 
01470         oxSession::setVar( 'aSorting', $aSorting );
01471     }
01472 
01480     public function getSorting( $sCnid )
01481     {
01482         $aSorting = oxSession::getVar( 'aSorting' );
01483         if ( isset( $aSorting[$sCnid] ) ) {
01484             return $aSorting[$sCnid];
01485         }
01486     }
01487 
01495     public function getSortingSql( $sCnid )
01496     {
01497         $aSorting = $this->getSorting( $sCnid );
01498         if ( is_array( $aSorting ) ) {
01499             return implode( " ", $aSorting );
01500         }
01501     }
01502 
01508     public function getTitleSuffix()
01509     {
01510         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01511     }
01512 
01519     public function getTitlePrefix()
01520     {
01521         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01522     }
01523 
01532     protected function _getSubject( $iLang )
01533     {
01534         return null;
01535     }
01536 
01542     public function getDynUrlParams()
01543     {
01544         $sRet = '';
01545         $sListType = $this->getListType();
01546 
01547         switch ($sListType) {
01548             default:
01549                 break;
01550             case 'search':
01551                 $sRet .= "&amp;listtype={$sListType}";
01552                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01553                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01554                 }
01555 
01556                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01557                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01558                 }
01559                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01560                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01561                 }
01562                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01563                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01564                 }
01565                 break;
01566             case 'tag':
01567                 $sRet .= "&amp;listtype={$sListType}";
01568                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01569                     $sRet .= "&amp;searchtag={$sParam}";
01570                 }
01571                 break;
01572         }
01573 
01574         return $sRet;
01575     }
01576 
01584     public function getLink( $iLang = null )
01585     {
01586         if ( !isset( $iLang ) ) {
01587             $iLang = oxLang::getInstance()->getBaseLanguage();
01588         }
01589 
01590         $oDisplayObj = null;
01591         if ( oxUtils::getInstance()->seoIsActive() ) {
01592             $blTrySeo = true;
01593             $oDisplayObj = $this->_getSubject( $iLang );
01594         }
01595         $iActPageNr = $this->getActPage();
01596 
01597         if ( $oDisplayObj ) {
01598 
01599             // if languages do not match object must be reload, but reference to view object should be broken
01600             if ( $oDisplayObj->getLanguage() != $iLang ) {
01601                 $sOxId = $oDisplayObj->getId();
01602                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01603                 $oDisplayObj->loadInLang( $iLang, $sOxId );
01604             }
01605 
01606             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01607         } else {
01608             $myConfig = $this->getConfig();
01609 
01610             if ( $blTrySeo ) {
01611                 $oEncoder = oxSeoEncoder::getInstance();
01612                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01613                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01614                 }
01615             }
01616 
01617             $sForceLangChange = '';
01618             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01619                 $sForceLangChange = "&amp;lang={$iLang}";
01620             }
01621 
01622             // fallback to old non seo url
01623             return $this->_addPageNrParam( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange, $iActPageNr, $iLang );
01624         }
01625     }
01626 
01633     public function getSimilarRecommLists()
01634     {
01635     }
01636 
01644     protected function _getRequestParams( $blAddPageNr  = true )
01645     {
01646         $sClass = $this->getClassName();
01647         $sFnc   = $this->getFncName();
01648 
01649         // #921 S
01650         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01651         if ( in_array( $sFnc, $aFnc ) ) {
01652             $sFnc = '';
01653         }
01654 
01655         // #680
01656         $sURL = "cl={$sClass}";
01657         if ( $sFnc ) {
01658             $sURL .= "&amp;fnc={$sFnc}";
01659         }
01660         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01661             $sURL .= "&amp;cnid={$sVal}";
01662         }
01663         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01664             $sURL .= "&amp;mnid={$sVal}";
01665         }
01666         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01667             $sURL .= "&amp;anid={$sVal}";
01668         }
01669 
01670         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01671             $sURL .= "&amp;page={$sVal}";
01672         }
01673 
01674         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01675             $sURL .= "&amp;tpl={$sVal}";
01676         }
01677 
01678         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01679         // don't include page number for navigation
01680         // it will be done in oxubase::generatePageNavigation
01681         if ( $blAddPageNr && $iPgNr > 0 ) {
01682             $sURL .= "&amp;pgNr={$iPgNr}";
01683         }
01684 
01685         // #1184M - specialchar search
01686         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01687             $sURL .= "&amp;searchparam={$sVal}";
01688         }
01689 
01690         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01691             $sURL .= "&amp;searchcnid={$sVal}";
01692         }
01693 
01694         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01695             $sURL .= "&amp;searchvendor={$sVal}";
01696         }
01697 
01698         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01699             $sURL .= "&amp;searchmanufacturer={$sVal}";
01700         }
01701 
01702         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01703             $sURL .= "&amp;searchrecomm={$sVal}";
01704         }
01705 
01706         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01707             $sURL .= "&amp;searchtag={$sVal}";
01708         }
01709 
01710         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01711             $sURL .= "&amp;recommid={$sVal}";
01712         }
01713 
01714         return $sURL;
01715     }
01716 
01722     protected function _getSeoRequestParams()
01723     {
01724         $sClass = $this->getClassName();
01725         $sFnc   = $this->getFncName();
01726 
01727         // #921 S
01728         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01729         if ( in_array( $sFnc, $aFnc ) ) {
01730             $sFnc = '';
01731         }
01732 
01733         // #680
01734         $sURL = "cl={$sClass}";
01735         if ( $sFnc ) {
01736             $sURL .= "&amp;fnc={$sFnc}";
01737         }
01738         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01739             $sURL .= "&amp;page={$sVal}";
01740         }
01741 
01742         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01743             $sURL .= "&amp;tpl={$sVal}";
01744         }
01745 
01746         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01747         if ( $iPgNr > 0 ) {
01748             $sURL .= "&amp;pgNr={$iPgNr}";
01749         }
01750 
01751         return $sURL;
01752     }
01753 
01759     public function showSearch()
01760     {
01761         $blShow = true;
01762         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01763             $blShow = false;
01764         }
01765         return (int) $blShow;
01766     }
01767 
01773     public function getRssLinks()
01774     {
01775         return $this->_aRssLinks;
01776     }
01777 
01783     public function getSortColumns()
01784     {
01785         return $this->_aSortColumns;
01786     }
01787 
01793     public function getEditTags()
01794     {
01795     }
01796 
01802     public function getRecommSearch()
01803     {
01804     }
01805 
01811     public function getReviewUserId()
01812     {
01813     }
01814 
01820     public function getPaymentList()
01821     {
01822     }
01823 
01829     public function getActiveRecommList()
01830     {
01831     }
01832 
01838     public function getAccessoires()
01839     {
01840     }
01841 
01847     public function getCrossSelling()
01848     {
01849     }
01850 
01856     public function getSimilarProducts()
01857     {
01858     }
01859 
01865     public function getAlsoBoughtThiesProducts()
01866     {
01867     }
01868 
01874     public function getArticleId()
01875     {
01876     }
01877 
01883     public function isMoreTagsVisible()
01884     {
01885         return false;
01886     }
01887 
01893     public function getTitle()
01894     {
01895     }
01896 
01902     public function getActiveLangAbbr()
01903     {
01904         // Performance
01905         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01906             return;
01907         }
01908 
01909         if ( !isset($this->_sActiveLangAbbr ) ) {
01910             $aLanguages = oxLang::getInstance()->getLanguageArray();
01911             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01912                 if ( $oVal->selected ) {
01913                     $this->_sActiveLangAbbr = $oVal->abbr;
01914                     break;
01915                 }
01916             }
01917         }
01918 
01919         return $this->_sActiveLangAbbr;
01920     }
01921 
01935     public function addGlobalParams( $oShop = null)
01936     {
01937         $myConfig = $this->getConfig();
01938 
01939         $oViewConf = parent::addGlobalParams( $oShop );
01940 
01941         $this->_aViewData['isfiltering'] = true;
01942         $this->_aViewData['isnewsletter'] = true;
01943         $this->_aViewData['isvarianten'] = true;
01944         $this->_aViewData['isreview'] = true;
01945         $this->_aViewData['isaddsales'] = true;
01946         $this->_aViewData['isvoucher'] = true;
01947         $this->_aViewData['ispricealarm'] = true;
01948         $this->_aViewData['iswishlist'] = true;
01949         $this->_aViewData['isipayment'] = true;
01950         $this->_aViewData['istrusted'] = true;
01951         $this->_aViewData['isfiltering'] = true;
01952         $this->_aViewData['isgooglestats'] = true;
01953         $this->_aViewData['iswishlist'] = true;
01954 
01955 
01956         // show baskets
01957         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01958         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01959         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01960 
01961         // allow currency swiching
01962         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01963 
01964         // show/hide vendors
01965         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01966 
01967         // show/hide Manufacturers
01968         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01969 
01970         // show/hide empty categories
01971         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01972 
01973         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01974 
01975         // used for compatibility with older templates
01976         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01977         $this->_aViewData['urlsign']    = '&';
01978         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01979         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01980 
01981         $this->_aViewData['sListType'] = $this->getListType();
01982         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01983 
01984         // new navigation ?
01985         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01986         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01987 
01988         $this->_setNrOfArtPerPage();
01989 
01990 
01991         return $oViewConf;
01992     }
01993 
01999     public function getAdditionalParams()
02000     {
02001         if ( $this->_sAdditionalParams === null ) {
02002             // #1018A
02003             $this->_sAdditionalParams  = parent::getAdditionalParams();
02004             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
02005 
02006             // #1834M - specialchar search
02007             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
02008             if ( isset( $sSearchParamForLink ) ) {
02009                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02010             }
02011             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02012                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02013             }
02014             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02015                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02016             }
02017             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02018                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02019             }
02020             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02021                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02022             }
02023             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02024                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02025             }
02026             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02027                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02028             }
02029         }
02030 
02031         return $this->_sAdditionalParams;
02032     }
02033 
02039     public function generatePageNavigationUrl()
02040     {
02041         // $sClass = $this->_sThisAction;
02042         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02043     }
02044 
02054     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02055     {
02056         if ( $iPage ) {
02057             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02058         }
02059         return $sUrl;
02060     }
02061 
02067     public function generatePageNavigation( )
02068     {
02069         startProfile('generatePageNavigation');
02070         // generate the page navigation
02071         $pageNavigation = new stdClass();
02072         $pageNavigation->NrOfPages = $this->_iCntPages;
02073         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02074         $iActPage = $this->getActPage();
02075         $pageNavigation->actPage   = $iActPage + 1;
02076 
02077         $sUrl = $this->generatePageNavigationUrl( );
02078 
02079         if ( $iActPage > 0) {
02080             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02081         }
02082 
02083         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02084             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02085         }
02086 
02087         if ( $pageNavigation->NrOfPages > 1 ) {
02088             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02089                 $page = new Oxstdclass();
02090                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02091                 $page->selected = 0;
02092                 if ( $i == $pageNavigation->actPage ) {
02093                     $page->selected = 1;
02094                 }
02095                 $pageNavigation->changePage[$i] = $page;
02096             }
02097 
02098             // first/last one
02099             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02100             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02101         }
02102 
02103         stopProfile('generatePageNavigation');
02104 
02105         return $pageNavigation;
02106     }
02107 
02113     public function prepareMinimumOrderPrice4View()
02114     {
02115         $myConfig = $this->getConfig();
02116         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02117         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02118             $oBasket = $this->getSession()->getBasket();
02119             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02120                 return;
02121             }
02122             $oCur    = $myConfig->getActShopCurrencyObject();
02123             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02124             // Coupons and discounts should be considered in "Min order price" check
02125             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02126                 $this->_iLowOrderPrice = 1;
02127                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02128             }
02129         }
02130     }
02131 
02138     public function render()
02139     {
02140         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02141             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02142         }
02143 
02144         parent::render();
02145 
02146         if ( $this->getIsOrderStep() ) {
02147 
02148             // min. order price check
02149             $this->prepareMinimumOrderPrice4View();
02150 
02151             // disabling navigation during order ...
02152             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02153                 $this->_iNewsRealStatus = 1;
02154                 $this->setShowNewsletter( 0 );
02155                 // for old tpl. will be removed later
02156                 $this->_aViewData['isnewsletter'] = 0;
02157                 $this->setShowRightBasket( 0 );
02158                 $this->setShowLeftBasket( 0 );
02159                 $this->setShowTopBasket( 0 );
02160             }
02161             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02162             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02163         }
02164 
02165         // meta data
02166         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02167         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02168 
02169         // show baskets
02170         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02171         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02172         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02173 
02174         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02175 
02176         $this->_aViewData['noindex'] = $this->noIndex();
02177 
02178         return $this->_sThisTemplate;
02179     }
02180 
02186     public function getViewProduct()
02187     {
02188         return $this->getProduct();
02189     }
02190 
02198     public function setViewProduct( $oProduct )
02199     {
02200         $this->_oProduct = $oProduct;
02201     }
02202 
02208     public function getViewProductList()
02209     {
02210         return $this->_aArticleList;
02211     }
02212 
02218     public function getActPage()
02219     {
02220         if ( $this->_iActPage === null ) {
02221             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02222             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02223         }
02224         return $this->_iActPage;
02225     }
02226 
02234     public function getActCategory()
02235     {
02236         // if active category is not set yet - trying to load it from request params
02237         // this may be usefull when category component was unable to load active category
02238         // and we still need some object to mount navigation info
02239         if ( $this->_oClickCat === null ) {
02240 
02241             $this->_oClickCat = false;
02242             $oCategory = oxNew( 'oxcategory' );
02243             if ( $oCategory->load( $this->getCategoryId() ) ) {
02244                 $this->_oClickCat = $oCategory;
02245             }
02246         }
02247 
02248         return $this->_oClickCat;
02249     }
02250 
02258     public function setActCategory( $oCategory )
02259     {
02260         $this->_oClickCat = $oCategory;
02261     }
02262 
02270     public function getActTag()
02271     {
02272         if ( $this->_oActTag === null ) {
02273             $this->_oActTag = new Oxstdclass();
02274             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02275             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02276 
02277             if ( oxUtils::getInstance()->seoIsActive() ) {
02278                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02279             } else {
02280                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02281             }
02282 
02283         }
02284         return $this->_oActTag;
02285     }
02286 
02294     public function getActVendor()
02295     {
02296         // if active vendor is not set yet - trying to load it from request params
02297         // this may be usefull when category component was unable to load active vendor
02298         // and we still need some object to mount navigation info
02299         if ( $this->_oActVendor === null ) {
02300             $this->_oActVendor = false;
02301             $sVendorId = oxConfig::getParameter( 'cnid' );
02302             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02303             $oVendor = oxNew( 'oxvendor' );
02304             if ( $oVendor->load( $sVendorId ) ) {
02305                 $this->_oActVendor = $oVendor;
02306             }
02307         }
02308 
02309         return $this->_oActVendor;
02310     }
02311 
02319     public function getActManufacturer()
02320     {
02321         // if active Manufacturer is not set yet - trying to load it from request params
02322         // this may be usefull when category component was unable to load active Manufacturer
02323         // and we still need some object to mount navigation info
02324         if ( $this->_oActManufacturer === null ) {
02325 
02326             $this->_oActManufacturer = false;
02327             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02328             $oManufacturer = oxNew( 'oxmanufacturer' );
02329             if ( $oManufacturer->load( $sManufacturerId ) ) {
02330                 $this->_oActManufacturer = $oManufacturer;
02331             }
02332         }
02333 
02334         return $this->_oActManufacturer;
02335     }
02336 
02344     public function setActVendor( $oVendor )
02345     {
02346         $this->_oActVendor = $oVendor;
02347     }
02348 
02356     public function setActManufacturer( $oManufacturer )
02357     {
02358         $this->_oActManufacturer = $oManufacturer;
02359     }
02360 
02366     public function getActSearch()
02367     {
02368         if ( $this->_oActSearch === null ) {
02369             $this->_oActSearch = new oxStdClass();
02370             $sUrl = $this->getConfig()->getShopHomeURL();
02371             $this->_oActSearch->link = "{$sUrl}cl=search";
02372         }
02373         return $this->_oActSearch;
02374     }
02375 
02381     public function getActRecommList()
02382     {
02383         if ( $this->_oActRecomm === null ) {
02384             $this->_oActRecomm = false;
02385             $sRecommId = oxConfig::getParameter( 'recommid' );
02386 
02387             $oRecommList = oxNew( 'oxrecommlist' );
02388 
02389             if ( $oRecommList->load( $sRecommId ) ) {
02390                 $this->_oActRecomm = $oRecommList;
02391             }
02392         }
02393         return $this->_oActRecomm;
02394     }
02395 
02401     public function getCategoryTree()
02402     {
02403         return $this->_oCategoryTree;
02404     }
02405 
02413     public function setCategoryTree( $oCatTree )
02414     {
02415         $this->_oCategoryTree = $oCatTree;
02416     }
02417 
02423     public function getVendorTree()
02424     {
02425         return $this->_oVendorTree;
02426     }
02427 
02435     public function setVendorTree( $oVendorTree )
02436     {
02437         $this->_oVendorTree = $oVendorTree;
02438     }
02439 
02445     public function getManufacturerTree()
02446     {
02447         return $this->_oManufacturerTree;
02448     }
02449 
02457     public function setManufacturerTree( $oManufacturerTree )
02458     {
02459         $this->_oManufacturerTree = $oManufacturerTree;
02460     }
02470     protected function _loadActions()
02471     {
02472         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02473         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02474     }
02475 
02484     public function setSessionCategoryId( $sCategoryId )
02485     {
02486         oxSession::setVar( 'cnid', $sCategoryId );
02487     }
02488 
02494     public function getSessionCategoryId()
02495     {
02496         return oxSession::getVar( 'cnid' );
02497     }
02498 
02504     protected function _processListArticles()
02505     {
02506         $sAddParams = $this->getAddUrlParams();
02507         if ( $sAddParams && ( $oArticleList = $this->getArticleList() ) ) {
02508             foreach ( $oArticleList as $oArticle ) {
02509                 $oArticle->appendLink( $sAddParams );
02510             }
02511         }
02512     }
02513 
02519     public function getAddUrlParams()
02520     {
02521     }
02522 
02529     public function getTop5ArticleList()
02530     {
02531         if ( $this->_blTop5Action ) {
02532             if ( $this->_aTop5ArticleList === null ) {
02533                 $this->_aTop5ArticleList = false;
02534                 $myConfig = $this->getConfig();
02535                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02536                     // top 5 articles
02537                     $oArtList = oxNew( 'oxarticlelist' );
02538                     $oArtList->loadTop5Articles();
02539                     if ( $oArtList->count() ) {
02540                         $this->_aTop5ArticleList = $oArtList;
02541                     }
02542                 }
02543             }
02544         }
02545         return $this->_aTop5ArticleList;
02546     }
02547 
02554     public function getBargainArticleList()
02555     {
02556         if ( $this->_blBargainAction ) {
02557             if ( $this->_aBargainArticleList === null ) {
02558                 $this->_aBargainArticleList = array();
02559                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02560                     $oArtList = oxNew( 'oxarticlelist' );
02561                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02562                     if ( $oArtList->count() ) {
02563                         $this->_aBargainArticleList = $oArtList;
02564                     }
02565                 }
02566             }
02567         }
02568         return $this->_aBargainArticleList;
02569     }
02570 
02576     public function isLowOrderPrice()
02577     {
02578         return $this->_iLowOrderPrice;
02579     }
02580 
02586     public function getMinOrderPrice()
02587     {
02588         return $this->_sMinOrderPrice;
02589     }
02590 
02596     public function getNewsRealStatus()
02597     {
02598         return $this->_iNewsRealStatus;
02599     }
02600 
02606     protected function _canRedirect()
02607     {
02608         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02609             if ( oxConfig::getParameter( $sParam ) !== null ) {
02610                 return false;
02611             }
02612         }
02613 
02614         return true;
02615     }
02616 
02622     public function getProduct()
02623     {
02624     }
02625 
02631     public function getVendorlist()
02632     {
02633         return $this->_aVendorlist;
02634     }
02635 
02643     public function setVendorlist( $aList )
02644     {
02645         $this->_aVendorlist = $aList;
02646     }
02647 
02653     public function getManufacturerlist()
02654     {
02655         return $this->_aManufacturerlist;
02656     }
02657 
02665     public function setManufacturerlist( $aList )
02666     {
02667         $this->_aManufacturerlist = $aList;
02668     }
02669 
02677     public function setRootVendor( $oVendor )
02678     {
02679         $this->_oRootVendor = $oVendor;
02680     }
02681 
02687     public function getRootVendor()
02688     {
02689         return $this->_oRootVendor;
02690     }
02691 
02699     public function setRootManufacturer( $oManufacturer )
02700     {
02701         $this->_oRootManufacturer = $oManufacturer;
02702     }
02703 
02709     public function getRootManufacturer()
02710     {
02711         return $this->_oRootManufacturer;
02712     }
02713 
02719     public function getVendorId()
02720     {
02721         if ( $this->_sVendorId === null ) {
02722             $this->_sVendorId = false;
02723             if ( ( $oVendor = $this->getActVendor() ) ) {
02724                 $this->_sVendorId = $oVendor->getId();
02725             }
02726         }
02727         return $this->_sVendorId;
02728     }
02729 
02735     public function getManufacturerId()
02736     {
02737         if ( $this->_sManufacturerId === null ) {
02738             $this->_sManufacturerId = false;
02739             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02740                 $this->_sManufacturerId = $oManufacturer->getId();
02741             }
02742         }
02743         return $this->_sManufacturerId;
02744     }
02745 
02751     public function getSearchCatTree()
02752     {
02753         return $this->_aSearchCatTree;
02754     }
02755 
02763     public function setSearchCatTree( $aTree )
02764     {
02765         $this->_aSearchCatTree = $aTree;
02766     }
02767 
02773     public function getCatMore()
02774     {
02775         return $this->_oCatMore;
02776     }
02777 
02785     public function setCatMore( $oCat )
02786     {
02787         $this->_oCatMore = $oCat;
02788     }
02789 
02795     public function isNewsSubscribed()
02796     {
02797         return $this->_blNewsSubscribed;
02798     }
02799 
02807     public function setNewsSubscribed( $blNewsSubscribed )
02808     {
02809         $this->_blNewsSubscribed = $blNewsSubscribed;
02810     }
02811 
02817     public function showShipAddress()
02818     {
02819         return $this->_blShowShipAddress;
02820     }
02821 
02829     public function setShowShipAddress( $blShowShipAddress )
02830     {
02831         $this->_blShowShipAddress = $blShowShipAddress;
02832     }
02833 
02839     public function getDelAddress()
02840     {
02841         return $this->_oDelAddress;
02842     }
02843 
02851     public function setDelAddress( $oDelAddress )
02852     {
02853         $this->_oDelAddress = $oDelAddress;
02854     }
02855 
02861     public function getCatTreePath()
02862     {
02863         return $this->_sCatTreePath;
02864     }
02865 
02873     public function getContentByIdent( $sIdent )
02874     {
02875         if ( !isset( $this->_aContents[$sIdent] ) ) {
02876             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02877             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02878         }
02879         return $this->_aContents[$sIdent];
02880     }
02881 
02887     public function getContentCategory()
02888     {
02889         return false;
02890     }
02891 }

Generated on Wed Jun 17 12:09:05 2009 for OXID eShop CE by  doxygen 1.5.5