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 ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01253             // M45 Possibility to push any "Show articles per page" number parameter
01254             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01255             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01256             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01257         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01258             // M45 Possibility to push any "Show articles per page" number parameter
01259             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01260             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01261             $iNrofCatArticles = $iSessArtPerPage;
01262         } else {
01263             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01264         }
01265 
01266         //setting number of articles per page to config value
01267         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01268 
01269         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01270     }
01271 
01277     protected function _getSeoObjectId()
01278     {
01279     }
01280 
01290     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01291     {
01292         if ( $sMeta ) {
01293 
01294             $oStr = getStr();
01295             if ( $iLength != -1 ) {
01296                 /* *
01297                  * performance - we dont need a huge amount of initial text.
01298                  * assume that effective text may be double longer than $iLength
01299                  * and simple turncate it
01300                  */
01301                 $iELength = ( $iLength * 2 );
01302                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01303             }
01304 
01305             // decoding html entities
01306             $sMeta = $oStr->html_entity_decode( $sMeta );
01307             // stripping HTML tags
01308             $sMeta = strip_tags( $sMeta );
01309 
01310             // removing some special chars
01311             $sMeta = $oStr->cleanStr( $sMeta );
01312 
01313             // removing duplicate words
01314             if ( $blRemoveDuplicatedWords ) {
01315                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01316             }
01317 
01318             // some special cases
01319             $sMeta = str_replace( ' ,', ',', $sMeta );
01320             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01321             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01322             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01323 
01324             return trim( $sMeta );
01325         }
01326     }
01327 
01336     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01337     {
01338 
01339         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01340 
01341         if ( $blRemoveDuplicatedWords ) {
01342             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01343         }
01344 
01345         // removing in admin defined strings
01346 
01347         /*if ( is_array( $aSkipTags ) && $sString ) {
01348             $oStr = getStr();
01349             foreach ( $aSkipTags as $sSkip ) {
01350                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01351                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01352                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01353                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01354             }
01355         }*/
01356 
01357         return trim( $sString );
01358     }
01359 
01368     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01369     {
01370         $oStr = getStr();
01371         if ( is_array( $aInput ) ) {
01372             $aStrings = $aInput;
01373         } else {
01374             //is String
01375             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01376         }
01377 
01378         if ( $sCount = count( $aSkipTags ) ) {
01379             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01380                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01381             }
01382         }
01383         $sCount = count($aStrings);
01384         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01385             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01386             // removing in admin defined strings
01387             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01388                 unset( $aStrings[$iNum] );
01389             }
01390         }
01391 
01392         // duplicates
01393         $aStrings = array_unique($aStrings);
01394 
01395         return implode( ', ', $aStrings );
01396     }
01397 
01405     public function getNavigationParams()
01406     {
01407         $aParams['cnid'] = $this->getCategoryId();
01408         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01409 
01410         $aParams['listtype'] = $this->getListType();
01411         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01412 
01413         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01414         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01415         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01416 
01417         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01418         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01419         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01420 
01421         return $aParams;
01422     }
01423 
01433     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01434     {
01435         $aSorting = oxSession::getVar( 'aSorting' );
01436         $aSorting[$sCnid]['sortby']  = $sSortBy;
01437         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01438 
01439         oxSession::setVar( 'aSorting', $aSorting );
01440     }
01441 
01449     public function getSorting( $sCnid )
01450     {
01451         $aSorting = oxSession::getVar( 'aSorting' );
01452         if ( isset( $aSorting[$sCnid] ) ) {
01453             return $aSorting[$sCnid];
01454         }
01455     }
01456 
01464     public function getSortingSql( $sCnid )
01465     {
01466         $aSorting = $this->getSorting( $sCnid );
01467         if ( is_array( $aSorting ) ) {
01468             return implode( " ", $aSorting );
01469         }
01470     }
01471 
01477     public function getTitleSuffix()
01478     {
01479         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01480     }
01481 
01488     public function getTitlePrefix()
01489     {
01490         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01491     }
01492 
01501     protected function _getSubject( $iLang )
01502     {
01503         return null;
01504     }
01505 
01511     public function getDynUrlParams()
01512     {
01513         $sRet = '';
01514         $sListType = $this->getListType();
01515 
01516         switch ($sListType) {
01517             default:
01518                 break;
01519             case 'search':
01520                 $sRet .= "&amp;listtype={$sListType}";
01521                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01522                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01523                 }
01524 
01525                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01526                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01527                 }
01528                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01529                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01530                 }
01531                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01532                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01533                 }
01534                 break;
01535             case 'tag':
01536                 $sRet .= "&amp;listtype={$sListType}";
01537                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01538                     $sRet .= "&amp;searchtag={$sParam}";
01539                 }
01540                 break;
01541         }
01542 
01543         return $sRet;
01544     }
01545 
01553     public function getLink( $iLang = null )
01554     {
01555         if ( !isset( $iLang ) ) {
01556             $iLang = oxLang::getInstance()->getBaseLanguage();
01557         }
01558 
01559         $oDisplayObj = null;
01560         if ( oxUtils::getInstance()->seoIsActive() ) {
01561             $blTrySeo = true;
01562             $oDisplayObj = $this->_getSubject( $iLang );
01563         }
01564         $iActPageNr = $this->getActPage();
01565 
01566         if ( $oDisplayObj ) {
01567 
01568             // if languages do not match object must be reload, but reference to view object should be broken
01569             if ( $oDisplayObj->getLanguage() != $iLang ) {
01570                 $sOxId = $oDisplayObj->getId();
01571                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01572                 $oDisplayObj->loadInLang( $iLang, $sOxId );
01573             }
01574 
01575             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01576         } else {
01577             $myConfig = $this->getConfig();
01578 
01579             if ( $blTrySeo ) {
01580                 $oEncoder = oxSeoEncoder::getInstance();
01581                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01582                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01583                 }
01584             }
01585 
01586             $sForceLangChange = '';
01587             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01588                 $sForceLangChange = "&amp;lang={$iLang}";
01589             }
01590 
01591             $sUrl = $this->getSession()->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange );
01592 
01593             // fallback to old non seo url
01594             return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01595         }
01596     }
01597 
01603     public function getCanonicalUrl()
01604     {
01605     }
01606 
01613     public function getSimilarRecommLists()
01614     {
01615     }
01616 
01624     protected function _getRequestParams( $blAddPageNr  = true )
01625     {
01626         $sClass = $this->getClassName();
01627         $sFnc   = $this->getFncName();
01628 
01629         // #921 S
01630         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01631         if ( in_array( $sFnc, $aFnc ) ) {
01632             $sFnc = '';
01633         }
01634 
01635         // #680
01636         $sURL = "cl={$sClass}";
01637         if ( $sFnc ) {
01638             $sURL .= "&amp;fnc={$sFnc}";
01639         }
01640         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01641             $sURL .= "&amp;cnid={$sVal}";
01642         }
01643         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01644             $sURL .= "&amp;mnid={$sVal}";
01645         }
01646         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01647             $sURL .= "&amp;anid={$sVal}";
01648         }
01649 
01650         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01651             $sURL .= "&amp;page={$sVal}";
01652         }
01653 
01654         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01655             $sURL .= "&amp;tpl={$sVal}";
01656         }
01657 
01658         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01659         // don't include page number for navigation
01660         // it will be done in oxubase::generatePageNavigation
01661         if ( $blAddPageNr && $iPgNr > 0 ) {
01662             $sURL .= "&amp;pgNr={$iPgNr}";
01663         }
01664 
01665         // #1184M - specialchar search
01666         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01667             $sURL .= "&amp;searchparam={$sVal}";
01668         }
01669 
01670         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01671             $sURL .= "&amp;searchcnid={$sVal}";
01672         }
01673 
01674         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01675             $sURL .= "&amp;searchvendor={$sVal}";
01676         }
01677 
01678         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01679             $sURL .= "&amp;searchmanufacturer={$sVal}";
01680         }
01681 
01682         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01683             $sURL .= "&amp;searchrecomm={$sVal}";
01684         }
01685 
01686         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01687             $sURL .= "&amp;searchtag={$sVal}";
01688         }
01689 
01690         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01691             $sURL .= "&amp;recommid={$sVal}";
01692         }
01693 
01694         return $sURL;
01695     }
01696 
01702     protected function _getSeoRequestParams()
01703     {
01704         $sClass = $this->getClassName();
01705         $sFnc   = $this->getFncName();
01706 
01707         // #921 S
01708         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01709         if ( in_array( $sFnc, $aFnc ) ) {
01710             $sFnc = '';
01711         }
01712 
01713         // #680
01714         $sURL = "cl={$sClass}";
01715         if ( $sFnc ) {
01716             $sURL .= "&amp;fnc={$sFnc}";
01717         }
01718         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01719             $sURL .= "&amp;page={$sVal}";
01720         }
01721 
01722         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01723             $sURL .= "&amp;tpl={$sVal}";
01724         }
01725 
01726         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01727         if ( $iPgNr > 0 ) {
01728             $sURL .= "&amp;pgNr={$iPgNr}";
01729         }
01730 
01731         return $sURL;
01732     }
01733 
01739     public function showSearch()
01740     {
01741         $blShow = true;
01742         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01743             $blShow = false;
01744         }
01745         return (int) $blShow;
01746     }
01747 
01753     public function getRssLinks()
01754     {
01755         return $this->_aRssLinks;
01756     }
01757 
01763     public function getSortColumns()
01764     {
01765         return $this->_aSortColumns;
01766     }
01767 
01773     public function getEditTags()
01774     {
01775     }
01776 
01782     public function getRecommSearch()
01783     {
01784     }
01785 
01791     public function getReviewUserId()
01792     {
01793     }
01794 
01800     public function getPaymentList()
01801     {
01802     }
01803 
01809     public function getActiveRecommList()
01810     {
01811     }
01812 
01818     public function getAccessoires()
01819     {
01820     }
01821 
01827     public function getCrossSelling()
01828     {
01829     }
01830 
01836     public function getSimilarProducts()
01837     {
01838     }
01839 
01847     public function getAlsoBoughtThiesProducts()
01848     {
01849     }
01850 
01856     public function getAlsoBoughtTheseProducts()
01857     {
01858     }
01859 
01865     public function getArticleId()
01866     {
01867     }
01868 
01874     public function isMoreTagsVisible()
01875     {
01876         return false;
01877     }
01878 
01884     public function getTitle()
01885     {
01886     }
01887 
01893     public function getActiveLangAbbr()
01894     {
01895         // Performance
01896         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01897             return;
01898         }
01899 
01900         if ( !isset($this->_sActiveLangAbbr ) ) {
01901             $aLanguages = oxLang::getInstance()->getLanguageArray();
01902             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01903                 if ( $oVal->selected ) {
01904                     $this->_sActiveLangAbbr = $oVal->abbr;
01905                     break;
01906                 }
01907             }
01908         }
01909 
01910         return $this->_sActiveLangAbbr;
01911     }
01912 
01926     public function addGlobalParams( $oShop = null)
01927     {
01928         $myConfig = $this->getConfig();
01929 
01930         $oViewConf = parent::addGlobalParams( $oShop );
01931 
01932         $this->_aViewData['isfiltering'] = true;
01933         $this->_aViewData['isnewsletter'] = true;
01934         $this->_aViewData['isvarianten'] = true;
01935         $this->_aViewData['isreview'] = true;
01936         $this->_aViewData['isaddsales'] = true;
01937         $this->_aViewData['isvoucher'] = true;
01938         $this->_aViewData['ispricealarm'] = true;
01939         $this->_aViewData['iswishlist'] = true;
01940         $this->_aViewData['isipayment'] = true;
01941         $this->_aViewData['istrusted'] = true;
01942         $this->_aViewData['isfiltering'] = true;
01943         $this->_aViewData['isgooglestats'] = true;
01944         $this->_aViewData['iswishlist'] = true;
01945 
01946 
01947         // show baskets
01948         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01949         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01950         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01951 
01952         // allow currency swiching
01953         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01954 
01955         // show/hide vendors
01956         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01957 
01958         // show/hide Manufacturers
01959         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01960 
01961         // show/hide empty categories
01962         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01963 
01964         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01965 
01966         // used for compatibility with older templates
01967         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01968         $this->_aViewData['urlsign']    = '&';
01969         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01970         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01971 
01972         $this->_aViewData['sListType'] = $this->getListType();
01973         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01974 
01975         // new navigation ?
01976         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01977         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01978 
01979         $this->_setNrOfArtPerPage();
01980 
01981 
01982         return $oViewConf;
01983     }
01984 
01990     public function getAdditionalParams()
01991     {
01992         if ( $this->_sAdditionalParams === null ) {
01993             // #1018A
01994             $this->_sAdditionalParams  = parent::getAdditionalParams();
01995             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01996 
01997             // #1834M - specialchar search
01998             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01999             if ( isset( $sSearchParamForLink ) ) {
02000                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
02001             }
02002             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
02003                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
02004             }
02005             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02006                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02007             }
02008             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02009                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02010             }
02011             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02012                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02013             }
02014             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02015                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02016             }
02017             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02018                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02019             }
02020         }
02021 
02022         return $this->_sAdditionalParams;
02023     }
02024 
02030     public function generatePageNavigationUrl()
02031     {
02032         // $sClass = $this->_sThisAction;
02033         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02034     }
02035 
02045     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02046     {
02047         if ( $iPage ) {
02048             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02049         }
02050         return $sUrl;
02051     }
02052 
02058     public function generatePageNavigation()
02059     {
02060         startProfile('generatePageNavigation');
02061         // generate the page navigation
02062         $pageNavigation = new stdClass();
02063         $pageNavigation->NrOfPages = $this->_iCntPages;
02064         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02065         $iActPage = $this->getActPage();
02066         $pageNavigation->actPage   = $iActPage + 1;
02067 
02068         $sUrl = $this->generatePageNavigationUrl();
02069 
02070         if ( $iActPage > 0) {
02071             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02072         }
02073 
02074         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02075             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02076         }
02077 
02078         if ( $pageNavigation->NrOfPages > 1 ) {
02079             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02080                 $page = new Oxstdclass();
02081                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02082                 $page->selected = 0;
02083                 if ( $i == $pageNavigation->actPage ) {
02084                     $page->selected = 1;
02085                 }
02086                 $pageNavigation->changePage[$i] = $page;
02087             }
02088 
02089             // first/last one
02090             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02091             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02092         }
02093 
02094         stopProfile('generatePageNavigation');
02095 
02096         return $pageNavigation;
02097     }
02098 
02106     public function prepareMinimumOrderPrice4View()
02107     {
02108         $myConfig = $this->getConfig();
02109         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02110         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02111             $oBasket = $this->getSession()->getBasket();
02112             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02113                 return;
02114             }
02115             $oCur    = $myConfig->getActShopCurrencyObject();
02116             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02117             // Coupons and discounts should be considered in "Min order price" check
02118             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02119                 $this->_iLowOrderPrice = 1;
02120                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02121             }
02122         }
02123     }
02124 
02131     public function render()
02132     {
02133         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02134             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02135         }
02136 
02137         parent::render();
02138 
02139         if ( $this->getIsOrderStep() ) {
02140 
02141             // disabling navigation during order ...
02142             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02143                 $this->_iNewsRealStatus = 1;
02144                 $this->setShowNewsletter( 0 );
02145                 // for old tpl. will be removed later
02146                 $this->_aViewData['isnewsletter'] = 0;
02147                 $this->setShowRightBasket( 0 );
02148                 $this->setShowLeftBasket( 0 );
02149                 $this->setShowTopBasket( 0 );
02150             }
02151             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02152             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02153         }
02154 
02155         // meta data
02156         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02157         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02158 
02159         // show baskets
02160         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02161         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02162         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02163 
02164         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02165 
02166         $this->_aViewData['noindex'] = $this->noIndex();
02167 
02168         return $this->_sThisTemplate;
02169     }
02170 
02176     public function getViewProduct()
02177     {
02178         return $this->getProduct();
02179     }
02180 
02188     public function setViewProduct( $oProduct )
02189     {
02190         $this->_oProduct = $oProduct;
02191     }
02192 
02198     public function getViewProductList()
02199     {
02200         return $this->_aArticleList;
02201     }
02202 
02208     public function getActPage()
02209     {
02210         if ( $this->_iActPage === null ) {
02211             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02212             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02213         }
02214         return $this->_iActPage;
02215     }
02216 
02224     public function getActTag()
02225     {
02226         if ( $this->_oActTag === null ) {
02227             $this->_oActTag = new Oxstdclass();
02228             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02229             $oSeoEncoderTag = oxSeoEncoderTag::getInstance();
02230 
02231             if ( oxUtils::getInstance()->seoIsActive() ) {
02232                 $this->_oActTag->link = $oSeoEncoderTag->getTagUrl( $sTag, oxLang::getInstance()->getBaseLanguage() );
02233             } else {
02234                 $this->_oActTag->link = $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02235             }
02236 
02237         }
02238         return $this->_oActTag;
02239     }
02240 
02248     public function getActVendor()
02249     {
02250         // if active vendor is not set yet - trying to load it from request params
02251         // this may be usefull when category component was unable to load active vendor
02252         // and we still need some object to mount navigation info
02253         if ( $this->_oActVendor === null ) {
02254             $this->_oActVendor = false;
02255             $sVendorId = oxConfig::getParameter( 'cnid' );
02256             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02257             $oVendor = oxNew( 'oxvendor' );
02258             if ( $oVendor->load( $sVendorId ) ) {
02259                 $this->_oActVendor = $oVendor;
02260             }
02261         }
02262 
02263         return $this->_oActVendor;
02264     }
02265 
02273     public function getActManufacturer()
02274     {
02275         // if active Manufacturer is not set yet - trying to load it from request params
02276         // this may be usefull when category component was unable to load active Manufacturer
02277         // and we still need some object to mount navigation info
02278         if ( $this->_oActManufacturer === null ) {
02279 
02280             $this->_oActManufacturer = false;
02281             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02282             $oManufacturer = oxNew( 'oxmanufacturer' );
02283             if ( $oManufacturer->load( $sManufacturerId ) ) {
02284                 $this->_oActManufacturer = $oManufacturer;
02285             }
02286         }
02287 
02288         return $this->_oActManufacturer;
02289     }
02290 
02298     public function setActVendor( $oVendor )
02299     {
02300         $this->_oActVendor = $oVendor;
02301     }
02302 
02310     public function setActManufacturer( $oManufacturer )
02311     {
02312         $this->_oActManufacturer = $oManufacturer;
02313     }
02314 
02320     public function getActSearch()
02321     {
02322         if ( $this->_oActSearch === null ) {
02323             $this->_oActSearch = new oxStdClass();
02324             $sUrl = $this->getConfig()->getShopHomeURL();
02325             $this->_oActSearch->link = "{$sUrl}cl=search";
02326         }
02327         return $this->_oActSearch;
02328     }
02329 
02335     public function getActRecommList()
02336     {
02337         if ( $this->_oActRecomm === null ) {
02338             $this->_oActRecomm = false;
02339             $sRecommId = oxConfig::getParameter( 'recommid' );
02340 
02341             $oRecommList = oxNew( 'oxrecommlist' );
02342 
02343             if ( $oRecommList->load( $sRecommId ) ) {
02344                 $this->_oActRecomm = $oRecommList;
02345             }
02346         }
02347         return $this->_oActRecomm;
02348     }
02349 
02355     public function getCategoryTree()
02356     {
02357         return $this->_oCategoryTree;
02358     }
02359 
02367     public function setCategoryTree( $oCatTree )
02368     {
02369         $this->_oCategoryTree = $oCatTree;
02370     }
02371 
02377     public function getVendorTree()
02378     {
02379         return $this->_oVendorTree;
02380     }
02381 
02389     public function setVendorTree( $oVendorTree )
02390     {
02391         $this->_oVendorTree = $oVendorTree;
02392     }
02393 
02399     public function getManufacturerTree()
02400     {
02401         return $this->_oManufacturerTree;
02402     }
02403 
02411     public function setManufacturerTree( $oManufacturerTree )
02412     {
02413         $this->_oManufacturerTree = $oManufacturerTree;
02414     }
02424     protected function _loadActions()
02425     {
02426         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02427         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02428     }
02429 
02435     protected function _processListArticles()
02436     {
02437         $sAddParams = $this->getAddUrlParams();
02438         if ( $sAddParams && ( $oArticleList = $this->getArticleList() ) ) {
02439             foreach ( $oArticleList as $oArticle ) {
02440                 $oArticle->appendLink( $sAddParams );
02441             }
02442         }
02443     }
02444 
02450     public function getAddUrlParams()
02451     {
02452     }
02453 
02460     public function getTop5ArticleList()
02461     {
02462         if ( $this->_blTop5Action ) {
02463             if ( $this->_aTop5ArticleList === null ) {
02464                 $this->_aTop5ArticleList = false;
02465                 $myConfig = $this->getConfig();
02466                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02467                     // top 5 articles
02468                     $oArtList = oxNew( 'oxarticlelist' );
02469                     $oArtList->loadTop5Articles();
02470                     if ( $oArtList->count() ) {
02471                         $this->_aTop5ArticleList = $oArtList;
02472                     }
02473                 }
02474             }
02475         }
02476         return $this->_aTop5ArticleList;
02477     }
02478 
02485     public function getBargainArticleList()
02486     {
02487         if ( $this->_blBargainAction ) {
02488             if ( $this->_aBargainArticleList === null ) {
02489                 $this->_aBargainArticleList = array();
02490                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02491                     $oArtList = oxNew( 'oxarticlelist' );
02492                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02493                     if ( $oArtList->count() ) {
02494                         $this->_aBargainArticleList = $oArtList;
02495                     }
02496                 }
02497             }
02498         }
02499         return $this->_aBargainArticleList;
02500     }
02501 
02508     public function isLowOrderPrice()
02509     {
02510         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02511             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02512         }
02513 
02514         return $this->_blLowOrderPrice;
02515     }
02516 
02522     public function getMinOrderPrice()
02523     {
02524         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02525             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02526             $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice );
02527         }
02528         return $this->_sMinOrderPrice;
02529     }
02530 
02536     public function getNewsRealStatus()
02537     {
02538         return $this->_iNewsRealStatus;
02539     }
02540 
02546     protected function _canRedirect()
02547     {
02548         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02549             if ( oxConfig::getParameter( $sParam ) !== null ) {
02550                 return false;
02551             }
02552         }
02553 
02554         return true;
02555     }
02556 
02562     public function getProduct()
02563     {
02564     }
02565 
02571     public function getVendorlist()
02572     {
02573         return $this->_aVendorlist;
02574     }
02575 
02583     public function setVendorlist( $aList )
02584     {
02585         $this->_aVendorlist = $aList;
02586     }
02587 
02593     public function getManufacturerlist()
02594     {
02595         return $this->_aManufacturerlist;
02596     }
02597 
02605     public function setManufacturerlist( $aList )
02606     {
02607         $this->_aManufacturerlist = $aList;
02608     }
02609 
02617     public function setRootVendor( $oVendor )
02618     {
02619         $this->_oRootVendor = $oVendor;
02620     }
02621 
02627     public function getRootVendor()
02628     {
02629         return $this->_oRootVendor;
02630     }
02631 
02639     public function setRootManufacturer( $oManufacturer )
02640     {
02641         $this->_oRootManufacturer = $oManufacturer;
02642     }
02643 
02649     public function getRootManufacturer()
02650     {
02651         return $this->_oRootManufacturer;
02652     }
02653 
02659     public function getVendorId()
02660     {
02661         if ( $this->_sVendorId === null ) {
02662             $this->_sVendorId = false;
02663             if ( ( $oVendor = $this->getActVendor() ) ) {
02664                 $this->_sVendorId = $oVendor->getId();
02665             }
02666         }
02667         return $this->_sVendorId;
02668     }
02669 
02675     public function getManufacturerId()
02676     {
02677         if ( $this->_sManufacturerId === null ) {
02678             $this->_sManufacturerId = false;
02679             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02680                 $this->_sManufacturerId = $oManufacturer->getId();
02681             }
02682         }
02683         return $this->_sManufacturerId;
02684     }
02685 
02691     public function getSearchCatTree()
02692     {
02693         return $this->_aSearchCatTree;
02694     }
02695 
02703     public function setSearchCatTree( $aTree )
02704     {
02705         $this->_aSearchCatTree = $aTree;
02706     }
02707 
02713     public function getCatMore()
02714     {
02715         return $this->_oCatMore;
02716     }
02717 
02725     public function setCatMore( $oCat )
02726     {
02727         $this->_oCatMore = $oCat;
02728     }
02729 
02735     public function getCatTreePath()
02736     {
02737         return $this->_sCatTreePath;
02738     }
02739 
02747     public function getContentByIdent( $sIdent )
02748     {
02749         if ( !isset( $this->_aContents[$sIdent] ) ) {
02750             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02751             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02752         }
02753         return $this->_aContents[$sIdent];
02754     }
02755 
02761     public function getContentCategory()
02762     {
02763         return false;
02764     }
02765 }

Generated on Mon Oct 26 20:07:20 2009 for OXID eShop CE by  doxygen 1.5.5