oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007 
00008 // view indexing state for search engines:
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00012 
00018 class oxUBase extends oxView
00019 {
00025     protected $_oaComponents = array();
00026 
00032     protected $_blIsCallForCache = false;
00033 
00039     protected $_blIsOrderStep = false;
00040 
00046     protected $_sListType = null;
00047 
00053     protected $_oActCategory = null;
00054 
00060     protected $_oActManufacturer = null;
00061 
00067     protected $_oActVendor = null;
00068 
00074     protected $_oActSearch = null;
00075 
00080     protected $_blShowSorting = false;
00081 
00086     protected $_blShowRightBasket = null;
00087 
00092     protected $_blShowTopBasket = null;
00093 
00098     protected $_blShowLeftBasket = null;
00099 
00104     protected $_blLoadCurrency = null;
00105 
00110     protected $_blLoadVendorTree = null;
00111 
00116     protected $_blLoadManufacturerTree = null;
00117 
00122     protected $_blDontShowEmptyCats = null;
00123 
00128     protected $_blLoadLanguage = null;
00129 
00134     protected $_blShowTopCatNav = null;
00135 
00140     protected $_iTopCatNavItmCnt = null;
00141 
00146     protected $_aRssLinks = null;
00147 
00152     protected $_sListOrderBy = null;
00153 
00158     protected $_sListOrderDir = null;
00159 
00164     protected $_sMetaDescription = null;
00165 
00170     protected $_sMetaKeywords = null;
00171 
00177     protected $_sMetaDescriptionIdent = null;
00178 
00184     protected $_sMetaKeywordsIdent = null;
00185 
00190     protected $_sAdditionalParams = null;
00191 
00196     protected $_oActCurrency = null;
00197 
00204     protected $_blCommonAdded = false;
00205 
00212     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00213 
00220     protected $_blForceNoIndex = false;
00221 
00226     protected $_sWishlistName = null;
00227 
00232     protected $_iCompItemsCnt = null;
00233 
00239     protected $_sContentId = null;
00240 
00246     protected $_oContent = null;
00247 
00253     protected $_sViewResetID = null;
00254 
00259     protected $_blActiveSorting = null;
00260 
00265     protected $_aMenueList = null;
00266 
00272     protected $_aComponentNames = array(
00273                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00274                                     'oxcmp_lang'       => 1,
00275                                     'oxcmp_cur'        => 1,
00276                                     'oxcmp_shop'       => 1,
00277                                     'oxcmp_categories' => 0,
00278                                     'oxcmp_utils'      => 1,
00279                                     'oxcmp_news'       => 0,
00280                                     'oxcmp_basket'     => 1
00281                                   );
00282 
00288     protected $_aUserComponentNames = array();
00289 
00295     protected $_oProduct = null;
00296 
00301     protected $_iActPage = null;
00302 
00307     protected $_aArticleList = null;
00308 
00313     protected $_oVendorTree  = null;
00314 
00319     protected $_oManufacturerTree  = null;
00320 
00325     protected $_oCategoryTree  = null;
00326 
00331     protected $_aTop5ArticleList  = null;
00332 
00337     protected $_aBargainArticleList  = null;
00338 
00343     protected $_blLowOrderPrice = null;
00344 
00352     protected $_iLowOrderPrice  = null;
00353 
00358     protected $_sMinOrderPrice  = null;
00359 
00364     protected $_iNewsRealStatus  = null;
00365 
00370     protected $_aBlockRedirectParams = array( 'fnc' );
00371 
00376     protected $_aVendorlist = null;
00377 
00382     protected $_oRootVendor = null;
00383 
00388     protected $_sVendorId = null;
00389 
00394     protected $_aManufacturerlist = null;
00395 
00400     protected $_oRootManufacturer = null;
00401 
00406     protected $_sManufacturerId = null;
00407 
00412     protected $_aSearchCatTree = null;
00413 
00418     protected $_oCatMore = null;
00419 
00424     protected $_blNewsSubscribed = null;
00425 
00430     protected $_blShowShipAddress = null;
00431 
00436     protected $_oDelAddress = null;
00437 
00442     protected $_sCatTreePath = null;
00443 
00448     protected $_aContents = array();
00449 
00454     protected $_blTop5Action = false;
00455 
00460     protected $_blBargainAction = false;
00461 
00470     protected function _processRequest()
00471     {
00472         $myUtils = oxUtils::getInstance();
00473 
00474         // non admin, request is not empty and was not processed by seo engine
00475         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00476 
00477             // fetching standard url and looking for it in seo table
00478             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00479                 $myUtils->redirect( $this->getConfig()->getShopURL() . $sRedirectUrl, false );
00480             } else {
00481                 // forcing to set noindex/follow meta
00482                 $this->_forceNoIndex();
00483 
00484                 $sShopId = $this->getConfig()->getShopId();
00485                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00486                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00487 
00488                 // logging "not found" url
00489                 $oDb = oxDb::getDb();
00490                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00491                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00492             }
00493         }
00494     }
00495 
00502     public function init()
00503     {
00504         $this->_processRequest();
00505 
00506         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00507             unset( $this->_aComponentNames['oxcmp_basket'] );
00508         }
00509 
00510         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00511         if ( !$this->_blCommonAdded ) {
00512             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00513             $this->_blCommonAdded = true;
00514         }
00515 
00516         // storing current view
00517         $blInit = true;
00518 
00519 
00520         // init all components if there are any
00521         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00522             // do not override initiated components
00523             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00524                 // component objects MUST be created to support user called functions
00525                 $oComponent = oxNew( $sComponentName );
00526                 $oComponent->setParent( $this );
00527                 $oComponent->setThisAction( $sComponentName );
00528                 $this->_oaComponents[$sComponentName] = $oComponent;
00529             }
00530 
00531             // do we really need to initiate them ?
00532             if ( $blInit ) {
00533                 $this->_oaComponents[$sComponentName]->init();
00534 
00535                 // executing only is view does not have action method
00536                 if ( !method_exists( $this, $this->getFncName() ) ) {
00537                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00538                 }
00539             }
00540         }
00541 
00542         parent::init();
00543 
00544         // enable sorting ?
00545         if ( $this->showSorting() ) {
00546             $this->prepareSortColumns();
00547         }
00548         $this->_aViewData['showsorting']    = $this->isSortingActive();
00549         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00550         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00551         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00552     }
00553 
00560     public function getViewId()
00561     {
00562         if ( $this->_sViewId ) {
00563             return $this->_sViewId;
00564         }
00565 
00566         $iLang = oxLang::getInstance()->getBaseLanguage();
00567         $iCur  = (int) oxConfig::getParameter( 'currency' );
00568 
00569 
00570             $this->_sViewId =  "ox|$iLang|$iCur";
00571 
00572         return $this->_sViewId;
00573     }
00574 
00575 
00581     public function showSorting()
00582     {
00583         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00584     }
00585 
00593     public function setComponents( $aComponents = null )
00594     {
00595         $this->_oaComponents = $aComponents;
00596     }
00597 
00603     public function getComponents()
00604     {
00605         return $this->_oaComponents;
00606     }
00607 
00615     public function setIsOrderStep( $blIsOrderStep = null )
00616     {
00617         $this->_blIsOrderStep = $blIsOrderStep;
00618     }
00619 
00625     public function getIsOrderStep()
00626     {
00627         return $this->_blIsOrderStep;
00628     }
00629 
00630 
00638     public function setActiveCategory( $oCategory )
00639     {
00640         $this->_oActCategory = $oCategory;
00641     }
00642 
00648     public function getActiveCategory()
00649     {
00650         return $this->_oActCategory;
00651     }
00652 
00660     public function setIsCallForCache( $blIsCallForCache = null )
00661     {
00662         $this->_blIsCallForCache = $blIsCallForCache;
00663     }
00664 
00670     public function getIsCallForCache()
00671     {
00672         return $this->_blIsCallForCache;
00673     }
00674 
00680     public function getListType()
00681     {
00682         if ( $this->_sListType == null ) {
00683             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00684                 $this->_sListType = $sListType;
00685             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00686                 $this->_sListType = $sListType;
00687             }
00688         }
00689         return $this->_sListType;
00690     }
00691 
00699     public function setListType( $sType )
00700     {
00701         $this->_sListType = $sType;
00702         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
00703     }
00704 
00710     public function showRightBasket()
00711     {
00712         if ( $this->_blShowRightBasket === null ) {
00713             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00714                 $this->_blShowRightBasket = $blShowRightBasket;
00715             }
00716         }
00717         return $this->_blShowRightBasket;
00718     }
00719 
00727     public function setShowRightBasket( $blShowBasket )
00728     {
00729         $this->_blShowRightBasket = $blShowBasket;
00730     }
00731 
00737     public function showLeftBasket()
00738     {
00739         if ( $this->_blShowLeftBasket === null ) {
00740             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00741                 $this->_blShowLeftBasket = $blShowLeftBasket;
00742             }
00743         }
00744         return $this->_blShowLeftBasket;
00745     }
00746 
00754     public function setShowLeftBasket( $blShowBasket )
00755     {
00756         $this->_blShowLeftBasket = $blShowBasket;
00757     }
00758 
00764     public function showTopBasket()
00765     {
00766         if ( $this->_blShowTopBasket === null ) {
00767             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00768                 $this->_blShowTopBasket = $blShowTopBasket;
00769             }
00770         }
00771         return $this->_blShowTopBasket;
00772     }
00773 
00781     public function setShowTopBasket( $blShowBasket )
00782     {
00783         $this->_blShowTopBasket = $blShowBasket;
00784     }
00785 
00791     public function loadCurrency()
00792     {
00793         if ( $this->_blLoadCurrency == null ) {
00794             $this->_blLoadCurrency = false;
00795             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00796                 $this->_blLoadCurrency = $blLoadCurrency;
00797             }
00798         }
00799         return $this->_blLoadCurrency;
00800     }
00801 
00807     public function loadVendorTree()
00808     {
00809         if ( $this->_blLoadVendorTree == null ) {
00810             $this->_blLoadVendorTree = false;
00811             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00812                 $this->_blLoadVendorTree = $blLoadVendorTree;
00813             }
00814         }
00815         return $this->_blLoadVendorTree;
00816     }
00817 
00823     public function loadManufacturerTree()
00824     {
00825         if ( $this->_blLoadManufacturerTree == null ) {
00826             $this->_blLoadManufacturerTree = false;
00827             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00828                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00829             }
00830         }
00831         return $this->_blLoadManufacturerTree;
00832     }
00833 
00839     public function dontShowEmptyCategories()
00840     {
00841         if ( $this->_blDontShowEmptyCats == null ) {
00842             $this->_blDontShowEmptyCats = false;
00843             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00844                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00845             }
00846         }
00847         return $this->_blDontShowEmptyCats;
00848     }
00849 
00855     public function isLanguageLoaded()
00856     {
00857         if ( $this->_blLoadLanguage == null ) {
00858             $this->_blLoadLanguage = false;
00859             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00860                 $this->_blLoadLanguage = $blLoadLanguage;
00861             }
00862         }
00863         return $this->_blLoadLanguage;
00864     }
00865 
00871     public function showTopCatNavigation()
00872     {
00873         if ( $this->_blShowTopCatNav == null ) {
00874             $this->_blShowTopCatNav = false;
00875             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00876                 $this->_blShowTopCatNav = $blShowTopCatNav;
00877             }
00878         }
00879         return $this->_blShowTopCatNav;
00880     }
00881 
00887     public function getTopNavigationCatCnt()
00888     {
00889         if ( $this->_iTopCatNavItmCnt == null ) {
00890             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00891             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00892         }
00893         return $this->_iTopCatNavItmCnt;
00894     }
00895 
00905     public function addRssFeed($sTitle, $sUrl, $key = null)
00906     {
00907         if (!is_array($this->_aRssLinks)) {
00908             $this->_aRssLinks = array();
00909         }
00910         if ($key === null) {
00911             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00912         } else {
00913             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00914         }
00915 
00916         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00917     }
00918 
00933     public function prepareSortColumns()
00934     {
00935         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00936         if ( count( $aSortColumns ) > 0 ) {
00937 
00938             $this->_blActiveSorting = true;
00939             $this->_aSortColumns = $aSortColumns;
00940 
00941             $sCnid = oxConfig::getParameter( 'cnid' );
00942 
00943             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00944             $sSortDir = oxConfig::getParameter( 'listorder' );
00945 
00946             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00947                 $sSortBy  = $aSorting['sortby'];
00948                 $sSortDir = $aSorting['sortdir'];
00949             }
00950 
00951             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00952                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00953 
00954                 $this->_sListOrderBy  = $sSortBy;
00955                 $this->_sListOrderDir = $sSortDir;
00956 
00957                 // caching sorting config
00958                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00959             }
00960         }
00961     }
00962 
00968     public function getListOrderBy()
00969     {
00970         return $this->_sListOrderBy;
00971     }
00972 
00978     public function getListOrderDirection()
00979     {
00980         return $this->_sListOrderDir;
00981     }
00982 
00990     public function setMetaDescription ( $sDescription )
00991     {
00992         return $this->_sMetaDescription = $sDescription;
00993     }
00994 
01002     public function setMetaKeywords( $sKeywords )
01003     {
01004         return $this->_sMetaKeywords = $sKeywords;
01005     }
01006 
01012     public function getMetaKeywords()
01013     {
01014         if ( $this->_sMetaKeywords === null ) {
01015             $this->_sMetaKeywords = false;
01016             $blRemoveDuplicatedWords = true;
01017             // set special meta keywords ?
01018             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01019                  ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
01020                 return $this->_sMetaKeywords = $sKeywords;
01021             } elseif ( $this->_sMetaKeywordsIdent ) {
01022                 $oContent = oxNew( 'oxcontent' );
01023                 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
01024                     $this->_sMetaKeywords = strip_tags( $oContent->oxcontents__oxcontent->value );
01025                     $blRemoveDuplicatedWords = false;
01026                 }
01027             }
01028 
01029             $this->_sMetaKeywords = $this->_prepareMetaKeyword( $this->_sMetaKeywords, $blRemoveDuplicatedWords );
01030         }
01031 
01032         return $this->_sMetaKeywords;
01033     }
01034 
01040     public function getMetaDescription()
01041     {
01042         if ( $this->_sMetaDescription === null ) {
01043             $this->_sMetaDescription = false;
01044             // set special meta description ?
01045             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01046                  ( $sMeta = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxdescription' ) ) ) {
01047                      return $this->_sMetaDescription = $sMeta;
01048             } elseif ( $this->_sMetaDescriptionIdent ) {
01049                 $oContent = oxNew( 'oxcontent' );
01050                 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
01051                     $this->_sMetaDescription = strip_tags( $oContent->oxcontents__oxcontent->value );
01052                 }
01053             }
01054 
01055             $this->_sMetaDescription = $this->_prepareMetaDescription( $this->_sMetaDescription );
01056         }
01057 
01058         return $this->_sMetaDescription;
01059     }
01060 
01066     public function getActCurrency()
01067     {
01068         return $this->_oActCurrency;
01069     }
01070 
01078     public function setActCurrency( $oCur )
01079     {
01080         $this->_oActCurrency = $oCur;
01081     }
01082 
01088     public function getCompareItemsCnt()
01089     {
01090         return $this->_iCompItemsCnt;
01091     }
01092 
01100     public function setCompareItemsCnt( $iCount )
01101     {
01102         $this->_iCompItemsCnt = $iCount;
01103     }
01104 
01110     public function getWishlistName()
01111     {
01112         return $this->_sWishlistName;
01113     }
01114 
01122     public function setWishlistName( $sName )
01123     {
01124         $this->_sWishlistName = $sName;
01125     }
01126 
01132     protected function _forceNoIndex()
01133     {
01134         $this->_blForceNoIndex = true;
01135     }
01136 
01143     public function noIndex()
01144     {
01145         if ( $this->_blForceNoIndex ) {
01146             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01147         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01148             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01149         } else {
01150             switch ( oxConfig::getParameter( 'fnc' ) ) {
01151                 case 'tocomparelist':
01152                 case 'tobasket':
01153                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01154                     break;
01155             }
01156         }
01157         return $this->_iViewIndexState;
01158     }
01159 
01166     public function getContentId()
01167     {
01168         if ( $this->_sContentId === null) {
01169             $oContent = oxNew( 'oxcontent' );
01170             $oContent->loadByIdent( 'oximpressum' );
01171             $this->_sContentId = $oContent->getId();
01172         }
01173 
01174         return $this->_sContentId;
01175     }
01176 
01183     public function getContent()
01184     {
01185         if ( $this->_oContent === null) {
01186             $oContent = oxNew( 'oxcontent' );
01187             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01188                 $this->_oContent = $oContent;
01189             }
01190         }
01191 
01192         return $this->_oContent;
01193     }
01194 
01200     public function isSortingActive()
01201     {
01202         return $this->_blActiveSorting;
01203     }
01204 
01210     public function getMenueList()
01211     {
01212         return $this->_aMenueList;
01213     }
01214 
01222     public function setMenueList( $aMenue )
01223     {
01224         $this->_aMenueList = $aMenue;
01225     }
01226 
01227 
01233     protected function _setNrOfArtPerPage()
01234     {
01235         $myConfig  = $this->getConfig();
01236         $aViewData = array();
01237 
01238         //setting default values to avoid possible errors showing article list
01239         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01240         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01241 
01242         // checking if all needed data is set
01243         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01244         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01245             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01246         } else {
01247             $iNrofCatArticles = $aNrofCatArticles[0];
01248         }
01249 
01250         $oViewConf = $this->getViewConfig();
01251         //value from user input
01252         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01253             // performing floor() to skip such variants as 7.5 etc
01254             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
01255             // M45 Possibility to push any "Show articles per page" number parameter
01256             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01257             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01258             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01259         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01260             // M45 Possibility to push any "Show articles per page" number parameter
01261             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01262             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01263             $iNrofCatArticles = $iSessArtPerPage;
01264         } else {
01265             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01266         }
01267 
01268         //setting number of articles per page to config value
01269         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01270 
01271         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01272     }
01273 
01279     protected function _getSeoObjectId()
01280     {
01281     }
01282 
01292     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01293     {
01294         if ( $sMeta ) {
01295 
01296             $oStr = getStr();
01297             if ( $iLength != -1 ) {
01298                 /* *
01299                  * performance - we dont need a huge amount of initial text.
01300                  * assume that effective text may be double longer than $iLength
01301                  * and simple turncate it
01302                  */
01303                 $iELength = ( $iLength * 2 );
01304                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01305             }
01306 
01307             // decoding html entities
01308             $sMeta = $oStr->html_entity_decode( $sMeta );
01309             // stripping HTML tags
01310             $sMeta = strip_tags( $sMeta );
01311 
01312             // removing some special chars
01313             $sMeta = $oStr->cleanStr( $sMeta );
01314 
01315             // removing duplicate words
01316             if ( $blRemoveDuplicatedWords ) {
01317                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01318             }
01319 
01320             // some special cases
01321             $sMeta = str_replace( ' ,', ',', $sMeta );
01322             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01323             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01324             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01325 
01326             return trim( $sMeta );
01327         }
01328     }
01329 
01338     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01339     {
01340 
01341         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01342 
01343         if ( $blRemoveDuplicatedWords ) {
01344             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01345         }
01346 
01347         // removing in admin defined strings
01348 
01349         /*if ( is_array( $aSkipTags ) && $sString ) {
01350             $oStr = getStr();
01351             foreach ( $aSkipTags as $sSkip ) {
01352                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01353                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01354                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01355                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01356             }
01357         }*/
01358 
01359         return trim( $sString );
01360     }
01361 
01370     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01371     {
01372         $oStr = getStr();
01373         if ( is_array( $aInput ) ) {
01374             $aStrings = $aInput;
01375         } else {
01376             //is String
01377             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01378         }
01379 
01380         if ( $sCount = count( $aSkipTags ) ) {
01381             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01382                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01383             }
01384         }
01385         $sCount = count($aStrings);
01386         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01387             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01388             // removing in admin defined strings
01389             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01390                 unset( $aStrings[$iNum] );
01391             }
01392         }
01393 
01394         // duplicates
01395         $aStrings = array_unique($aStrings);
01396 
01397         return implode( ', ', $aStrings );
01398     }
01399 
01407     public function getNavigationParams()
01408     {
01409         $aParams['cnid'] = $this->getCategoryId();
01410         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01411 
01412         $aParams['listtype'] = $this->getListType();
01413         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01414 
01415         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01416         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01417         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01418 
01419         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01420         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01421         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01422 
01423         return $aParams;
01424     }
01425 
01435     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01436     {
01437         $aSorting = oxSession::getVar( 'aSorting' );
01438         $aSorting[$sCnid]['sortby']  = $sSortBy;
01439         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01440 
01441         oxSession::setVar( 'aSorting', $aSorting );
01442     }
01443 
01451     public function getSorting( $sCnid )
01452     {
01453         $aSorting = oxSession::getVar( 'aSorting' );
01454         if ( isset( $aSorting[$sCnid] ) ) {
01455             return $aSorting[$sCnid];
01456         }
01457     }
01458 
01466     public function getSortingSql( $sCnid )
01467     {
01468         $aSorting = $this->getSorting( $sCnid );
01469         if ( is_array( $aSorting ) ) {
01470             return implode( " ", $aSorting );
01471         }
01472     }
01473 
01479     public function getTitleSuffix()
01480     {
01481         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01482     }
01483 
01490     public function getTitlePrefix()
01491     {
01492         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01493     }
01494 
01503     protected function _getSubject( $iLang )
01504     {
01505         return null;
01506     }
01507 
01513     public function getDynUrlParams()
01514     {
01515         $sRet = '';
01516         $sListType = $this->getListType();
01517 
01518         switch ($sListType) {
01519             default:
01520                 break;
01521             case 'search':
01522                 $sRet .= "&amp;listtype={$sListType}";
01523                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01524                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01525                 }
01526 
01527                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01528                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01529                 }
01530                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01531                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01532                 }
01533                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01534                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01535                 }
01536                 break;
01537             case 'tag':
01538                 $sRet .= "&amp;listtype={$sListType}";
01539                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01540                     $sRet .= "&amp;searchtag={$sParam}";
01541                 }
01542                 break;
01543         }
01544 
01545         return $sRet;
01546     }
01547 
01555     public function getLink( $iLang = null )
01556     {
01557         if ( !isset( $iLang ) ) {
01558             $iLang = oxLang::getInstance()->getBaseLanguage();
01559         }
01560 
01561         $oDisplayObj = null;
01562         if ( oxUtils::getInstance()->seoIsActive() ) {
01563             $blTrySeo = true;
01564             $oDisplayObj = $this->_getSubject( $iLang );
01565         }
01566         $iActPageNr = $this->getActPage();
01567 
01568         if ( $oDisplayObj ) {
01569 
01570             // if languages do not match object must be reload, but reference to view object should be broken
01571             if ( $oDisplayObj->getLanguage() != $iLang ) {
01572                 $sOxId = $oDisplayObj->getId();
01573                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01574                 $oDisplayObj->loadInLang( $iLang, $sOxId );
01575             }
01576 
01577             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01578         } else {
01579             $myConfig = $this->getConfig();
01580 
01581             if ( $blTrySeo ) {
01582                 $oEncoder = oxSeoEncoder::getInstance();
01583                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01584                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01585                 }
01586             }
01587 
01588             $sForceLangChange = '';
01589             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01590                 $sForceLangChange = "&amp;lang={$iLang}";
01591             }
01592 
01593             $sUrl = $this->getSession()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange );
01594 
01595             // fallback to old non seo url
01596             return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01597         }
01598     }
01599 
01606     public function getSimilarRecommLists()
01607     {
01608     }
01609 
01617     protected function _getRequestParams( $blAddPageNr  = true )
01618     {
01619         $sClass = $this->getClassName();
01620         $sFnc   = $this->getFncName();
01621 
01622         // #921 S
01623         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01624         if ( in_array( $sFnc, $aFnc ) ) {
01625             $sFnc = '';
01626         }
01627 
01628         // #680
01629         $sURL = "cl={$sClass}";
01630         if ( $sFnc ) {
01631             $sURL .= "&amp;fnc={$sFnc}";
01632         }
01633         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01634             $sURL .= "&amp;cnid={$sVal}";
01635         }
01636         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01637             $sURL .= "&amp;mnid={$sVal}";
01638         }
01639         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01640             $sURL .= "&amp;anid={$sVal}";
01641         }
01642 
01643         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01644             $sURL .= "&amp;page={$sVal}";
01645         }
01646 
01647         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01648             $sURL .= "&amp;tpl={$sVal}";
01649         }
01650 
01651         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01652         // don't include page number for navigation
01653         // it will be done in oxubase::generatePageNavigation
01654         if ( $blAddPageNr && $iPgNr > 0 ) {
01655             $sURL .= "&amp;pgNr={$iPgNr}";
01656         }
01657 
01658         // #1184M - specialchar search
01659         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01660             $sURL .= "&amp;searchparam={$sVal}";
01661         }
01662 
01663         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01664             $sURL .= "&amp;searchcnid={$sVal}";
01665         }
01666 
01667         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01668             $sURL .= "&amp;searchvendor={$sVal}";
01669         }
01670 
01671         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01672             $sURL .= "&amp;searchmanufacturer={$sVal}";
01673         }
01674 
01675         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01676             $sURL .= "&amp;searchrecomm={$sVal}";
01677         }
01678 
01679         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01680             $sURL .= "&amp;searchtag={$sVal}";
01681         }
01682 
01683         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01684             $sURL .= "&amp;recommid={$sVal}";
01685         }
01686 
01687         return $sURL;
01688     }
01689 
01695     protected function _getSeoRequestParams()
01696     {
01697         $sClass = $this->getClassName();
01698         $sFnc   = $this->getFncName();
01699 
01700         // #921 S
01701         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01702         if ( in_array( $sFnc, $aFnc ) ) {
01703             $sFnc = '';
01704         }
01705 
01706         // #680
01707         $sURL = "cl={$sClass}";
01708         if ( $sFnc ) {
01709             $sURL .= "&amp;fnc={$sFnc}";
01710         }
01711         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01712             $sURL .= "&amp;page={$sVal}";
01713         }
01714 
01715         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01716             $sURL .= "&amp;tpl={$sVal}";
01717         }
01718 
01719         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01720         if ( $iPgNr > 0 ) {
01721             $sURL .= "&amp;pgNr={$iPgNr}";
01722         }
01723 
01724         return $sURL;
01725     }
01726 
01732     public function showSearch()
01733     {
01734         $blShow = true;
01735         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01736             $blShow = false;
01737         }
01738         return (int) $blShow;
01739     }
01740 
01746     public function getRssLinks()
01747     {
01748         return $this->_aRssLinks;
01749     }
01750 
01756     public function getSortColumns()
01757     {
01758         return $this->_aSortColumns;
01759     }
01760 
01766     public function getEditTags()
01767     {
01768     }
01769 
01775     public function getRecommSearch()
01776     {
01777     }
01778 
01784     public function getReviewUserId()
01785     {
01786     }
01787 
01793     public function getPaymentList()
01794     {
01795     }
01796 
01802     public function getActiveRecommList()
01803     {
01804     }
01805 
01811     public function getAccessoires()
01812     {
01813     }
01814 
01820     public function getCrossSelling()
01821     {
01822     }
01823 
01829     public function getSimilarProducts()
01830     {
01831     }
01832 
01840     public function getAlsoBoughtThiesProducts()
01841     {
01842     }
01843 
01849     public function getAlsoBoughtTheseProducts()
01850     {
01851     }
01852 
01858     public function getArticleId()
01859     {
01860     }
01861 
01867     public function isMoreTagsVisible()
01868     {
01869         return false;
01870     }
01871 
01877     public function getTitle()
01878     {
01879     }
01880 
01886     public function getActiveLangAbbr()
01887     {
01888         // Performance
01889         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01890             return;
01891         }
01892 
01893         if ( !isset($this->_sActiveLangAbbr ) ) {
01894             $aLanguages = oxLang::getInstance()->getLanguageArray();
01895             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01896                 if ( $oVal->selected ) {
01897                     $this->_sActiveLangAbbr = $oVal->abbr;
01898                     break;
01899                 }
01900             }
01901         }
01902 
01903         return $this->_sActiveLangAbbr;
01904     }
01905 
01919     public function addGlobalParams( $oShop = null)
01920     {
01921         $myConfig = $this->getConfig();
01922 
01923         $oViewConf = parent::addGlobalParams( $oShop );
01924 
01925         $this->_aViewData['isfiltering'] = true;
01926         $this->_aViewData['isnewsletter'] = true;
01927         $this->_aViewData['isvarianten'] = true;
01928         $this->_aViewData['isreview'] = true;
01929         $this->_aViewData['isaddsales'] = true;
01930         $this->_aViewData['isvoucher'] = true;
01931         $this->_aViewData['ispricealarm'] = true;
01932         $this->_aViewData['iswishlist'] = true;
01933         $this->_aViewData['isipayment'] = true;
01934         $this->_aViewData['istrusted'] = true;
01935         $this->_aViewData['isfiltering'] = true;
01936         $this->_aViewData['isgooglestats'] = true;
01937         $this->_aViewData['iswishlist'] = true;
01938 
01939 
01940         // show baskets
01941         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01942         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01943         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01944 
01945         // allow currency swiching
01946         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01947 
01948         // show/hide vendors
01949         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01950 
01951         // show/hide Manufacturers
01952         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01953 
01954         // show/hide empty categories
01955         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01956 
01957         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01958 
01959         // used for compatibility with older templates
01960         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01961         $this->_aViewData['urlsign']    = '&';
01962         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01963         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01964 
01965         $this->_aViewData['sListType'] = $this->getListType();
01966         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01967 
01968         // new navigation ?
01969         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01970         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01971 
01972         $this->_setNrOfArtPerPage();
01973 
01974 
01975         return $oViewConf;
01976     }
01977 
01983     public function getAdditionalParams()
01984     {
01985         if ( $this->_sAdditionalParams === null ) {
01986             // #1018A
01987             $this->_sAdditionalParams  = parent::getAdditionalParams();
01988             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01989 
01990             // #1834M - specialchar search
01991             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01992             if ( isset( $sSearchParamForLink ) ) {
01993                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01994             }
01995             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01996                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01997             }
01998             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01999                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02000             }
02001             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02002                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02003             }
02004             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02005                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02006             }
02007             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02008                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02009             }
02010             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02011                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02012             }
02013         }
02014 
02015         return $this->_sAdditionalParams;
02016     }
02017 
02023     public function generatePageNavigationUrl()
02024     {
02025         // $sClass = $this->_sThisAction;
02026         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02027     }
02028 
02038     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02039     {
02040         if ( $iPage ) {
02041             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02042         }
02043         return $sUrl;
02044     }
02045 
02051     public function generatePageNavigation()
02052     {
02053         startProfile('generatePageNavigation');
02054         // generate the page navigation
02055         $pageNavigation = new stdClass();
02056         $pageNavigation->NrOfPages = $this->_iCntPages;
02057         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02058         $iActPage = $this->getActPage();
02059         $pageNavigation->actPage   = $iActPage + 1;
02060 
02061         $sUrl = $this->generatePageNavigationUrl();
02062 
02063         if ( $iActPage > 0) {
02064             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02065         }
02066 
02067         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02068             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02069         }
02070 
02071         if ( $pageNavigation->NrOfPages > 1 ) {
02072             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02073                 $page = new Oxstdclass();
02074                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02075                 $page->selected = 0;
02076                 if ( $i == $pageNavigation->actPage ) {
02077                     $page->selected = 1;
02078                 }
02079                 $pageNavigation->changePage[$i] = $page;
02080             }
02081 
02082             // first/last one
02083             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02084             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02085         }
02086 
02087         stopProfile('generatePageNavigation');
02088 
02089         return $pageNavigation;
02090     }
02091 
02099     public function prepareMinimumOrderPrice4View()
02100     {
02101         $myConfig = $this->getConfig();
02102         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02103         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02104             $oBasket = $this->getSession()->getBasket();
02105             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02106                 return;
02107             }
02108             $oCur    = $myConfig->getActShopCurrencyObject();
02109             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02110             // Coupons and discounts should be considered in "Min order price" check
02111             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02112                 $this->_iLowOrderPrice = 1;
02113                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02114             }
02115         }
02116     }
02117 
02124     public function render()
02125     {
02126         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02127             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02128         }
02129 
02130         parent::render();
02131 
02132         if ( $this->getIsOrderStep() ) {
02133 
02134             // disabling navigation during order ...
02135             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02136                 $this->_iNewsRealStatus = 1;
02137                 $this->setShowNewsletter( 0 );
02138                 // for old tpl. will be removed later
02139                 $this->_aViewData['isnewsletter'] = 0;
02140                 $this->setShowRightBasket( 0 );
02141                 $this->setShowLeftBasket( 0 );
02142                 $this->setShowTopBasket( 0 );
02143             }
02144             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02145             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02146         }
02147 
02148         // meta data
02149         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02150         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02151 
02152         // show baskets
02153         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02154         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02155         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02156 
02157         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02158 
02159         $this->_aViewData['noindex'] = $this->noIndex();
02160 
02161         return $this->_sThisTemplate;
02162     }
02163 
02169     public function getViewProduct()
02170     {
02171         return $this->getProduct();
02172     }
02173 
02181     public function setViewProduct( $oProduct )
02182     {
02183         $this->_oProduct = $oProduct;
02184     }
02185 
02191     public function getViewProductList()
02192     {
02193         return $this->_aArticleList;
02194     }
02195 
02201     public function getActPage()
02202     {
02203         if ( $this->_iActPage === null ) {
02204             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02205             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02206         }
02207         return $this->_iActPage;
02208     }
02209 
02217     public function getActTag()
02218     {
02219         if ( $this->_oActTag === null ) {
02220             $this->_oActTag = new Oxstdclass();
02221             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02222             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02223 
02224             if ( oxUtils::getInstance()->seoIsActive() ) {
02225                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02226             } else {
02227                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02228             }
02229 
02230         }
02231         return $this->_oActTag;
02232     }
02233 
02241     public function getActVendor()
02242     {
02243         // if active vendor is not set yet - trying to load it from request params
02244         // this may be usefull when category component was unable to load active vendor
02245         // and we still need some object to mount navigation info
02246         if ( $this->_oActVendor === null ) {
02247             $this->_oActVendor = false;
02248             $sVendorId = oxConfig::getParameter( 'cnid' );
02249             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02250             $oVendor = oxNew( 'oxvendor' );
02251             if ( $oVendor->load( $sVendorId ) ) {
02252                 $this->_oActVendor = $oVendor;
02253             }
02254         }
02255 
02256         return $this->_oActVendor;
02257     }
02258 
02266     public function getActManufacturer()
02267     {
02268         // if active Manufacturer is not set yet - trying to load it from request params
02269         // this may be usefull when category component was unable to load active Manufacturer
02270         // and we still need some object to mount navigation info
02271         if ( $this->_oActManufacturer === null ) {
02272 
02273             $this->_oActManufacturer = false;
02274             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02275             $oManufacturer = oxNew( 'oxmanufacturer' );
02276             if ( $oManufacturer->load( $sManufacturerId ) ) {
02277                 $this->_oActManufacturer = $oManufacturer;
02278             }
02279         }
02280 
02281         return $this->_oActManufacturer;
02282     }
02283 
02291     public function setActVendor( $oVendor )
02292     {
02293         $this->_oActVendor = $oVendor;
02294     }
02295 
02303     public function setActManufacturer( $oManufacturer )
02304     {
02305         $this->_oActManufacturer = $oManufacturer;
02306     }
02307 
02313     public function getActSearch()
02314     {
02315         if ( $this->_oActSearch === null ) {
02316             $this->_oActSearch = new oxStdClass();
02317             $sUrl = $this->getConfig()->getShopHomeURL();
02318             $this->_oActSearch->link = "{$sUrl}cl=search";
02319         }
02320         return $this->_oActSearch;
02321     }
02322 
02328     public function getActRecommList()
02329     {
02330         if ( $this->_oActRecomm === null ) {
02331             $this->_oActRecomm = false;
02332             $sRecommId = oxConfig::getParameter( 'recommid' );
02333 
02334             $oRecommList = oxNew( 'oxrecommlist' );
02335 
02336             if ( $oRecommList->load( $sRecommId ) ) {
02337                 $this->_oActRecomm = $oRecommList;
02338             }
02339         }
02340         return $this->_oActRecomm;
02341     }
02342 
02348     public function getCategoryTree()
02349     {
02350         return $this->_oCategoryTree;
02351     }
02352 
02360     public function setCategoryTree( $oCatTree )
02361     {
02362         $this->_oCategoryTree = $oCatTree;
02363     }
02364 
02370     public function getVendorTree()
02371     {
02372         return $this->_oVendorTree;
02373     }
02374 
02382     public function setVendorTree( $oVendorTree )
02383     {
02384         $this->_oVendorTree = $oVendorTree;
02385     }
02386 
02392     public function getManufacturerTree()
02393     {
02394         return $this->_oManufacturerTree;
02395     }
02396 
02404     public function setManufacturerTree( $oManufacturerTree )
02405     {
02406         $this->_oManufacturerTree = $oManufacturerTree;
02407     }
02417     protected function _loadActions()
02418     {
02419         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02420         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02421     }
02422 
02431     public function setSessionCategoryId( $sCategoryId )
02432     {
02433         oxSession::setVar( 'cnid', $sCategoryId );
02434     }
02435 
02441     public function getSessionCategoryId()
02442     {
02443         return oxSession::getVar( 'cnid' );
02444     }
02445 
02451     protected function _processListArticles()
02452     {
02453         $sAddParams = $this->getAddUrlParams();
02454         if ( $sAddParams && ( $oArticleList = $this->getArticleList() ) ) {
02455             foreach ( $oArticleList as $oArticle ) {
02456                 $oArticle->appendLink( $sAddParams );
02457             }
02458         }
02459     }
02460 
02466     public function getAddUrlParams()
02467     {
02468     }
02469 
02476     public function getTop5ArticleList()
02477     {
02478         if ( $this->_blTop5Action ) {
02479             if ( $this->_aTop5ArticleList === null ) {
02480                 $this->_aTop5ArticleList = false;
02481                 $myConfig = $this->getConfig();
02482                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02483                     // top 5 articles
02484                     $oArtList = oxNew( 'oxarticlelist' );
02485                     $oArtList->loadTop5Articles();
02486                     if ( $oArtList->count() ) {
02487                         $this->_aTop5ArticleList = $oArtList;
02488                     }
02489                 }
02490             }
02491         }
02492         return $this->_aTop5ArticleList;
02493     }
02494 
02501     public function getBargainArticleList()
02502     {
02503         if ( $this->_blBargainAction ) {
02504             if ( $this->_aBargainArticleList === null ) {
02505                 $this->_aBargainArticleList = array();
02506                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02507                     $oArtList = oxNew( 'oxarticlelist' );
02508                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02509                     if ( $oArtList->count() ) {
02510                         $this->_aBargainArticleList = $oArtList;
02511                     }
02512                 }
02513             }
02514         }
02515         return $this->_aBargainArticleList;
02516     }
02517 
02524     public function isLowOrderPrice()
02525     {
02526         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02527             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02528         }
02529 
02530         return $this->_blLowOrderPrice;
02531     }
02532 
02538     public function getMinOrderPrice()
02539     {
02540         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02541             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02542             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02543         }
02544         return $this->_sMinOrderPrice;
02545     }
02546 
02552     public function getNewsRealStatus()
02553     {
02554         return $this->_iNewsRealStatus;
02555     }
02556 
02562     protected function _canRedirect()
02563     {
02564         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02565             if ( oxConfig::getParameter( $sParam ) !== null ) {
02566                 return false;
02567             }
02568         }
02569 
02570         return true;
02571     }
02572 
02578     public function getProduct()
02579     {
02580     }
02581 
02587     public function getVendorlist()
02588     {
02589         return $this->_aVendorlist;
02590     }
02591 
02599     public function setVendorlist( $aList )
02600     {
02601         $this->_aVendorlist = $aList;
02602     }
02603 
02609     public function getManufacturerlist()
02610     {
02611         return $this->_aManufacturerlist;
02612     }
02613 
02621     public function setManufacturerlist( $aList )
02622     {
02623         $this->_aManufacturerlist = $aList;
02624     }
02625 
02633     public function setRootVendor( $oVendor )
02634     {
02635         $this->_oRootVendor = $oVendor;
02636     }
02637 
02643     public function getRootVendor()
02644     {
02645         return $this->_oRootVendor;
02646     }
02647 
02655     public function setRootManufacturer( $oManufacturer )
02656     {
02657         $this->_oRootManufacturer = $oManufacturer;
02658     }
02659 
02665     public function getRootManufacturer()
02666     {
02667         return $this->_oRootManufacturer;
02668     }
02669 
02675     public function getVendorId()
02676     {
02677         if ( $this->_sVendorId === null ) {
02678             $this->_sVendorId = false;
02679             if ( ( $oVendor = $this->getActVendor() ) ) {
02680                 $this->_sVendorId = $oVendor->getId();
02681             }
02682         }
02683         return $this->_sVendorId;
02684     }
02685 
02691     public function getManufacturerId()
02692     {
02693         if ( $this->_sManufacturerId === null ) {
02694             $this->_sManufacturerId = false;
02695             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02696                 $this->_sManufacturerId = $oManufacturer->getId();
02697             }
02698         }
02699         return $this->_sManufacturerId;
02700     }
02701 
02707     public function getSearchCatTree()
02708     {
02709         return $this->_aSearchCatTree;
02710     }
02711 
02719     public function setSearchCatTree( $aTree )
02720     {
02721         $this->_aSearchCatTree = $aTree;
02722     }
02723 
02729     public function getCatMore()
02730     {
02731         return $this->_oCatMore;
02732     }
02733 
02741     public function setCatMore( $oCat )
02742     {
02743         $this->_oCatMore = $oCat;
02744     }
02745 
02751     public function getCatTreePath()
02752     {
02753         return $this->_sCatTreePath;
02754     }
02755 
02763     public function getContentByIdent( $sIdent )
02764     {
02765         if ( !isset( $this->_aContents[$sIdent] ) ) {
02766             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02767             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02768         }
02769         return $this->_aContents[$sIdent];
02770     }
02771 
02777     public function getContentCategory()
02778     {
02779         return false;
02780     }
02781 }

Generated on Tue Sep 29 16:45:16 2009 for OXID eShop CE by  doxygen 1.5.5