oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00007 // view indexing state for search engines:
00008 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00009 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00010 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00011 
00017 class oxUBase extends oxView
00018 {
00023     protected $_blFbWidgetsOn = null;
00024 
00029     protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
00030 
00036     protected $_oaComponents = array();
00037 
00043     protected $_blIsOrderStep = false;
00044 
00050     protected $_sListType = null;
00051 
00057     protected $_aListDisplayTypes = array( 'grid', 'line', 'infogrid' );
00058 
00064     protected $_sListDisplayType = null;
00065 
00071     protected $_sCustomListDisplayType = null;
00072 
00078     protected $_oActCategory = null;
00079 
00085     protected $_oActManufacturer = null;
00086 
00092     protected $_oActVendor = null;
00093 
00098     protected $_oActiveRecommList = null;
00099 
00105     protected $_oActSearch = null;
00106 
00111     protected $_blShowSorting = false;
00112 
00117     protected $_blLoadCurrency = null;
00118 
00123     protected $_blLoadManufacturerTree = null;
00124 
00129     protected $_blDontShowEmptyCats = null;
00130 
00135     protected $_blLoadLanguage = null;
00136 
00141     protected $_iTopCatNavItmCnt = null;
00142 
00147     protected $_aRssLinks = null;
00148 
00153     protected $_sListOrderBy = null;
00154 
00159     protected $_sListOrderDir = null;
00160 
00165     protected $_sMetaDescription = null;
00166 
00171     protected $_sMetaKeywords = null;
00172 
00178     protected $_sMetaDescriptionIdent = null;
00179 
00185     protected $_sMetaKeywordsIdent = null;
00186 
00191     protected $_sAdditionalParams = null;
00192 
00197     protected $_oActCurrency = null;
00198 
00203     protected $_blEnabledPrivateSales = null;
00204 
00211     protected $_blCommonAdded = false;
00212 
00219     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00220 
00227     protected $_blForceNoIndex = false;
00228 
00233     protected $_iCompItemsCnt = null;
00234 
00240     protected $_sContentId = null;
00241 
00247     protected $_oContent = null;
00248 
00254     protected $_sViewResetID = null;
00255 
00260     protected $_blActiveSorting = null;
00261 
00266     protected $_aMenueList = null;
00267 
00273     protected $_aComponentNames = array(
00274                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00275                                     'oxcmp_lang'       => 0,
00276                                     'oxcmp_cur'        => 1,
00277                                     'oxcmp_shop'       => 1,
00278                                     'oxcmp_categories' => 0,
00279                                     'oxcmp_utils'      => 1,
00280                                     'oxcmp_news'       => 0,
00281                                     'oxcmp_basket'     => 1
00282                                   );
00283 
00289     protected $_aUserComponentNames = array();
00290 
00296     protected $_oProduct = null;
00297 
00302     protected $_iActPage = null;
00303 
00308     protected $_aArticleList = null;
00309 
00314     protected $_oManufacturerTree  = null;
00315 
00320     protected $_oCategoryTree  = null;
00321 
00326     protected $_aTop5ArticleList  = null;
00327 
00332     protected $_aBargainArticleList  = null;
00333 
00338     protected $_blLowOrderPrice = null;
00339 
00344     protected $_sMinOrderPrice  = null;
00345 
00350     protected $_iNewsRealStatus  = null;
00351 
00357     protected $_aBlockRedirectParams = array( 'fnc', 'stoken', 'force_sid', 'force_admin_sid' );
00358 
00363     protected $_oRootVendor = null;
00364 
00369     protected $_sVendorId = null;
00370 
00375     protected $_aManufacturerlist = null;
00376 
00381     protected $_oRootManufacturer = null;
00382 
00387     protected $_sManufacturerId = null;
00388 
00393     protected $_aSearchCatTree = null;
00394 
00399     protected $_blNewsSubscribed = null;
00400 
00405     protected $_oDelAddress = null;
00406 
00411     protected $_sCatTreePath = null;
00412 
00417     protected $_aContents = array();
00418 
00423     protected $_blTop5Action = true;
00424 
00429     protected $_blBargainAction = false;
00430 
00436     protected $_aMustFillFields = null;
00437 
00442     protected $_blShowTagCloud = true;
00443 
00448     protected $_blRootCatChanged = false;
00449 
00454     protected $_aInvoiceAddress = null;
00455 
00460     protected $_aDeliveryAddress = null;
00461 
00466     protected $_sActiveUsername = null;
00467 
00473     protected static $_aCollectedComponentNames = null;
00474 
00481     protected $_blLoadComponents = true;
00482 
00488     protected function _getComponentNames()
00489     {
00490         if ( self::$_aCollectedComponentNames === null ) {
00491             self::$_aCollectedComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00492 
00493             // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
00494             // so we added this array to config.inc.php file
00495             if ( ( $aUserCmps = $this->getConfig()->getConfigParam( 'aUserComponentNames' ) ) ) {
00496                 self::$_aCollectedComponentNames = array_merge( self::$_aCollectedComponentNames, $aUserCmps );
00497             }
00498 
00499             if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00500                 unset( self::$_aCollectedComponentNames['oxcmp_basket'] );
00501             }
00502         }
00503 
00504         // resetting array pointer
00505         reset( self::$_aCollectedComponentNames );
00506         return self::$_aCollectedComponentNames;
00507     }
00508 
00517     protected function _processRequest()
00518     {
00519         $myUtils = oxRegistry::getUtils();
00520 
00521         // non admin, request is not empty and was not processed by seo engine
00522         if ( !isSearchEngineUrl() && $myUtils->seoIsActive() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00523 
00524             // fetching standard url and looking for it in seo table
00525             if ( $this->_canRedirect() && ( $sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl( $sStdUrl ) ) ) {
00526                 $myUtils->redirect( $this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false );
00527             } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
00528                 // forcing to set noindex/follow meta
00529                 $this->_forceNoIndex();
00530 
00531                 if (!$this->getConfig()->isProductiveMode() || $this->getConfig()->getConfigParam('blSeoLogging')) {
00532                     $sShopId = $this->getConfig()->getShopId();
00533                     $sLangId = oxRegistry::getLang()->getBaseLanguage();
00534                     $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00535 
00536                     // logging "not found" url
00537                     $oDb = oxDb::getDb();
00538                     $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00539                                     values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00540                 }
00541             }
00542         }
00543     }
00544 
00551     public function init()
00552     {
00553         $this->_processRequest();
00554 
00555         // storing current view
00556         $blInit = true;
00557 
00558 
00559         // init all components if there are any
00560         if ( $this->_blLoadComponents ) {
00561             foreach ( $this->_getComponentNames() as $sComponentName => $blNotCacheable ) {
00562                 // do not override initiated components
00563                 if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00564                     // component objects MUST be created to support user called functions
00565                     $oComponent = oxNew( $sComponentName );
00566                     $oComponent->setParent( $this );
00567                     $oComponent->setThisAction( $sComponentName );
00568                     $this->_oaComponents[$sComponentName] = $oComponent;
00569                 }
00570 
00571                 // do we really need to initiate them ?
00572                 if ( $blInit ) {
00573                     $this->_oaComponents[$sComponentName]->init();
00574 
00575                     // executing only is view does not have action method
00576                     if ( !method_exists( $this, $this->getFncName() ) ) {
00577                         $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00578                     }
00579                 }
00580             }
00581         }
00582 
00583         parent::init();
00584 
00585         // enable sorting ?
00586         if ( $this->showSorting() ) {
00587             $this->prepareSortColumns();
00588         }
00589     }
00590 
00597     public function getViewId()
00598     {
00599         if ( $this->_sViewId ) {
00600             return $this->_sViewId;
00601         }
00602 
00603         $myConfig = $this->getConfig();
00604         $iLang = oxRegistry::getLang()->getBaseLanguage();
00605         $iCur  = (int) $myConfig->getShopCurrency();
00606 
00607 
00608             $this->_sViewId =  "ox|$iLang|$iCur";
00609 
00610         $this->_sViewId .= "|".( (int) $this->_blForceNoIndex ).'|'.((int)$this->isRootCatChanged());
00611 
00612         // #0002866: external global viewID addition
00613         if (function_exists('customGetViewId')) {
00614             $oExtViewId = customGetViewId();
00615 
00616             if ($oExtViewId !== null) {
00617                 $this->_sViewId .= '|'.md5(serialize($oExtViewId));
00618             }
00619         }
00620 
00621         return $this->_sViewId;
00622     }
00623 
00624 
00630     public function showSorting()
00631     {
00632         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00633     }
00634 
00642     public function setComponents( $aComponents = null )
00643     {
00644         $this->_oaComponents = $aComponents;
00645     }
00646 
00652     public function getComponents()
00653     {
00654         return $this->_oaComponents;
00655     }
00656 
00664     public function getComponent( $sName )
00665     {
00666         if ( $sName != null ) {
00667             return $this->_oaComponents[$sName];
00668         }
00669     }
00677     public function setIsOrderStep( $blIsOrderStep = null )
00678     {
00679         $this->_blIsOrderStep = $blIsOrderStep;
00680     }
00681 
00687     public function getIsOrderStep()
00688     {
00689         return $this->_blIsOrderStep;
00690     }
00691 
00692 
00700     public function setActiveCategory( $oCategory )
00701     {
00702         $this->_oActCategory = $oCategory;
00703     }
00704 
00710     public function getActiveCategory()
00711     {
00712         return $this->_oActCategory;
00713     }
00714 
00720     public function getListType()
00721     {
00722         if ( $this->_sListType == null ) {
00723             if ( $sListType = oxConfig::getParameter( 'listtype' ) ) {
00724                 $this->_sListType = $sListType;
00725             } elseif ( $sListType = $this->getConfig()->getGlobalParameter( 'listtype' ) ) {
00726                 $this->_sListType = $sListType;
00727             }
00728         }
00729         return $this->_sListType;
00730     }
00731 
00737     public function getListDisplayType()
00738     {
00739         if ( $this->_sListDisplayType == null ) {
00740             $this->_sListDisplayType = $this->getCustomListDisplayType();
00741 
00742             if ( !$this->_sListDisplayType ) {
00743                 $this->_sListDisplayType = $this->getConfig()->getConfigParam( 'sDefaultListDisplayType' );
00744             }
00745 
00746             $this->_sListDisplayType = in_array( ( string ) $this->_sListDisplayType, $this->_aListDisplayTypes ) ? $this->_sListDisplayType : 'infogrid';
00747 
00748             // writing to session
00749             if ( oxConfig::getParameter( 'ldtype' ) ) {
00750                 oxSession::setVar( 'ldtype', $this->_sListDisplayType );
00751             }
00752         }
00753         return $this->_sListDisplayType;
00754     }
00755 
00761     public function getCustomListDisplayType()
00762     {
00763         if ( $this->_sCustomListDisplayType == null ) {
00764             $this->_sCustomListDisplayType = oxConfig::getParameter( 'ldtype' );
00765 
00766             if ( !$this->_sCustomListDisplayType ) {
00767                 $this->_sCustomListDisplayType = oxSession::getVar( 'ldtype' );
00768             }
00769         }
00770         return $this->_sCustomListDisplayType;
00771     }
00772 
00780     public function setListType( $sType )
00781     {
00782         $this->_sListType = $sType;
00783         $this->getConfig()->setGlobalParameter( 'listtype', $sType );
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 dontShowEmptyCategories()
00808     {
00809         if ( $this->_blDontShowEmptyCats == null ) {
00810             $this->_blDontShowEmptyCats = false;
00811             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00812                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00813             }
00814         }
00815         return $this->_blDontShowEmptyCats;
00816     }
00817 
00823     public function showCategoryArticlesCount()
00824     {
00825         return $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' );
00826     }
00827 
00833     public function isLanguageLoaded()
00834     {
00835         if ( $this->_blLoadLanguage == null ) {
00836             $this->_blLoadLanguage = false;
00837             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00838                 $this->_blLoadLanguage = $blLoadLanguage;
00839             }
00840         }
00841         return $this->_blLoadLanguage;
00842     }
00843 
00849     public function getTopNavigationCatCnt()
00850     {
00851         if ( $this->_iTopCatNavItmCnt == null ) {
00852             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00853             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00854         }
00855         return $this->_iTopCatNavItmCnt;
00856     }
00857 
00867     public function addRssFeed($sTitle, $sUrl, $key = null)
00868     {
00869         if (!is_array($this->_aRssLinks)) {
00870             $this->_aRssLinks = array();
00871         }
00872         if ($key === null) {
00873             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00874         } else {
00875             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00876         }
00877     }
00878 
00884     public function getSortOrderByParameterName()
00885     {
00886         return 'listorderby';
00887     }
00888 
00894     public function getSortOrderParameterName()
00895     {
00896         return 'listorder';
00897     }
00898 
00909     public function prepareSortColumns()
00910     {
00911         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00912         $aSortDir = array( 'desc', 'asc' );
00913         if ( count( $aSortColumns ) > 0 ) {
00914 
00915             $this->_blActiveSorting = true;
00916             $this->_aSortColumns = $aSortColumns;
00917 
00918             $sCnid = oxConfig::getParameter( 'cnid' );
00919 
00920 
00921             $sSortBy  = oxConfig::getParameter( $this->getSortOrderByParameterName() );
00922             $sSortDir = oxConfig::getParameter( $this->getSortOrderParameterName() );
00923 
00924             $oStr = getStr();
00925             if ( (!$sSortBy || !in_array( $oStr->strtolower($sSortBy), $aSortColumns) || !in_array( $oStr->strtolower($sSortDir), $aSortDir) ) && $aSorting = $this->getSorting( $sCnid ) ) {
00926                 $sSortBy  = $aSorting['sortby'];
00927                 $sSortDir = $aSorting['sortdir'];
00928             }
00929 
00930             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00931                  $sSortDir && oxRegistry::getUtils()->isValidAlpha( $sSortDir ) ) {
00932 
00933                 $this->_sListOrderBy  = $sSortBy;
00934                 $this->_sListOrderDir = $sSortDir;
00935 
00936                 // caching sorting config
00937                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00938             }
00939         }
00940     }
00941 
00947     public function getListOrderBy()
00948     {
00949         //if column is with table name split it
00950         $aColums = explode('.', $this->_sListOrderBy);
00951 
00952         if ( is_array($aColums) && count($aColums) > 1 ) {
00953            return $aColums[1];
00954         }
00955 
00956         return $this->_sListOrderBy;
00957     }
00958 
00964     public function getListOrderDirection()
00965     {
00966         return $this->_sListOrderDir;
00967     }
00968 
00976     public function setMetaDescription ( $sDescription )
00977     {
00978         return $this->_sMetaDescription = $sDescription;
00979     }
00980 
00988     public function setMetaKeywords( $sKeywords )
00989     {
00990         return $this->_sMetaKeywords = $sKeywords;
00991     }
00992 
01000     protected function _getMetaFromSeo( $sDataType )
01001     {
01002         $sOxid  = $this->_getSeoObjectId();
01003         $iLang  = oxRegistry::getLang()->getBaseLanguage();
01004         $sShop  = $this->getConfig()->getShopId();
01005 
01006         if ( $sOxid && oxRegistry::getUtils()->seoIsActive() &&
01007              ( $sKeywords = oxRegistry::get("oxSeoEncoder")->getMetaData( $sOxid, $sDataType, $sShop, $iLang) ) ) {
01008             return $sKeywords;
01009         }
01010     }
01011 
01019     protected function _getMetaFromContent( $sMetaIdent )
01020     {
01021         if ( $sMetaIdent ) {
01022             $oContent = oxNew( 'oxcontent' );
01023             if ( $oContent->loadByIdent( $sMetaIdent ) &&
01024                  $oContent->oxcontents__oxactive->value ) {
01025                 return strip_tags( $oContent->oxcontents__oxcontent->value );
01026             }
01027         }
01028     }
01029 
01035     public function getMetaKeywords()
01036     {
01037         if ( $this->_sMetaKeywords === null ) {
01038             $this->_sMetaKeywords = false;
01039 
01040             // set special meta keywords ?
01041             if ( ( $sKeywords = $this->_getMetaFromSeo( 'oxkeywords' ) ) ) {
01042                 $this->_sMetaKeywords = $sKeywords;
01043             } elseif ( ( $sKeywords = $this->_getMetaFromContent( $this->_sMetaKeywordsIdent ) ) ) {
01044                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( $sKeywords, false );
01045             } else {
01046                 $this->_sMetaKeywords = $this->_prepareMetaKeyword( false, true );
01047             }
01048         }
01049 
01050         return $this->_sMetaKeywords;
01051     }
01052 
01058     public function getMetaDescription()
01059     {
01060         if ( $this->_sMetaDescription === null ) {
01061             $this->_sMetaDescription = false;
01062 
01063             // set special meta description ?
01064             if ( ( $sDescription = $this->_getMetaFromSeo( 'oxdescription' ) ) ) {
01065                 $this->_sMetaDescription = $sDescription;
01066             } elseif ( ( $sDescription = $this->_getMetaFromContent( $this->_sMetaDescriptionIdent ) ) ) {
01067                 $this->_sMetaDescription = $this->_prepareMetaDescription( $sDescription );
01068             } else {
01069                 $this->_sMetaDescription = $this->_prepareMetaDescription( false );
01070             }
01071         }
01072 
01073         return $this->_sMetaDescription;
01074     }
01075 
01081     public function getActCurrency()
01082     {
01083         return $this->_oActCurrency;
01084     }
01085 
01093     public function setActCurrency( $oCur )
01094     {
01095         $this->_oActCurrency = $oCur;
01096     }
01097 
01103     public function getCompareItemCount()
01104     {
01105         if ( $this->_iCompItemsCnt === null ) {
01106             $aItems = oxSession::getVar('aFiltcompproducts');
01107             $this->_iCompItemsCnt = is_array($aItems)?count($aItems):0;
01108         }
01109         return $this->_iCompItemsCnt;
01110     }
01111 
01117     protected function _forceNoIndex()
01118     {
01119         $this->_blForceNoIndex = true;
01120     }
01121 
01128     public function noIndex()
01129     {
01130         if ( $this->_blForceNoIndex ) {
01131             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01132         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01133             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01134         } else {
01135             switch ( oxConfig::getParameter( 'fnc' ) ) {
01136                 case 'tocomparelist':
01137                 case 'tobasket':
01138                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01139                     break;
01140             }
01141         }
01142         return $this->_iViewIndexState;
01143     }
01144 
01150     public function isSortingActive()
01151     {
01152         return $this->_blActiveSorting;
01153     }
01154 
01160     public function getMenueList()
01161     {
01162         return $this->_aMenueList;
01163     }
01164 
01172     public function setMenueList( $aMenue )
01173     {
01174         $this->_aMenueList = $aMenue;
01175     }
01176 
01177 
01183     protected function _setNrOfArtPerPage()
01184     {
01185         $myConfig  = $this->getConfig();
01186 
01187         //setting default values to avoid possible errors showing article list
01188         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01189 
01190         $iNrofCatArticles = ( $iNrofCatArticles ) ? $iNrofCatArticles : 10;
01191 
01192         // checking if all needed data is set
01193         switch ( $this->getListDisplayType() ) {
01194             case 'grid':
01195                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticlesInGrid' );
01196                 break;
01197             case 'line':
01198             case 'infogrid':
01199             default:
01200                 $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01201         }
01202 
01203         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01204             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01205         } else {
01206             $iNrofCatArticles = $aNrofCatArticles[0];
01207         }
01208 
01209         $oViewConf = $this->getViewConfig();
01210         //value from user input
01211         if ( ( $iNrofArticles = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01212             // M45 Possibility to push any "Show articles per page" number parameter
01213             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01214             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01215             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01216         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01217             // M45 Possibility to push any "Show articles per page" number parameter
01218             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01219             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01220             $iNrofCatArticles = $iSessArtPerPage;
01221         } else {
01222             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01223         }
01224 
01225         //setting number of articles per page to config value
01226         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01227     }
01228 
01234     protected function _getSeoObjectId()
01235     {
01236     }
01237 
01247     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false )
01248     {
01249         if ( $sMeta ) {
01250 
01251             $oStr = getStr();
01252             if ( $iLength != -1 ) {
01253                 /* *
01254                  * performance - we dont need a huge amount of initial text.
01255                  * assume that effective text may be double longer than $iLength
01256                  * and simple turncate it
01257                  */
01258                 $iELength = ( $iLength * 2 );
01259                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01260             }
01261 
01262             // decoding html entities
01263             $sMeta = $oStr->html_entity_decode( $sMeta );
01264             // stripping HTML tags
01265             $sMeta = strip_tags( $sMeta );
01266 
01267             // removing some special chars
01268             $sMeta = $oStr->cleanStr( $sMeta );
01269 
01270             // removing duplicate words
01271             if ( $blRemoveDuplicatedWords ) {
01272                 $sMeta = $this->_removeDuplicatedWords( $sMeta, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01273             }
01274 
01275             // some special cases
01276             $sMeta = str_replace( ' ,', ',', $sMeta );
01277             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01278             $sMeta = $oStr->preg_replace( $aPattern, ',', $sMeta );
01279             $sMeta = oxRegistry::get("oxUtilsString")->minimizeTruncateString( $sMeta, $iLength );
01280             $sMeta = $oStr->htmlspecialchars( $sMeta );
01281 
01282             return trim( $sMeta );
01283         }
01284     }
01285 
01294     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
01295     {
01296 
01297         $sString = $this->_prepareMetaDescription( $sKeywords, -1, false );
01298 
01299         if ( $blRemoveDuplicatedWords ) {
01300             $sString = $this->_removeDuplicatedWords( $sString, $this->getConfig()->getConfigParam( 'aSkipTags' ) );
01301         }
01302 
01303         // removing in admin defined strings
01304 
01305         /*if ( is_array( $aSkipTags ) && $sString ) {
01306             $oStr = getStr();
01307             foreach ( $aSkipTags as $sSkip ) {
01308                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01309                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01310                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01311                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01312             }
01313         }*/
01314 
01315         return trim( $sString );
01316     }
01317 
01326     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01327     {
01328         $oStr = getStr();
01329         if ( is_array( $aInput ) ) {
01330             $aInput = implode( " ", $aInput );
01331         }
01332 
01333         // removing some usually met characters..
01334         $aInput = $oStr->preg_replace( "/[".preg_quote( $this->_sRemoveMetaChars, "/" )."]/", " ", $aInput );
01335 
01336         // splitting by word
01337         $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01338 
01339         if ( $sCount = count( $aSkipTags ) ) {
01340             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01341                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01342             }
01343         }
01344         $sCount = count($aStrings);
01345         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01346             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01347             // removing in admin defined strings
01348             if ( !$aStrings[$iNum] || in_array( $aStrings[$iNum], $aSkipTags ) ) {
01349                 unset( $aStrings[$iNum] );
01350             }
01351         }
01352 
01353         // duplicates
01354         return implode( ', ', array_unique( $aStrings ) );
01355     }
01356 
01364     public function getNavigationParams()
01365     {
01366         $aParams['cnid'] = $this->getCategoryId();
01367         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01368 
01369         $aParams['listtype'] = $this->getListType();
01370         $aParams['ldtype'] = $this->getCustomListDisplayType();
01371         $aParams['actcontrol'] = $this->getClassName();
01372 
01373         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01374 
01375         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01376         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01377         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01378 
01379         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01380         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01381         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01382 
01383         return $aParams;
01384     }
01385 
01395     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01396     {
01397 
01398         $aSorting = oxSession::getVar( 'aSorting' );
01399         $aSorting[$sCnid]['sortby']  = $sSortBy;
01400         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01401 
01402         oxSession::setVar( 'aSorting', $aSorting );
01403     }
01404 
01412     public function getSorting( $sCnid )
01413     {
01414         $aSorting = oxSession::getVar( 'aSorting' );
01415 
01416         if ( isset( $aSorting[$sCnid] ) ) {
01417             return $aSorting[$sCnid];
01418         }
01419     }
01420 
01428     public function getSortingSql( $sCnid )
01429     {
01430         $aSorting = $this->getSorting( $sCnid );
01431         if ( is_array( $aSorting ) ) {
01432             return implode( " ", $aSorting );
01433         }
01434     }
01435 
01441     public function getTitleSuffix()
01442     {
01443         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01444     }
01445 
01451     public function getTitlePageSuffix()
01452     {
01453     }
01454 
01461     public function getTitlePrefix()
01462     {
01463         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01464     }
01465 
01466 
01467 
01476     protected function _getSubject( $iLang )
01477     {
01478         return null;
01479     }
01480 
01486     public function getDynUrlParams()
01487     {
01488         $sRet = '';
01489         $sListType = $this->getListType();
01490 
01491         switch ($sListType) {
01492             default:
01493                 break;
01494             case 'search':
01495                 $sRet .= "&amp;listtype={$sListType}";
01496                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01497                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01498                 }
01499 
01500                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid', true ) ) ) {
01501                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01502                 }
01503                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor', true ) ) ) {
01504                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01505                 }
01506                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer', true ) ) ) {
01507                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01508                 }
01509                 break;
01510             case 'tag':
01511                 $sRet .= "&amp;listtype={$sListType}";
01512                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', true ) ) ) {
01513                     $sRet .= "&amp;searchtag={$sParam}";
01514                 }
01515                 break;
01516         }
01517 
01518         return $sRet;
01519     }
01520 
01528     public function getLink( $iLang = null )
01529     {
01530         if ( !isset( $iLang ) ) {
01531             $iLang = oxRegistry::getLang()->getBaseLanguage();
01532         }
01533 
01534         $oDisplayObj = null;
01535         $blTrySeo = false;
01536         if ( oxRegistry::getUtils()->seoIsActive() ) {
01537             $blTrySeo = true;
01538             $oDisplayObj = $this->_getSubject( $iLang );
01539         }
01540         $iActPageNr = $this->getActPage();
01541 
01542         if ( $oDisplayObj ) {
01543             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01544         }
01545 
01546         $myConfig = $this->getConfig();
01547 
01548         if ( $blTrySeo ) {
01549             $oEncoder = oxRegistry::get("oxSeoEncoder");
01550             if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01551                 return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01552             }
01553         }
01554 
01555         $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams(), true, null, $iLang);
01556 
01557         // fallback to old non seo url
01558         return $this->_addPageNrParam( $sUrl, $iActPageNr, $iLang );
01559     }
01560 
01566     public function getCanonicalUrl()
01567     {
01568     }
01569 
01576     public function getSimilarRecommListIds()
01577     {
01578         return false;
01579     }
01586     public function getSearchParamForHtml()
01587     {
01588     }
01589 
01597     protected function _getRequestParams( $blAddPageNr  = true )
01598     {
01599         $sClass = $this->getClassName();
01600         $sFnc   = $this->getFncName();
01601 
01602         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright' );
01603         if ( in_array( $sFnc, $aFnc ) ) {
01604             $sFnc = '';
01605         }
01606 
01607         // #680
01608         $sURL = "cl={$sClass}";
01609         if ( $sFnc ) {
01610             $sURL .= "&amp;fnc={$sFnc}";
01611         }
01612         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01613             $sURL .= "&amp;cnid={$sVal}";
01614         }
01615         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01616             $sURL .= "&amp;mnid={$sVal}";
01617         }
01618         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01619             $sURL .= "&amp;anid={$sVal}";
01620         }
01621 
01622         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01623             $sURL .= "&amp;page={$sVal}";
01624         }
01625 
01626         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01627             $sURL .= "&amp;tpl={$sVal}";
01628         }
01629 
01630         if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01631             $sURL .= "&amp;oxloadid={$sVal}";
01632         }
01633 
01634         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01635         // don't include page number for navigation
01636         // it will be done in oxubase::generatePageNavigation
01637         if ( $blAddPageNr && $iPgNr > 0 ) {
01638             $sURL .= "&amp;pgNr={$iPgNr}";
01639         }
01640 
01641         // #1184M - specialchar search
01642         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01643             $sURL .= "&amp;searchparam={$sVal}";
01644         }
01645 
01646         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01647             $sURL .= "&amp;searchcnid={$sVal}";
01648         }
01649 
01650         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01651             $sURL .= "&amp;searchvendor={$sVal}";
01652         }
01653 
01654         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01655             $sURL .= "&amp;searchmanufacturer={$sVal}";
01656         }
01657 
01658         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01659             $sURL .= "&amp;searchrecomm={$sVal}";
01660         }
01661 
01662         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01663             $sURL .= "&amp;searchtag={$sVal}";
01664         }
01665 
01666         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01667             $sURL .= "&amp;recommid={$sVal}";
01668         }
01669 
01670         return $sURL;
01671     }
01672 
01678     protected function _getSeoRequestParams()
01679     {
01680         $sClass = $this->getClassName();
01681         $sFnc   = $this->getFncName();
01682 
01683         // #921 S
01684         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01685         if ( in_array( $sFnc, $aFnc ) ) {
01686             $sFnc = '';
01687         }
01688 
01689         // #680
01690         $sURL = "cl={$sClass}";
01691         if ( $sFnc ) {
01692             $sURL .= "&amp;fnc={$sFnc}";
01693         }
01694         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01695             $sURL .= "&amp;page={$sVal}";
01696         }
01697 
01698         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01699             $sURL .= "&amp;tpl={$sVal}";
01700         }
01701 
01702         if ( $sVal = oxConfig::getParameter( 'oxloadid' ) ) {
01703             $sURL .= "&amp;oxloadid={$sVal}";
01704         }
01705 
01706         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01707         if ( $iPgNr > 0 ) {
01708             $sURL .= "&amp;pgNr={$iPgNr}";
01709         }
01710 
01711         return $sURL;
01712     }
01713 
01719     public function showSearch()
01720     {
01721         $blShow = true;
01722         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01723             $blShow = false;
01724         }
01725         return (int) $blShow;
01726     }
01727 
01733     public function getRssLinks()
01734     {
01735         return $this->_aRssLinks;
01736     }
01737 
01743     public function getSortColumns()
01744     {
01745         return $this->_aSortColumns;
01746     }
01747 
01753     public function getEditTags()
01754     {
01755     }
01756 
01762     public function getRecommSearch()
01763     {
01764     }
01765 
01771     public function getPaymentList()
01772     {
01773     }
01774 
01780     public function getActiveRecommList()
01781     {
01782         if ( $this->_oActiveRecommList === null ) {
01783             $this->_oActiveRecommList = false;
01784             if ( $sOxid = oxConfig::getParameter( 'recommid' ) ) {
01785                 $this->_oActiveRecommList = oxNew( 'oxrecommlist' );
01786                 $this->_oActiveRecommList->load( $sOxid );
01787             }
01788         }
01789         return $this->_oActiveRecommList;
01790     }
01791 
01797     public function getAccessoires()
01798     {
01799     }
01800 
01806     public function getCrossSelling()
01807     {
01808     }
01809 
01815     public function getSimilarProducts()
01816     {
01817     }
01818 
01824     public function getAlsoBoughtTheseProducts()
01825     {
01826     }
01827 
01833     public function getArticleId()
01834     {
01835     }
01836 
01842     public function isMoreTagsVisible()
01843     {
01844         return false;
01845     }
01846 
01852     public function getTitle()
01853     {
01854     }
01855 
01861     public function getActiveLangAbbr()
01862     {
01863         // Performance
01864         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01865             return;
01866         }
01867 
01868         if ( !isset($this->_sActiveLangAbbr ) ) {
01869             $aLanguages = oxRegistry::getLang()->getLanguageArray();
01870             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01871                 if ( $oVal->selected ) {
01872                     $this->_sActiveLangAbbr = $oVal->abbr;
01873                     break;
01874                 }
01875             }
01876         }
01877 
01878         return $this->_sActiveLangAbbr;
01879     }
01880 
01888     public function addGlobalParams( $oShop = null)
01889     {
01890         $oViewConf = parent::addGlobalParams( $oShop );
01891 
01892         $this->_setNrOfArtPerPage();
01893 
01894         return $oViewConf;
01895     }
01896 
01902     public function getAdditionalParams()
01903     {
01904         if ( $this->_sAdditionalParams === null ) {
01905             // #1018A
01906             $this->_sAdditionalParams  = parent::getAdditionalParams();
01907             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01908 
01909             // #1834M - specialchar search
01910             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01911             if ( isset( $sSearchParamForLink ) ) {
01912                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01913             }
01914             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01915                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01916             }
01917             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01918                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01919             }
01920             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01921                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01922             }
01923             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01924                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01925             }
01926             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
01927                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
01928             }
01929             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
01930                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
01931             }
01932         }
01933 
01934         return $this->_sAdditionalParams;
01935     }
01936 
01942     public function generatePageNavigationUrl()
01943     {
01944         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
01945     }
01946 
01956     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
01957     {
01958         if ( $iPage ) {
01959             if ( ( strpos( $sUrl, 'pgNr=' ) ) ) {
01960                 $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr='.$iPage, $sUrl);
01961             } else {
01962                 $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
01963             }
01964         } else {
01965            $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
01966            $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
01967            $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
01968            $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
01969         }
01970         return $sUrl;
01971     }
01972 
01978     public function getPageNavigation()
01979     {
01980 
01981     }
01982 
01988     public function getPageNavigationLimitedTop()
01989     {
01990 
01991         $this->_oPageNavigation = $this->generatePageNavigation( 7 );
01992 
01993         return $this->_oPageNavigation;
01994     }
01995 
02001     public function getPageNavigationLimitedBottom()
02002     {
02003 
02004         $this->_oPageNavigation = $this->generatePageNavigation( 11 );
02005 
02006         return $this->_oPageNavigation;
02007     }
02008 
02009 
02017     public function generatePageNavigation( $iPositionCount = 0 )
02018     {
02019         startProfile('generatePageNavigation');
02020 
02021         $pageNavigation = new stdClass();
02022 
02023         $pageNavigation->NrOfPages = $this->_iCntPages;
02024         $iActPage = $this->getActPage();
02025         $pageNavigation->actPage   = $iActPage + 1;
02026         $sUrl = $this->generatePageNavigationUrl();
02027 
02028         if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
02029              $iStartNo = 2;
02030              $iFinishNo = $pageNavigation->NrOfPages;
02031              $bStart = false;
02032              $bFinish =false;
02033         } else {
02034             $iTmpVal = $iPositionCount - 3;
02035             $iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
02036 
02037             // actual page is at the start
02038             if ( $pageNavigation->actPage <= $iTmpVal ) {
02039                 $iStartNo = 2;
02040                 $iFinishNo = $iTmpVal + 1;
02041                 $bStart = false;
02042                 $bFinish = true;
02043             // actual page is at the end
02044             } elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
02045                 $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
02046                 $iFinishNo = $pageNavigation->NrOfPages - 1;
02047                 $bStart = true;
02048                 $bFinish = false;
02049             // actual page is in the midle
02050             } else {
02051                 $iStartNo = $pageNavigation->actPage - $iTmpVal2;
02052                 $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
02053                 $bStart = true;
02054                 $bFinish = true;
02055             }
02056         }
02057 
02058         if ( $iActPage > 0) {
02059             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02060         }
02061 
02062         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02063             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02064         }
02065 
02066         if ( $pageNavigation->NrOfPages > 1 ) {
02067 
02068             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02069 
02070                 if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
02071                     $page = new stdClass();
02072                     $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02073                     $page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
02074                     $pageNavigation->changePage[$i] = $page;
02075                 }
02076             }
02077 
02078             // first/last one
02079             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02080             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02081         }
02082 
02083         stopProfile('generatePageNavigation');
02084 
02085         return $pageNavigation;
02086     }
02087 
02094     public function render()
02095     {
02096         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02097             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02098         }
02099 
02100         parent::render();
02101 
02102         if ( $this->getIsOrderStep() ) {
02103 
02104             // disabling navigation during order ...
02105             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02106                 $this->_iNewsRealStatus = 1;
02107                 $this->setShowNewsletter( 0 );
02108             }
02109         }
02110         return $this->_sThisTemplate;
02111     }
02112 
02118     public function getViewProduct()
02119     {
02120         return $this->getProduct();
02121     }
02122 
02130     public function setViewProduct( $oProduct )
02131     {
02132         $this->_oProduct = $oProduct;
02133     }
02134 
02140     public function getViewProductList()
02141     {
02142         return $this->_aArticleList;
02143     }
02144 
02150     public function getActPage()
02151     {
02152         if ( $this->_iActPage === null ) {
02153             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02154             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02155         }
02156         return $this->_iActPage;
02157     }
02158 
02166     public function getActTag()
02167     {
02168         if ( $this->_oActTag === null ) {
02169             $this->_oActTag = new stdClass();
02170             $this->_oActTag->sTag = $sTag = oxConfig::getParameter("searchtag", 1);
02171             $oSeoEncoderTag = oxRegistry::get("oxSeoEncoderTag");
02172 
02173             $sLink = false;
02174             if ( oxRegistry::getUtils()->seoIsActive() ) {
02175                 $sLink = $oSeoEncoderTag->getTagUrl( $sTag, oxRegistry::getLang()->getBaseLanguage() );
02176             }
02177 
02178             $this->_oActTag->link = $sLink ? $sLink : $this->getConfig()->getShopHomeURL().$oSeoEncoderTag->getStdTagUri( $sTag, false );
02179         }
02180         return $this->_oActTag;
02181     }
02182 
02190     public function getActVendor()
02191     {
02192         // if active vendor is not set yet - trying to load it from request params
02193         // this may be usefull when category component was unable to load active vendor
02194         // and we still need some object to mount navigation info
02195         if ( $this->_oActVendor === null ) {
02196             $this->_oActVendor = false;
02197             $sVendorId = oxConfig::getParameter( 'cnid' );
02198             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02199             $oVendor = oxNew( 'oxvendor' );
02200             if ( $oVendor->load( $sVendorId ) ) {
02201                 $this->_oActVendor = $oVendor;
02202             }
02203         }
02204 
02205         return $this->_oActVendor;
02206     }
02207 
02215     public function getActManufacturer()
02216     {
02217         // if active Manufacturer is not set yet - trying to load it from request params
02218         // this may be usefull when category component was unable to load active Manufacturer
02219         // and we still need some object to mount navigation info
02220         if ( $this->_oActManufacturer === null ) {
02221 
02222             $this->_oActManufacturer = false;
02223             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02224             $oManufacturer = oxNew( 'oxmanufacturer' );
02225             if ( $oManufacturer->load( $sManufacturerId ) ) {
02226                 $this->_oActManufacturer = $oManufacturer;
02227             }
02228         }
02229 
02230         return $this->_oActManufacturer;
02231     }
02232 
02240     public function setActVendor( $oVendor )
02241     {
02242         $this->_oActVendor = $oVendor;
02243     }
02244 
02252     public function setActManufacturer( $oManufacturer )
02253     {
02254         $this->_oActManufacturer = $oManufacturer;
02255     }
02256 
02262     public function getActSearch()
02263     {
02264         if ( $this->_oActSearch === null ) {
02265             $this->_oActSearch = new stdClass();
02266             $sUrl = $this->getConfig()->getShopHomeURL();
02267             $this->_oActSearch->link = "{$sUrl}cl=search";
02268         }
02269         return $this->_oActSearch;
02270     }
02271 
02277     public function getCategoryTree()
02278     {
02279         return $this->_oCategoryTree;
02280     }
02281 
02289     public function setCategoryTree( $oCatTree )
02290     {
02291         $this->_oCategoryTree = $oCatTree;
02292     }
02293 
02299     public function getManufacturerTree()
02300     {
02301         return $this->_oManufacturerTree;
02302     }
02303 
02311     public function setManufacturerTree( $oManufacturerTree )
02312     {
02313         $this->_oManufacturerTree = $oManufacturerTree;
02314     }
02315 
02321     public function getAddUrlParams()
02322     {
02323     }
02324 
02331     public function getTop5ArticleList()
02332     {
02333         if ( $this->_blTop5Action ) {
02334             if ( $this->_aTop5ArticleList === null ) {
02335                 $this->_aTop5ArticleList = false;
02336                 $myConfig = $this->getConfig();
02337                 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02338                     // top 5 articles
02339                     $oArtList = oxNew( 'oxarticlelist' );
02340                     $oArtList->loadTop5Articles();
02341                     if ( $oArtList->count() ) {
02342                         $this->_aTop5ArticleList = $oArtList;
02343                     }
02344                 }
02345             }
02346         }
02347         return $this->_aTop5ArticleList;
02348     }
02349 
02356     public function getBargainArticleList()
02357     {
02358         if ( $this->_blBargainAction ) {
02359             if ( $this->_aBargainArticleList === null ) {
02360                 $this->_aBargainArticleList = array();
02361                 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02362                     $oArtList = oxNew( 'oxarticlelist' );
02363                     $oArtList->loadAktionArticles( 'OXBARGAIN' );
02364                     if ( $oArtList->count() ) {
02365                         $this->_aBargainArticleList = $oArtList;
02366                     }
02367                 }
02368             }
02369         }
02370         return $this->_aBargainArticleList;
02371     }
02372 
02379     public function isLowOrderPrice()
02380     {
02381         if ( $this->_blLowOrderPrice === null && ( $oBasket = $this->getSession()->getBasket() ) ) {
02382             $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
02383         }
02384 
02385         return $this->_blLowOrderPrice;
02386     }
02387 
02393     public function getMinOrderPrice()
02394     {
02395         if ( $this->_sMinOrderPrice === null && $this->isLowOrderPrice() ) {
02396             $dMinOrderPrice = oxPrice::getPriceInActCurrency( $this->getConfig()->getConfigParam( 'iMinOrderPrice' ) );
02397             $this->_sMinOrderPrice = oxRegistry::getLang()->formatCurrency( $dMinOrderPrice );
02398         }
02399         return $this->_sMinOrderPrice;
02400     }
02401 
02407     public function getNewsRealStatus()
02408     {
02409         return $this->_iNewsRealStatus;
02410     }
02411 
02417     protected function _canRedirect()
02418     {
02419         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02420             if ( oxConfig::getParameter( $sParam ) !== null ) {
02421                 return false;
02422             }
02423         }
02424 
02425         return true;
02426     }
02427 
02433     public function getProduct()
02434     {
02435     }
02436 
02442     public function getManufacturerlist()
02443     {
02444         return $this->_aManufacturerlist;
02445     }
02446 
02454     public function setManufacturerlist( $aList )
02455     {
02456         $this->_aManufacturerlist = $aList;
02457     }
02458 
02466     public function setRootVendor( $oVendor )
02467     {
02468         $this->_oRootVendor = $oVendor;
02469     }
02470 
02476     public function getRootVendor()
02477     {
02478         return $this->_oRootVendor;
02479     }
02480 
02488     public function setRootManufacturer( $oManufacturer )
02489     {
02490         $this->_oRootManufacturer = $oManufacturer;
02491     }
02492 
02498     public function getRootManufacturer()
02499     {
02500         return $this->_oRootManufacturer;
02501     }
02502 
02508     public function getVendorId()
02509     {
02510         if ( $this->_sVendorId === null ) {
02511             $this->_sVendorId = false;
02512             if ( ( $oVendor = $this->getActVendor() ) ) {
02513                 $this->_sVendorId = $oVendor->getId();
02514             }
02515         }
02516         return $this->_sVendorId;
02517     }
02518 
02524     public function getManufacturerId()
02525     {
02526         if ( $this->_sManufacturerId === null ) {
02527             $this->_sManufacturerId = false;
02528             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02529                 $this->_sManufacturerId = $oManufacturer->getId();
02530             }
02531         }
02532         return $this->_sManufacturerId;
02533     }
02534 
02540     public function getSearchCatTree()
02541     {
02542         return $this->_aSearchCatTree;
02543     }
02544 
02552     public function setSearchCatTree( $aTree )
02553     {
02554         $this->_aSearchCatTree = $aTree;
02555     }
02556 
02562     public function getCatMoreUrl()
02563     {
02564         return $this->getConfig()->getShopHomeURL().'cnid=oxmore';
02565     }
02566 
02572     public function getCatTreePath()
02573     {
02574         return $this->_sCatTreePath;
02575     }
02576 
02584     public function getContentByIdent( $sIdent )
02585     {
02586         if ( !isset( $this->_aContents[$sIdent] ) ) {
02587             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02588             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02589         }
02590         return $this->_aContents[$sIdent];
02591     }
02592 
02598     public function getContentCategory()
02599     {
02600         return false;
02601     }
02602 
02608     public function getMustFillFields()
02609     {
02610         if ( $this->_aMustFillFields === null ) {
02611             $this->_aMustFillFields = false;
02612 
02613             // passing must-be-filled-fields info
02614             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
02615             if ( is_array( $aMustFillFields ) ) {
02616                 $this->_aMustFillFields = array_flip( $aMustFillFields );
02617             }
02618         }
02619         return $this->_aMustFillFields;
02620     }
02621 
02629     public function isFieldRequired( $sField )
02630     {
02631         if ( $aMustFillFields = $this->getMustFillFields() ) {
02632             if ( isset( $aMustFillFields[$sField] ) ) {
02633                 return true;
02634             }
02635         }
02636 
02637         return false;
02638     }
02639 
02645     public function getFormId()
02646     {
02647         if ( $this->_sFormId === null ) {
02648             $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
02649             oxSession::setVar( 'sessionuformid', $this->_sFormId );
02650         }
02651 
02652         return $this->_sFormId;
02653     }
02654 
02660     public function canAcceptFormData()
02661     {
02662         if ( $this->_blCanAcceptFormData === null ) {
02663             $this->_blCanAcceptFormData = false;
02664 
02665             $sFormId = oxConfig::getParameter( "uformid" );
02666             $sSessionFormId = oxSession::getVar( "sessionuformid" );
02667 
02668             // testing if form and session ids matches
02669             if ( $sFormId && $sFormId === $sSessionFormId ) {
02670                 $this->_blCanAcceptFormData = true;
02671             }
02672 
02673             // regenerating form data
02674             $this->getFormId();
02675         }
02676         return $this->_blCanAcceptFormData;
02677     }
02678 
02684     public function getPromoFinishedList()
02685     {
02686         if (isset($this->_oPromoFinishedList)) {
02687             return $this->_oPromoFinishedList;
02688         }
02689         $this->_oPromoFinishedList = oxNew( 'oxActionList' );
02690         $this->_oPromoFinishedList->loadFinishedByCount(2);
02691         return $this->_oPromoFinishedList;
02692     }
02693 
02699     public function getPromoCurrentList()
02700     {
02701         if (isset($this->_oPromoCurrentList)) {
02702             return $this->_oPromoCurrentList;
02703         }
02704         $this->_oPromoCurrentList = oxNew( 'oxActionList' );
02705         $this->_oPromoCurrentList->loadCurrent();
02706         return $this->_oPromoCurrentList;
02707     }
02708 
02714     public function getPromoFutureList()
02715     {
02716         if (isset($this->_oPromoFutureList)) {
02717             return $this->_oPromoFutureList;
02718         }
02719         $this->_oPromoFutureList = oxNew( 'oxActionList' );
02720         $this->_oPromoFutureList->loadFutureByCount(2);
02721         return $this->_oPromoFutureList;
02722     }
02723 
02729     public function getShowPromotionList()
02730     {
02731         if (isset($this->_blShowPromotions)) {
02732             return $this->_blShowPromotions;
02733         }
02734         $this->_blShowPromotions = false;
02735         if (oxNew('oxActionList')->areAnyActivePromotions()) {
02736             $this->_blShowPromotions = ( count( $this->getPromoFinishedList() ) + count( $this->getPromoCurrentList() ) + count( $this->getPromoFutureList() ) ) > 0;
02737         }
02738         return $this->_blShowPromotions;
02739     }
02740 
02746     public function isEnabledPrivateSales()
02747     {
02748         if ( $this->_blEnabledPrivateSales === null ) {
02749             $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam( 'blPsLoginEnabled' );
02750             if ( $this->_blEnabledPrivateSales && ( $blCanPreview = oxRegistry::getUtils()->canPreview() ) !== null ) {
02751                 $this->_blEnabledPrivateSales = !$blCanPreview;
02752             }
02753         }
02754         return $this->_blEnabledPrivateSales;
02755     }
02756 
02762     public function getFieldValidationErrors()
02763     {
02764         return oxRegistry::get("oxInputValidator")->getFieldValidationErrors();
02765     }
02766 
02772     public function getBreadCrumb()
02773     {
02774         return null;
02775     }
02776 
02784     public function setRootCatChanged( $blRootCatChanged )
02785     {
02786         $this->_blRootCatChanged = $blRootCatChanged;
02787     }
02788 
02794     public function isRootCatChanged()
02795     {
02796         return $this->_blRootCatChanged;
02797     }
02798 
02804     public function getInvoiceAddress()
02805     {
02806         if ( $this->_aInvoiceAddress == null ) {
02807             $aAddress = oxConfig::getParameter( 'invadr');
02808             if ( $aAddress ) {
02809                 $this->_aInvoiceAddress = $aAddress;
02810             }
02811         }
02812         return $this->_aInvoiceAddress;
02813     }
02814 
02820     public function getDeliveryAddress()
02821     {
02822         if ( $this->_aDeliveryAddress == null ) {
02823             $aAddress = oxConfig::getParameter( 'deladr');
02824             //do not show deladr if address was reloaded
02825             if ( $aAddress && !oxConfig::getParameter( 'reloadaddress' )) {
02826                 $this->_aDeliveryAddress = $aAddress;
02827             }
02828         }
02829         return $this->_aDeliveryAddress;
02830     }
02831 
02839     public function setInvoiceAddress( $aAddress )
02840     {
02841         $this->_aInvoiceAddress = $aAddress;
02842     }
02843 
02849     public function getActiveUsername()
02850     {
02851         if ( $this->_sActiveUsername == null ) {
02852             $this->_sActiveUsername = false;
02853             $sUsername = oxConfig::getParameter( 'lgn_usr' );
02854             if ( $sUsername ) {
02855                 $this->_sActiveUsername = $sUsername;
02856             } elseif ( $oUser = $this->getUser() ) {
02857                 $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
02858             }
02859         }
02860         return $this->_sActiveUsername;
02861     }
02862 
02868     public function getWishlistUserId()
02869     {
02870         return oxConfig::getParameter( 'wishid' );
02871     }
02872 
02878     public function getSearchCatId()
02879     {
02880     }
02881 
02887     public function getSearchVendor()
02888     {
02889     }
02890 
02896     public function getSearchManufacturer()
02897     {
02898     }
02899 
02905     public function getLastProducts()
02906     {
02907 
02908     }
02909 
02915     public function getNewBasketItemMsgType()
02916     {
02917         return (int) $this->getConfig()->getConfigParam( "iNewBasketItemMessage" );
02918     }
02919 
02927     public function isActive( $sName )
02928     {
02929         return $this->getConfig()->getConfigParam( "bl".$sName."Enabled" );
02930     }
02931 
02937     public function isFbWidgetVisible()
02938     {
02939         if ( $this->_blFbWidgetsOn === null ) {
02940             $oUtils = oxRegistry::get("oxUtilsServer");
02941 
02942             // reading ..
02943             $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie( "fbwidgetson" );
02944         }
02945         return $this->_blFbWidgetsOn;
02946     }
02947 
02953     public function isEnabledDownloadableFiles()
02954     {
02955         return (bool) $this->getConfig()->getConfigParam( "blEnableDownloads" );
02956     }
02957 
02963     public function showRememberMe()
02964     {
02965         return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
02966     }
02967 
02974     public function isVatIncluded()
02975     {
02976         $blResult = true;
02977         $oUser = $this->getUser();
02978         $oConfig = $this->getConfig();
02979 
02980         if ( $oConfig->getConfigParam( 'blShowNetPrice' ) || $oConfig->getConfigParam( 'bl_perfCalcVatOnlyForBasketOrder' ) ) {
02981             $blResult = false;
02982         } elseif ( $oUser && $oUser->isPriceViewModeNetto() ) {
02983             $blResult = false;
02984         }
02985 
02986         return $blResult;
02987     }
02988 
02994     public function isPriceCalculated()
02995     {
02996         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadPrice' );
02997     }
02998 
03004     public function showTags()
03005     {
03006          return (bool) $this->_blShowTagCloud && $this->getConfig()->getConfigParam( "blShowTags" );
03007     }
03008 
03014     public function getWishlistName()
03015     {
03016         if ( $this->getUser() ) {
03017             $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
03018             if ( $sUserId ) {
03019                 $oWishUser = oxNew( 'oxuser' );
03020                 if ( $oWishUser->load( $sUserId ) ) {
03021                     return $oWishUser;
03022                 }
03023             }
03024         }
03025         return false;
03026     }
03027 
03028 }