oxubase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 require_once getShopBasePath() . 'views/oxview.php' ;
00007 
00008 // view indexing state for search engines:
00009 define( 'VIEW_INDEXSTATE_INDEX', 0 );           //  index without limitations
00010 define( 'VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1 ); //  no index / no follow
00011 define( 'VIEW_INDEXSTATE_NOINDEXFOLLOW', 2 );   //  no index / follow
00012 
00018 class oxUBase extends oxView
00019 {
00025     protected $_oaComponents = array();
00026 
00032     protected $_blIsCallForCache = false;
00033 
00039     protected $_blIsOrderStep = false;
00040 
00046     protected $_sListType = null;
00047 
00053     protected $_oActCategory = null;
00054 
00059     protected $_oClickCat = null;
00060 
00066     protected $_sCategoryId = null;
00067 
00073     protected $_oActManufacturer = null;
00074 
00080     protected $_oActVendor = null;
00081 
00087     protected $_oActSearch = null;
00088 
00093     protected $_blShowSorting = false;
00094 
00099     protected $_blShowRightBasket = null;
00100 
00105     protected $_blShowTopBasket = null;
00106 
00111     protected $_blShowLeftBasket = null;
00112 
00117     protected $_blLoadCurrency = null;
00118 
00123     protected $_blLoadVendorTree = null;
00124 
00129     protected $_blLoadManufacturerTree = null;
00130 
00135     protected $_blDontShowEmptyCats = null;
00136 
00141     protected $_blLoadLanguage = null;
00142 
00147     protected $_blShowTopCatNav = null;
00148 
00153     protected $_iTopCatNavItmCnt = null;
00154 
00159     protected $_aRssLinks = null;
00160 
00165     protected $_sListOrderBy = null;
00166 
00171     protected $_sListOrderDir = null;
00172 
00177     protected $_sMetaDescription = null;
00178 
00183     protected $_sMetaKeywords = null;
00184 
00190     protected $_sMetaDescriptionIdent = null;
00191 
00197     protected $_sMetaKeywordsIdent = null;
00198 
00203     protected $_sAdditionalParams = null;
00204 
00209     protected $_oActCurrency = null;
00210 
00217     protected $_blCommonAdded = false;
00218 
00225     protected $_iViewIndexState = VIEW_INDEXSTATE_INDEX;
00226 
00233     protected $_blForceNoIndex = false;
00234 
00239     protected $_sWishlistName = null;
00240 
00245     protected $_iCompItemsCnt = null;
00246 
00252     protected $_sContentId = null;
00253 
00259     protected $_oContent = null;
00260 
00266     protected $_sViewResetID = null;
00267 
00272     protected $_blActiveSorting = null;
00273 
00278     protected $_aMenueList = null;
00279 
00285     protected $_aComponentNames = array(
00286                                     'oxcmp_user'       => 1, // 0 means dont init if cached
00287                                     'oxcmp_lang'       => 1,
00288                                     'oxcmp_cur'        => 1,
00289                                     'oxcmp_shop'       => 1,
00290                                     'oxcmp_categories' => 0,
00291                                     'oxcmp_utils'      => 1,
00292                                     'oxcmp_news'       => 0,
00293                                     'oxcmp_basket'     => 1
00294                                   );
00295 
00301     protected $_aUserComponentNames = array();
00302 
00308     protected $_oProduct = null;
00309 
00314     protected $_iActPage = null;
00315 
00320     protected $_aArticleList = null;
00321 
00326     protected $_oVendorTree  = null;
00327 
00332     protected $_oManufacturerTree  = null;
00333 
00338     protected $_oCategoryTree  = null;
00339 
00344     protected $_aTop5ArticleList  = null;
00345 
00350     protected $_aBargainArticleList  = null;
00351 
00356     protected $_iLowOrderPrice  = null;
00357 
00362     protected $_sMinOrderPrice  = null;
00363 
00368     protected $_iNewsRealStatus  = null;
00369 
00374     protected $_aBlockRedirectParams = array( 'fnc' );
00375 
00380     protected $_aVendorlist = null;
00381 
00386     protected $_oRootVendor = null;
00387 
00392     protected $_sVendorId = null;
00393 
00398     protected $_aManufacturerlist = null;
00399 
00404     protected $_oRootManufacturer = null;
00405 
00410     protected $_sManufacturerId = null;
00411 
00416     protected $_aSearchCatTree = null;
00417 
00422     protected $_oCatMore = null;
00423 
00428     protected $_blNewsSubscribed = null;
00429 
00434     protected $_blShowShipAddress = null;
00435 
00440     protected $_oDelAddress = null;
00441 
00446     protected $_sCatTreePath = null;
00447 
00452     protected $_aContents = array();
00453 
00458     protected $_blTop5Action = false;
00459 
00464     protected $_blBargainAction = false;
00465 
00474     protected function _processRequest()
00475     {
00476         $myUtils = oxUtils::getInstance();
00477 
00478         // non admin, request is not empty and was not processed by seo engine
00479         if ( $myUtils->seoIsActive() && !isSearchEngineUrl() && ( $sStdUrl = getRequestUrl( '', true ) ) ) {
00480 
00481             // fetching standard url and looking for it in seo table
00482             if ( $this->_canRedirect() && ( $sRedirectUrl = oxSeoEncoder::getInstance()->fetchSeoUrl( $sStdUrl ) ) ) {
00483                 $myUtils->redirect( $this->getConfig()->getShopURL() . $sRedirectUrl, false );
00484             } else {
00485                 // forcing to set noindex/follow meta
00486                 $this->_forceNoIndex();
00487 
00488                 $sShopId = $this->getConfig()->getShopId();
00489                 $sLangId = oxLang::getInstance()->getBaseLanguage();
00490                 $sIdent  = md5( strtolower( $sStdUrl ) . $sShopId . $sLangId );
00491 
00492                 // logging "not found" url
00493                 $oDb = oxDb::getDb();
00494                 $oDb->execute( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
00495                                 values ( " . $oDb->quote( $sStdUrl ) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) " );
00496             }
00497         }
00498     }
00499 
00506     public function init()
00507     {
00508         $this->_processRequest();
00509 
00510         if ( oxConfig::getParameter( '_force_no_basket_cmp' ) ) {
00511             unset( $this->_aComponentNames['oxcmp_basket'] );
00512         }
00513 
00514         // as the objects are cached by dispatcher we have to watch out, that we don't add these components twice
00515         if ( !$this->_blCommonAdded ) {
00516             $this->_aComponentNames = array_merge( $this->_aComponentNames, $this->_aUserComponentNames );
00517             $this->_blCommonAdded = true;
00518         }
00519 
00520         // setting list type if needed
00521         $this->_setListType();
00522 
00523         // storing current view
00524         $blInit = true;
00525 
00526 
00527         // init all components if there are any
00528         foreach ( $this->_aComponentNames as $sComponentName => $blNotCacheable ) {
00529             // do not override initiated components
00530             if ( !isset( $this->_oaComponents[$sComponentName] ) ) {
00531                 // component objects MUST be created to support user called functions
00532                 $oComponent = oxNew( $sComponentName );
00533                 $oComponent->setParent( $this );
00534                 $oComponent->setThisAction( $sComponentName );
00535                 $this->_oaComponents[$sComponentName] = $oComponent;
00536             }
00537 
00538             // do we really need to initiate them ?
00539             if ( $blInit ) {
00540                 $this->_oaComponents[$sComponentName]->init();
00541 
00542                 // executing only is view does not have action method
00543                 if ( !method_exists( $this, $this->getFncName() ) ) {
00544                     $this->_oaComponents[$sComponentName]->executeFunction( $this->getFncName() );
00545                 }
00546             }
00547         }
00548 
00549         parent::init();
00550 
00551         // enable sorting ?
00552         if ( $this->showSorting() ) {
00553             $this->prepareSortColumns();
00554         }
00555         $this->_aViewData['showsorting']    = $this->isSortingActive();
00556         $this->_aViewData["allsortcolumns"] = $this->getSortColumns();
00557         $this->_aViewData['listorderby']    = $this->getListOrderBy();
00558         $this->_aViewData['listorder']      = $this->getListOrderDirection();
00559     }
00560 
00567     public function getViewId()
00568     {
00569         if ( $this->_sViewId ) {
00570             return $this->_sViewId;
00571         }
00572 
00573         $iLang = oxLang::getInstance()->getBaseLanguage();
00574         $iCur  = (int) oxConfig::getParameter( 'currency' );
00575 
00576 
00577             $this->_sViewId =  "ox|$iLang|$iCur";
00578 
00579         return $this->_sViewId;
00580     }
00581 
00582 
00588     public function showSorting()
00589     {
00590         return $this->_blShowSorting && $this->getConfig()->getConfigParam( 'blShowSorting' );
00591     }
00592 
00600     public function setComponents( $aComponents = null )
00601     {
00602         $this->_oaComponents = $aComponents;
00603     }
00604 
00610     public function getComponents()
00611     {
00612         return $this->_oaComponents;
00613     }
00614 
00622     public function setIsOrderStep( $blIsOrderStep = null )
00623     {
00624         $this->_blIsOrderStep = $blIsOrderStep;
00625     }
00626 
00632     public function getIsOrderStep()
00633     {
00634         return $this->_blIsOrderStep;
00635     }
00636 
00637 
00645     public function setActiveCategory( $oCategory )
00646     {
00647         $this->_oActCategory = $oCategory;
00648     }
00649 
00655     public function getActiveCategory()
00656     {
00657         return $this->_oActCategory;
00658     }
00659 
00667     public function setIsCallForCache( $blIsCallForCache = null )
00668     {
00669         $this->_blIsCallForCache = $blIsCallForCache;
00670     }
00671 
00677     public function getIsCallForCache()
00678     {
00679         return $this->_blIsCallForCache;
00680     }
00681 
00687     public function getListType()
00688     {
00689         if ( $this->_sListType == null && ( $sListType = oxConfig::getParameter( 'listtype' ) ) ) {
00690             $this->_sListType = $sListType;
00691         }
00692         return $this->_sListType;
00693     }
00694 
00702     public function setListType( $sType )
00703     {
00704         $this->_sListType = $sType;
00705     }
00706 
00712     public function getCategoryId()
00713     {
00714         if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00715             $this->_sCategoryId = $sCatId;
00716         }
00717 
00718         return $this->_sCategoryId;
00719     }
00720 
00728     public function setCategoryId( $sCategoryId )
00729     {
00730         $this->_sCategoryId = $sCategoryId;
00731     }
00732 
00733 
00739     public function showRightBasket()
00740     {
00741         if ( $this->_blShowRightBasket === null ) {
00742             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) ) {
00743                 $this->_blShowRightBasket = $blShowRightBasket;
00744             }
00745         }
00746         return $this->_blShowRightBasket;
00747     }
00748 
00756     public function setShowRightBasket( $blShowBasket )
00757     {
00758         $this->_blShowRightBasket = $blShowBasket;
00759     }
00760 
00766     public function showLeftBasket()
00767     {
00768         if ( $this->_blShowLeftBasket === null ) {
00769             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00770                 $this->_blShowLeftBasket = $blShowLeftBasket;
00771             }
00772         }
00773         return $this->_blShowLeftBasket;
00774     }
00775 
00783     public function setShowLeftBasket( $blShowBasket )
00784     {
00785         $this->_blShowLeftBasket = $blShowBasket;
00786     }
00787 
00793     public function showTopBasket()
00794     {
00795         if ( $this->_blShowTopBasket === null ) {
00796             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00797                 $this->_blShowTopBasket = $blShowTopBasket;
00798             }
00799         }
00800         return $this->_blShowTopBasket;
00801     }
00802 
00810     public function setShowTopBasket( $blShowBasket )
00811     {
00812         $this->_blShowTopBasket = $blShowBasket;
00813     }
00814 
00820     public function loadCurrency()
00821     {
00822         if ( $this->_blLoadCurrency == null ) {
00823             $this->_blLoadCurrency = false;
00824             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00825                 $this->_blLoadCurrency = $blLoadCurrency;
00826             }
00827         }
00828         return $this->_blLoadCurrency;
00829     }
00830 
00836     public function loadVendorTree()
00837     {
00838         if ( $this->_blLoadVendorTree == null ) {
00839             $this->_blLoadVendorTree = false;
00840             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00841                 $this->_blLoadVendorTree = $blLoadVendorTree;
00842             }
00843         }
00844         return $this->_blLoadVendorTree;
00845     }
00846 
00852     public function loadManufacturerTree()
00853     {
00854         if ( $this->_blLoadManufacturerTree == null ) {
00855             $this->_blLoadManufacturerTree = false;
00856             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00857                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00858             }
00859         }
00860         return $this->_blLoadManufacturerTree;
00861     }
00862 
00868     public function dontShowEmptyCategories()
00869     {
00870         if ( $this->_blDontShowEmptyCats == null ) {
00871             $this->_blDontShowEmptyCats = false;
00872             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00873                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00874             }
00875         }
00876         return $this->_blDontShowEmptyCats;
00877     }
00878 
00884     public function isLanguageLoaded()
00885     {
00886         if ( $this->_blLoadLanguage == null ) {
00887             $this->_blLoadLanguage = false;
00888             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00889                 $this->_blLoadLanguage = $blLoadLanguage;
00890             }
00891         }
00892         return $this->_blLoadLanguage;
00893     }
00894 
00900     public function showTopCatNavigation()
00901     {
00902         if ( $this->_blShowTopCatNav == null ) {
00903             $this->_blShowTopCatNav = false;
00904             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00905                 $this->_blShowTopCatNav = $blShowTopCatNav;
00906             }
00907         }
00908         return $this->_blShowTopCatNav;
00909     }
00910 
00916     public function getTopNavigationCatCnt()
00917     {
00918         if ( $this->_iTopCatNavItmCnt == null ) {
00919             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00920             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00921         }
00922         return $this->_iTopCatNavItmCnt;
00923     }
00924 
00934     public function addRssFeed($sTitle, $sUrl, $key = null)
00935     {
00936         if (!is_array($this->_aRssLinks)) {
00937             $this->_aRssLinks = array();
00938         }
00939         if ($key === null) {
00940             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00941         } else {
00942             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00943         }
00944 
00945         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00946     }
00947 
00962     public function prepareSortColumns()
00963     {
00964         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00965         if ( count( $aSortColumns ) > 0 ) {
00966 
00967             $this->_blActiveSorting = true;
00968             $this->_aSortColumns = $aSortColumns;
00969 
00970             $sCnid = oxConfig::getParameter( 'cnid' );
00971 
00972             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00973             $sSortDir = oxConfig::getParameter( 'listorder' );
00974 
00975             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00976                 $sSortBy  = $aSorting['sortby'];
00977                 $sSortDir = $aSorting['sortdir'];
00978             }
00979 
00980             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00981                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00982 
00983                 $this->_sListOrderBy  = $sSortBy;
00984                 $this->_sListOrderDir = $sSortDir;
00985 
00986                 // caching sorting config
00987                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00988             }
00989         }
00990     }
00991 
00997     public function getListOrderBy()
00998     {
00999         return $this->_sListOrderBy;
01000     }
01001 
01007     public function getListOrderDirection()
01008     {
01009         return $this->_sListOrderDir;
01010     }
01011 
01019     public function setMetaDescription ( $sDescription )
01020     {
01021         return $this->_sMetaDescription = $sDescription;
01022     }
01023 
01031     public function setMetaKeywords( $sKeywords )
01032     {
01033         return $this->_sMetaKeywords = $sKeywords;
01034     }
01035 
01041     public function getMetaKeywords()
01042     {
01043         if ( $this->_sMetaKeywords === null ) {
01044             $this->_sMetaKeywords = false;
01045             // set special meta keywords ?
01046             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01047                  ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxkeywords' ) ) ) {
01048                 return $this->_sMetaKeywords = $sKeywords;
01049             } elseif ( $this->_sMetaKeywordsIdent ) {
01050                 $oContent = oxNew( 'oxcontent' );
01051                 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
01052                     $this->_sMetaKeywords = strip_tags( $oContent->oxcontents__oxcontent->value );
01053                 }
01054             }
01055             $this->_sMetaKeywords = $this->_prepareMetaKeyword( $this->_sMetaKeywords );
01056         }
01057         return $this->_sMetaKeywords;
01058     }
01059 
01065     public function getMetaDescription()
01066     {
01067         if ( $this->_sMetaDescription === null ) {
01068             $this->_sMetaDescription = false;
01069             // set special meta description ?
01070             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01071                  ( $sMeta = oxSeoEncoder::getInstance()->getMetaData( $sOxid, 'oxdescription' ) ) ) {
01072                 return $this->_sMetaDescription = $sMeta;
01073             } elseif ( $this->_sMetaDescriptionIdent ) {
01074                 $oContent = oxNew( 'oxcontent' );
01075                 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
01076                     $this->_sMetaDescription = strip_tags( $oContent->oxcontents__oxcontent->value );
01077                 }
01078             }
01079             $this->_sMetaDescription = $this->_prepareMetaDescription( $this->_sMetaDescription );
01080         }
01081         return $this->_sMetaDescription;
01082     }
01083 
01089     public function getActCurrency()
01090     {
01091         return $this->_oActCurrency;
01092     }
01093 
01101     public function setActCurrency( $oCur )
01102     {
01103         $this->_oActCurrency = $oCur;
01104     }
01105 
01111     public function getCompareItemsCnt()
01112     {
01113         return $this->_iCompItemsCnt;
01114     }
01115 
01123     public function setCompareItemsCnt( $iCount )
01124     {
01125         $this->_iCompItemsCnt = $iCount;
01126     }
01127 
01133     public function getWishlistName()
01134     {
01135         return $this->_sWishlistName;
01136     }
01137 
01145     public function setWishlistName( $sName )
01146     {
01147         $this->_sWishlistName = $sName;
01148     }
01149 
01155     protected function _forceNoIndex()
01156     {
01157         $this->_blForceNoIndex = true;
01158     }
01159 
01166     public function noIndex()
01167     {
01168         if ( $this->_blForceNoIndex ) {
01169             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01170         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01171             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01172         } else {
01173             switch ( oxConfig::getParameter( 'fnc' ) ) {
01174                 case 'tocomparelist':
01175                 case 'tobasket':
01176                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01177                     break;
01178             }
01179         }
01180         return $this->_iViewIndexState;
01181     }
01182 
01189     public function getContentId()
01190     {
01191         if ( $this->_sContentId === null) {
01192             $oContent = oxNew( 'oxcontent' );
01193             $oContent->loadByIdent( 'oximpressum' );
01194             $this->_sContentId = $oContent->getId();
01195         }
01196 
01197         return $this->_sContentId;
01198     }
01199 
01206     public function getContent()
01207     {
01208         if ( $this->_oContent === null) {
01209             $oContent = oxNew( 'oxcontent' );
01210             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01211                 $this->_oContent = $oContent;
01212             }
01213         }
01214 
01215         return $this->_oContent;
01216     }
01217 
01223     public function isSortingActive()
01224     {
01225         return $this->_blActiveSorting;
01226     }
01227 
01233     public function getMenueList()
01234     {
01235         return $this->_aMenueList;
01236     }
01237 
01245     public function setMenueList( $aMenue )
01246     {
01247         $this->_aMenueList = $aMenue;
01248     }
01249 
01250 
01256     protected function _setNrOfArtPerPage()
01257     {
01258         $myConfig  = $this->getConfig();
01259         $aViewData = array();
01260 
01261         //setting default values to avoid possible errors showing article list
01262         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01263         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01264 
01265         // checking if all needed data is set
01266         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01267         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01268             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01269         } else {
01270             $iNrofCatArticles = $aNrofCatArticles[0];
01271         }
01272 
01273         $oViewConf = $this->getViewConfig();
01274         //value from user input
01275         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01276             // performing floor() to skip such variants as 7.5 etc
01277             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
01278             // M45 Possibility to push any "Show articles per page" number parameter
01279             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01280             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01281             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01282         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01283             // M45 Possibility to push any "Show articles per page" number parameter
01284             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01285             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01286             $iNrofCatArticles = $iSessArtPerPage;
01287         } else {
01288             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01289         }
01290 
01291         //setting number of articles per page to config value
01292         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01293 
01294         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01295     }
01296 
01302     protected function _getSeoObjectId()
01303     {
01304     }
01305 
01315     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
01316     {
01317         if ( $sMeta ) {
01318 
01319             $oStr = getStr();
01320             if ( $iLength != -1 ) {
01321                 /* *
01322                  * performance - we dont need a huge amount of initial text.
01323                  * assume that effective text may be double longer than $iLength
01324                  * and simple turncate it
01325                  */
01326                 $iELength = ( $iLength * 2 );
01327                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01328             }
01329 
01330             // decoding html entities
01331             $sMeta = $oStr->html_entity_decode( $sMeta );
01332             // stripping HTML tags
01333             $sMeta = strip_tags( $sMeta );
01334 
01335             // removing some special chars
01336             $sMeta = $oStr->cleanStr( $sMeta );
01337 
01338             // removing duplicate words
01339             if ( $blDescTag ) {
01340                 $sMeta = $this->_removeDuplicatedWords( $sMeta );
01341             }
01342 
01343             // some special cases
01344             $sMeta = str_replace( ' ,', ',', $sMeta );
01345             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01346             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01347             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01348 
01349             return trim( $sMeta );
01350         }
01351     }
01352 
01360     protected function _prepareMetaKeyword( $sKeywords )
01361     {
01362         $sString = $this->_prepareMetaDescription( $sKeywords, -1, true );
01363         $sString = $this->_removeDuplicatedWords( $sString );
01364         // removing in admin defined strings
01365         $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
01366         if ( is_array( $aSkipTags ) && $sString ) {
01367             $oStr = getStr();
01368             foreach ( $aSkipTags as $sSkip ) {
01369                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01370                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01371                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01372                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01373             }
01374         }
01375         return trim( $sString );
01376     }
01377 
01385     protected function _removeDuplicatedWords( $aInput )
01386     {
01387         $oStr = getStr();
01388         if ( is_array( $aInput ) ) {
01389             $aStrings = $aInput;
01390         } else {
01391             //is String
01392             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01393         }
01394         
01395         $sCount = count($aStrings);
01396         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01397             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01398         }
01399 
01400         // duplicates
01401         $aStrings = array_unique($aStrings);
01402 
01403         return implode( ', ', $aStrings );
01404     }
01405 
01413     public function getNavigationParams()
01414     {
01415         $aParams['cnid'] = $this->getCategoryId();
01416         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01417 
01418         $aParams['listtype'] = $this->getListType();
01419         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01420 
01421         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01422         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01423         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01424 
01425         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01426         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01427         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01428 
01429         return $aParams;
01430     }
01431 
01441     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01442     {
01443         $aSorting = oxSession::getVar( 'aSorting' );
01444         $aSorting[$sCnid]['sortby']  = $sSortBy;
01445         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01446 
01447         oxSession::setVar( 'aSorting', $aSorting );
01448     }
01449 
01457     public function getSorting( $sCnid )
01458     {
01459         $aSorting = oxSession::getVar( 'aSorting' );
01460         if ( isset( $aSorting[$sCnid] ) ) {
01461             return $aSorting[$sCnid];
01462         }
01463     }
01464 
01472     public function getSortingSql( $sCnid )
01473     {
01474         $aSorting = $this->getSorting( $sCnid );
01475         if ( is_array( $aSorting ) ) {
01476             return implode( " ", $aSorting );
01477         }
01478     }
01479 
01485     public function getTitleSuffix()
01486     {
01487         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01488     }
01489 
01496     public function getTitlePrefix()
01497     {
01498         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01499     }
01500 
01507     protected function _getSubject()
01508     {
01509         return null;
01510     }
01511 
01517     public function getDynUrlParams()
01518     {
01519         $sRet = '';
01520         $sListType = $this->getListType();
01521 
01522         switch ($sListType) {
01523             default:
01524                 break;
01525             case 'search':
01526                 $sRet .= "&amp;listtype={$sListType}";
01527                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01528                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01529                 }
01530 
01531                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01532                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01533                 }
01534                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01535                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01536                 }
01537                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01538                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01539                 }
01540                 break;
01541             case 'tag':
01542                 $sRet .= "&amp;listtype={$sListType}";
01543                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01544                     $sRet .= "&amp;searchtag={$sParam}";
01545                 }
01546                 break;
01547         }
01548 
01549         return $sRet;
01550     }
01551 
01559     public function getLink( $iLang = null )
01560     {
01561         if ( !isset( $iLang ) ) {
01562             $iLang = oxLang::getInstance()->getBaseLanguage();
01563         }
01564 
01565         $oDisplayObj = null;
01566         if ( oxUtils::getInstance()->seoIsActive() ) {
01567             $blTrySeo = true;
01568             $oDisplayObj = $this->_getSubject();
01569         }
01570         $iActPageNr = $this->getActPage();
01571 
01572         if ( $oDisplayObj ) {
01573 
01574             // if languages do not match object must be reload, but reference to view object should be broken
01575             if ( $oDisplayObj->getLanguage() != $iLang ) {
01576                 $sOxId = $oDisplayObj->getId();
01577                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01578                 $oDisplayObj->load( $sOxId );
01579             }
01580 
01581             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01582         } else {
01583             $myConfig = $this->getConfig();
01584 
01585             if ( $blTrySeo ) {
01586                 $oEncoder = oxSeoEncoder::getInstance();
01587                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01588                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01589                 }
01590             }
01591 
01592             $sForceLangChange = '';
01593             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01594                 $sForceLangChange = "&amp;lang={$iLang}";
01595             }
01596 
01597             // fallback to old non seo url
01598             return $this->_addPageNrParam( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange, $iActPageNr, $iLang );
01599         }
01600     }
01601 
01608     public function getSimilarRecommLists()
01609     {
01610     }
01611 
01619     protected function _getRequestParams( $blAddPageNr  = true )
01620     {
01621         $sClass = $this->getClassName();
01622         $sFnc   = $this->getFncName();
01623 
01624         // #921 S
01625         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01626         if ( in_array( $sFnc, $aFnc ) ) {
01627             $sFnc = '';
01628         }
01629 
01630         // #680
01631         $sURL = "cl={$sClass}";
01632         if ( $sFnc ) {
01633             $sURL .= "&amp;fnc={$sFnc}";
01634         }
01635         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01636             $sURL .= "&amp;cnid={$sVal}";
01637         }
01638         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01639             $sURL .= "&amp;mnid={$sVal}";
01640         }
01641         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01642             $sURL .= "&amp;anid={$sVal}";
01643         }
01644 
01645         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01646             $sURL .= "&amp;page={$sVal}";
01647         }
01648 
01649         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01650             $sURL .= "&amp;tpl={$sVal}";
01651         }
01652 
01653         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01654         // don't include page number for navigation
01655         // it will be done in oxubase::generatePageNavigation
01656         if ( $blAddPageNr && $iPgNr > 0 ) {
01657             $sURL .= "&amp;pgNr={$iPgNr}";
01658         }
01659 
01660         // #1184M - specialchar search
01661         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01662             $sURL .= "&amp;searchparam={$sVal}";
01663         }
01664 
01665         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01666             $sURL .= "&amp;searchcnid={$sVal}";
01667         }
01668 
01669         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01670             $sURL .= "&amp;searchvendor={$sVal}";
01671         }
01672 
01673         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01674             $sURL .= "&amp;searchmanufacturer={$sVal}";
01675         }
01676 
01677         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01678             $sURL .= "&amp;searchrecomm={$sVal}";
01679         }
01680 
01681         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01682             $sURL .= "&amp;searchtag={$sVal}";
01683         }
01684 
01685         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01686             $sURL .= "&amp;recommid={$sVal}";
01687         }
01688 
01689         return $sURL;
01690     }
01691 
01697     protected function _getSeoRequestParams()
01698     {
01699         $sClass = $this->getClassName();
01700         $sFnc   = $this->getFncName();
01701 
01702         // #921 S
01703         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01704         if ( in_array( $sFnc, $aFnc ) ) {
01705             $sFnc = '';
01706         }
01707 
01708         // #680
01709         $sURL = "cl={$sClass}";
01710         if ( $sFnc ) {
01711             $sURL .= "&amp;fnc={$sFnc}";
01712         }
01713         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01714             $sURL .= "&amp;page={$sVal}";
01715         }
01716 
01717         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01718             $sURL .= "&amp;tpl={$sVal}";
01719         }
01720 
01721         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01722         if ( $iPgNr > 0 ) {
01723             $sURL .= "&amp;pgNr={$iPgNr}";
01724         }
01725 
01726         return $sURL;
01727     }
01728 
01734     public function showSearch()
01735     {
01736         $blShow = true;
01737         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01738             $blShow = false;
01739         }
01740         return (int) $blShow;
01741     }
01742 
01748     public function getRssLinks()
01749     {
01750         return $this->_aRssLinks;
01751     }
01752 
01758     public function getSortColumns()
01759     {
01760         return $this->_aSortColumns;
01761     }
01762 
01768     public function getEditTags()
01769     {
01770     }
01771 
01777     public function getRecommSearch()
01778     {
01779     }
01780 
01786     public function getReviewUserId()
01787     {
01788     }
01789 
01795     public function getPaymentList()
01796     {
01797     }
01798 
01804     public function getActiveRecommList()
01805     {
01806     }
01807 
01813     public function getAccessoires()
01814     {
01815     }
01816 
01822     public function getCrossSelling()
01823     {
01824     }
01825 
01831     public function getSimilarProducts()
01832     {
01833     }
01834 
01840     public function getAlsoBoughtThiesProducts()
01841     {
01842     }
01843 
01849     public function getArticleId()
01850     {
01851     }
01852 
01858     public function isMoreTagsVisible()
01859     {
01860         return false;
01861     }
01862 
01868     public function getTitle()
01869     {
01870     }
01871 
01877     public function getActiveLangAbbr()
01878     {
01879         // Performance
01880         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01881             return;
01882         }
01883 
01884         if ( !isset($this->_sActiveLangAbbr ) ) {
01885             $aLanguages = oxLang::getInstance()->getLanguageArray();
01886             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01887                 if ( $oVal->selected ) {
01888                     $this->_sActiveLangAbbr = $oVal->abbr;
01889                     break;
01890                 }
01891             }
01892         }
01893 
01894         return $this->_sActiveLangAbbr;
01895     }
01896 
01910     public function addGlobalParams( $oShop = null)
01911     {
01912         $myConfig = $this->getConfig();
01913 
01914         $oViewConf = parent::addGlobalParams( $oShop );
01915 
01916         $this->_aViewData['isfiltering'] = true;
01917         $this->_aViewData['isnewsletter'] = true;
01918         $this->_aViewData['isvarianten'] = true;
01919         $this->_aViewData['isreview'] = true;
01920         $this->_aViewData['isaddsales'] = true;
01921         $this->_aViewData['isvoucher'] = true;
01922         $this->_aViewData['ispricealarm'] = true;
01923         $this->_aViewData['iswishlist'] = true;
01924         $this->_aViewData['isipayment'] = true;
01925         $this->_aViewData['istrusted'] = true;
01926         $this->_aViewData['isfiltering'] = true;
01927         $this->_aViewData['isgooglestats'] = true;
01928         $this->_aViewData['iswishlist'] = true;
01929 
01930 
01931         // show baskets
01932         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01933         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01934         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01935 
01936         // allow currency swiching
01937         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01938 
01939         // show/hide vendors
01940         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01941 
01942         // show/hide Manufacturers
01943         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01944 
01945         // show/hide empty categories
01946         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01947 
01948         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01949 
01950         // used for compatibility with older templates
01951         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01952         $this->_aViewData['urlsign']    = '&';
01953         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01954         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01955 
01956         $this->_aViewData['sListType'] = $this->getListType();
01957         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01958 
01959         // new navigation ?
01960         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01961         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01962 
01963         $this->_setNrOfArtPerPage();
01964 
01965 
01966         return $oViewConf;
01967     }
01968 
01974     public function getAdditionalParams()
01975     {
01976         if ( $this->_sAdditionalParams === null ) {
01977             // #1018A
01978             $this->_sAdditionalParams  = parent::getAdditionalParams();
01979             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01980 
01981             // #1834M - specialchar search
01982             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01983             if ( isset( $sSearchParamForLink ) ) {
01984                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01985             }
01986             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01987                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01988             }
01989             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01990                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01991             }
01992             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01993                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01994             }
01995             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01996                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01997             }
01998             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
01999                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02000             }
02001             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02002                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02003             }
02004         }
02005 
02006         return $this->_sAdditionalParams;
02007     }
02008 
02014     protected function _setListType()
02015     {
02016         if ( !oxConfig::getParameter( 'listtype' ) && isset( $this->_sListType ) ) {
02017             $this->getConfig()->setGlobalParameter( 'listtype', $this->_sListType );
02018         }
02019     }
02020 
02026     public function generatePageNavigationUrl()
02027     {
02028         // $sClass = $this->_sThisAction;
02029         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02030     }
02031 
02041     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02042     {
02043         if ( $iPage ) {
02044             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02045         }
02046         return $sUrl;
02047     }
02048 
02054     public function generatePageNavigation( )
02055     {
02056         startProfile('generatePageNavigation');
02057         // generate the page navigation
02058         $pageNavigation = new stdClass();
02059         $pageNavigation->NrOfPages = $this->_iCntPages;
02060         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02061         $iActPage = $this->getActPage();
02062         $pageNavigation->actPage   = $iActPage + 1;
02063 
02064         $sUrl = $this->generatePageNavigationUrl( );
02065 
02066         if ( $iActPage > 0) {
02067             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02068         }
02069 
02070         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02071             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02072         }
02073 
02074         if ( $pageNavigation->NrOfPages > 1 ) {
02075             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02076                 $page = new Oxstdclass();
02077                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02078                 $page->selected = 0;
02079                 if ( $i == $pageNavigation->actPage ) {
02080                     $page->selected = 1;
02081                 }
02082                 $pageNavigation->changePage[$i] = $page;
02083             }
02084 
02085             // first/last one
02086             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02087             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02088         }
02089 
02090         stopProfile('generatePageNavigation');
02091 
02092         return $pageNavigation;
02093     }
02094 
02100     public function prepareMinimumOrderPrice4View()
02101     {
02102         $myConfig = $this->getConfig();
02103         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02104         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02105             $oBasket = $this->getSession()->getBasket();
02106             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02107                 return;
02108             }
02109             $oCur    = $myConfig->getActShopCurrencyObject();
02110             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02111             // Coupons and discounts should be considered in "Min order price" check
02112             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02113                 $this->_iLowOrderPrice = 1;
02114                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02115             }
02116         }
02117     }
02118 
02125     public function render()
02126     {
02127         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02128             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02129         }
02130 
02131         parent::render();
02132 
02133         if ( $this->getIsOrderStep() ) {
02134 
02135             // min. order price check
02136             $this->prepareMinimumOrderPrice4View();
02137 
02138             // disabling navigation during order ...
02139             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02140                 $this->_iNewsRealStatus = 1;
02141                 $this->setShowNewsletter( 0 );
02142                 // for old tpl. will be removed later
02143                 $this->_aViewData['isnewsletter'] = 0;
02144                 $this->setShowRightBasket( 0 );
02145                 $this->setShowLeftBasket( 0 );
02146                 $this->setShowTopBasket( 0 );
02147             }
02148             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02149             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02150         }
02151 
02152         // meta data
02153         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02154         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02155 
02156         // show baskets
02157         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02158         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02159         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02160 
02161         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02162 
02163         $this->_aViewData['noindex'] = $this->noIndex();
02164 
02165         return $this->_sThisTemplate;
02166     }
02167 
02173     public function getViewProduct()
02174     {
02175         return $this->getProduct();
02176     }
02177 
02185     public function setViewProduct( $oProduct )
02186     {
02187         $this->_oProduct = $oProduct;
02188     }
02189 
02195     public function getViewProductList()
02196     {
02197         return $this->_aArticleList;
02198     }
02199 
02205     public function getActPage()
02206     {
02207         if ( $this->_iActPage === null ) {
02208             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02209             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02210         }
02211         return $this->_iActPage;
02212     }
02213 
02221     public function getActCategory()
02222     {
02223         // if active category is not set yet - trying to load it from request params
02224         // this may be usefull when category component was unable to load active category
02225         // and we still need some object to mount navigation info
02226         if ( $this->_oClickCat === null ) {
02227 
02228             $this->_oClickCat = false;
02229             $oCategory = oxNew( 'oxcategory' );
02230             if ( $oCategory->load( $this->getCategoryId() ) ) {
02231                 $this->_oClickCat = $oCategory;
02232             }
02233         }
02234 
02235         return $this->_oClickCat;
02236     }
02237 
02245     public function setActCategory( $oCategory )
02246     {
02247         $this->_oClickCat = $oCategory;
02248     }
02249 
02257     public function getActTag()
02258     {
02259         if ( $this->_oActTag === null ) {
02260             $this->_oActTag = new Oxstdclass();
02261             $this->_oActTag->sTag = oxConfig::getParameter("searchtag", 1);
02262 
02263             $sUrl = $this->getConfig()->getShopHomeURL();
02264             $this->_oActTag->link = "{$sUrl}cl=tag";
02265         }
02266         return $this->_oActTag;
02267     }
02268 
02276     public function getActVendor()
02277     {
02278         // if active vendor is not set yet - trying to load it from request params
02279         // this may be usefull when category component was unable to load active vendor
02280         // and we still need some object to mount navigation info
02281         if ( $this->_oActVendor === null ) {
02282             $this->_oActVendor = false;
02283             $sVendorId = oxConfig::getParameter( 'cnid' );
02284             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02285             if ( 'root' == $sVendorId ) {
02286                 $this->_oActVendor = oxVendor::getRootVendor();
02287             } elseif ( $sVendorId ) {
02288                 $oVendor = oxNew( 'oxvendor' );
02289                 if ( $oVendor->load( $sVendorId ) ) {
02290                     $this->_oActVendor = $oVendor;
02291                 }
02292             }
02293         }
02294 
02295         return $this->_oActVendor;
02296     }
02297 
02305     public function getActManufacturer()
02306     {
02307         // if active Manufacturer is not set yet - trying to load it from request params
02308         // this may be usefull when category component was unable to load active Manufacturer
02309         // and we still need some object to mount navigation info
02310         if ( $this->_oActManufacturer === null ) {
02311 
02312             $this->_oActManufacturer = false;
02313             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02314             if ( 'root' == $sManufacturerId ) {
02315                 $this->_oActManufacturer = oxManufacturer::getRootManufacturer();
02316             } elseif ( $sManufacturerId ) {
02317                 $oManufacturer = oxNew( 'oxmanufacturer' );
02318                 if ( $oManufacturer->load( $sManufacturerId ) ) {
02319                     $this->_oActManufacturer = $oManufacturer;
02320                 }
02321             }
02322         }
02323 
02324         return $this->_oActManufacturer;
02325     }
02326 
02334     public function setActVendor( $oVendor )
02335     {
02336         $this->_oActVendor = $oVendor;
02337     }
02338 
02346     public function setActManufacturer( $oManufacturer )
02347     {
02348         $this->_oActManufacturer = $oManufacturer;
02349     }
02350 
02356     public function getActSearch()
02357     {
02358         if ( $this->_oActSearch === null ) {
02359             $this->_oActSearch = new oxStdClass();
02360             $sUrl = $this->getConfig()->getShopHomeURL();
02361             $this->_oActSearch->link = "{$sUrl}cl=search";
02362         }
02363         return $this->_oActSearch;
02364     }
02365 
02371     public function getActRecommList()
02372     {
02373         if ( $this->_oActRecomm === null ) {
02374             $this->_oActRecomm = false;
02375             $sRecommId = oxConfig::getParameter( 'recommid' );
02376 
02377             $oRecommList = oxNew( 'oxrecommlist' );
02378 
02379             if ( $oRecommList->load( $sRecommId ) ) {
02380                 $this->_oActRecomm = $oRecommList;
02381             }
02382         }
02383         return $this->_oActRecomm;
02384     }
02385 
02391     public function getCategoryTree()
02392     {
02393         return $this->_oCategoryTree;
02394     }
02395 
02403     public function setCategoryTree( $oCatTree )
02404     {
02405         $this->_oCategoryTree = $oCatTree;
02406     }
02407 
02413     public function getVendorTree()
02414     {
02415         return $this->_oVendorTree;
02416     }
02417 
02425     public function setVendorTree( $oVendorTree )
02426     {
02427         $this->_oVendorTree = $oVendorTree;
02428     }
02429 
02435     public function getManufacturerTree()
02436     {
02437         return $this->_oManufacturerTree;
02438     }
02439 
02447     public function setManufacturerTree( $oManufacturerTree )
02448     {
02449         $this->_oManufacturerTree = $oManufacturerTree;
02450     }
02460     protected function _loadActions()
02461     {
02462         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02463         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02464     }
02465 
02474     public function setSessionCategoryId( $sCategoryId )
02475     {
02476         oxSession::setVar( 'cnid', $sCategoryId );
02477     }
02478 
02484     public function getSessionCategoryId()
02485     {
02486         return oxSession::getVar( 'cnid' );
02487     }
02488 
02494     protected function _processListArticles()
02495     {
02496         $sAddParams = $this->getAddUrlParams();
02497         if ( $sAddParams && $this->_aArticleList ) {
02498             foreach ( $this->_aArticleList as $oArticle ) {
02499                 $oArticle->appendLink( $sAddParams );
02500             }
02501         }
02502     }
02503 
02509     public function getAddUrlParams()
02510     {
02511     }
02512 
02519     public function getTop5ArticleList()
02520     {
02521         if ( !$this->_blTop5Action ) {
02522             return null;
02523         }
02524 
02525         if ( $this->_aTop5ArticleList === null ) {
02526             $this->_aTop5ArticleList = false;
02527             $myConfig = $this->getConfig();
02528             if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02529                 // top 5 articles
02530                 $oArtList = oxNew( 'oxarticlelist' );
02531                 $oArtList->loadTop5Articles();
02532                 if ( $oArtList->count() ) {
02533                     $this->_aTop5ArticleList = $oArtList;
02534                 }
02535             }
02536         }
02537         return $this->_aTop5ArticleList;
02538     }
02539 
02546     public function getBargainArticleList()
02547     {
02548         if ( !$this->_blBargainAction ) {
02549             return null;
02550         }
02551 
02552         if ( $this->_aBargainArticleList === null ) {
02553             $this->_aBargainArticleList = array();
02554             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02555                 $oArtList = oxNew( 'oxarticlelist' );
02556                 $oArtList->loadAktionArticles( 'OXBARGAIN' );
02557                 if ( $oArtList->count() ) {
02558                     $this->_aBargainArticleList = $oArtList;
02559                 }
02560             }
02561         }
02562         return $this->_aBargainArticleList;
02563     }
02564 
02570     public function isLowOrderPrice()
02571     {
02572         return $this->_iLowOrderPrice;
02573     }
02574 
02580     public function getMinOrderPrice()
02581     {
02582         return $this->_sMinOrderPrice;
02583     }
02584 
02590     public function getNewsRealStatus()
02591     {
02592         return $this->_iNewsRealStatus;
02593     }
02594 
02600     protected function _canRedirect()
02601     {
02602         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02603             if ( oxConfig::getParameter( $sParam ) !== null ) {
02604                 return false;
02605             }
02606         }
02607 
02608         return true;
02609     }
02610 
02616     public function getProduct()
02617     {
02618     }
02619 
02625     public function getVendorlist()
02626     {
02627         return $this->_aVendorlist;
02628     }
02629 
02637     public function setVendorlist( $aList )
02638     {
02639         $this->_aVendorlist = $aList;
02640     }
02641 
02647     public function getManufacturerlist()
02648     {
02649         return $this->_aManufacturerlist;
02650     }
02651 
02659     public function setManufacturerlist( $aList )
02660     {
02661         $this->_aManufacturerlist = $aList;
02662     }
02663 
02671     public function setRootVendor( $oVendor )
02672     {
02673         $this->_oRootVendor = $oVendor;
02674     }
02675 
02681     public function getRootVendor()
02682     {
02683         return $this->_oRootVendor;
02684     }
02685 
02693     public function setRootManufacturer( $oManufacturer )
02694     {
02695         $this->_oRootManufacturer = $oManufacturer;
02696     }
02697 
02703     public function getRootManufacturer()
02704     {
02705         return $this->_oRootManufacturer;
02706     }
02707 
02713     public function getVendorId()
02714     {
02715         if ( $this->_sVendorId === null ) {
02716             $this->_sVendorId = false;
02717             if ( ( $oVendor = $this->getActVendor() ) ) {
02718                 $this->_sVendorId = $oVendor->getId();
02719             }
02720         }
02721         return $this->_sVendorId;
02722     }
02723 
02729     public function getManufacturerId()
02730     {
02731         if ( $this->_sManufacturerId === null ) {
02732             $this->_sManufacturerId = false;
02733             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02734                 $this->_sManufacturerId = $oManufacturer->getId();
02735             }
02736         }
02737         return $this->_sManufacturerId;
02738     }
02739 
02745     public function getSearchCatTree()
02746     {
02747         return $this->_aSearchCatTree;
02748     }
02749 
02757     public function setSearchCatTree( $aTree )
02758     {
02759         $this->_aSearchCatTree = $aTree;
02760     }
02761 
02767     public function getCatMore()
02768     {
02769         return $this->_oCatMore;
02770     }
02771 
02779     public function setCatMore( $oCat )
02780     {
02781         $this->_oCatMore = $oCat;
02782     }
02783 
02789     public function isNewsSubscribed()
02790     {
02791         return $this->_blNewsSubscribed;
02792     }
02793 
02801     public function setNewsSubscribed( $blNewsSubscribed )
02802     {
02803         $this->_blNewsSubscribed = $blNewsSubscribed;
02804     }
02805 
02811     public function showShipAddress()
02812     {
02813         return $this->_blShowShipAddress;
02814     }
02815 
02823     public function setShowShipAddress( $blShowShipAddress )
02824     {
02825         $this->_blShowShipAddress = $blShowShipAddress;
02826     }
02827 
02833     public function getDelAddress()
02834     {
02835         return $this->_oDelAddress;
02836     }
02837 
02845     public function setDelAddress( $oDelAddress )
02846     {
02847         $this->_oDelAddress = $oDelAddress;
02848     }
02849 
02855     public function getCatTreePath()
02856     {
02857         return $this->_sCatTreePath;
02858     }
02859 
02867     public function getContentByIdent( $sIdent )
02868     {
02869         if ( !isset( $this->_aContents[$sIdent] ) ) {
02870             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02871             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02872         }
02873         return $this->_aContents[$sIdent];
02874     }
02875 
02881     public function getContentCategory()
02882     {
02883         return false;
02884     }
02885 }

Generated on Wed Apr 22 12:26:32 2009 for OXID eShop CE by  doxygen 1.5.5