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 
00657     public function getActiveCategory()
00658     {
00659         return $this->_oActCategory;
00660     }
00661 
00669     public function setIsCallForCache( $blIsCallForCache = null )
00670     {
00671         $this->_blIsCallForCache = $blIsCallForCache;
00672     }
00673 
00679     public function getIsCallForCache()
00680     {
00681         return $this->_blIsCallForCache;
00682     }
00683 
00689     public function getListType()
00690     {
00691         if ( $this->_sListType == null && ( $sListType = oxConfig::getParameter( 'listtype' ) ) ) {
00692             $this->_sListType = $sListType;
00693         }
00694         return $this->_sListType;
00695     }
00696 
00704     public function setListType( $sType )
00705     {
00706         $this->_sListType = $sType;
00707     }
00708 
00714     public function getCategoryId()
00715     {
00716         if ( $this->_sCategoryId == null && ( $sCatId = oxConfig::getParameter( 'cnid' ) ) ) {
00717             $this->_sCategoryId = $sCatId;
00718         }
00719 
00720         return $this->_sCategoryId;
00721     }
00722 
00730     public function setCategoryId( $sCategoryId )
00731     {
00732         $this->_sCategoryId = $sCategoryId;
00733     }
00734 
00735 
00741     public function showRightBasket()
00742     {
00743         if ( $this->_blShowRightBasket === null ) {
00744             if ( $blShowRightBasket = $this->getConfig()->getConfigParam( 'bl_perfShowRightBasket' ) )  {
00745                 $this->_blShowRightBasket = $blShowRightBasket;
00746             }
00747         }
00748         return $this->_blShowRightBasket;
00749     }
00750 
00758     public function setShowRightBasket( $blShowBasket )
00759     {
00760         $this->_blShowRightBasket = $blShowBasket;
00761     }
00762 
00768     public function showLeftBasket()
00769     {
00770         if ( $this->_blShowLeftBasket === null ) {
00771             if ( $blShowLeftBasket = $this->getConfig()->getConfigParam( 'bl_perfShowLeftBasket' ) ) {
00772                 $this->_blShowLeftBasket = $blShowLeftBasket;
00773             }
00774         }
00775         return $this->_blShowLeftBasket;
00776     }
00777 
00785     public function setShowLeftBasket( $blShowBasket )
00786     {
00787         $this->_blShowLeftBasket = $blShowBasket;
00788     }
00789 
00795     public function showTopBasket()
00796     {
00797         if ( $this->_blShowTopBasket === null ) {
00798             if ( $blShowTopBasket = $this->getConfig()->getConfigParam( 'bl_perfShowTopBasket' ) ) {
00799                 $this->_blShowTopBasket = $blShowTopBasket;
00800             }
00801         }
00802         return $this->_blShowTopBasket;
00803     }
00804 
00812     public function setShowTopBasket( $blShowBasket )
00813     {
00814         $this->_blShowTopBasket = $blShowBasket;
00815     }
00816 
00822     public function loadCurrency()
00823     {
00824         if ( $this->_blLoadCurrency == null ) {
00825             $this->_blLoadCurrency = false;
00826             if ( $blLoadCurrency = $this->getConfig()->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00827                 $this->_blLoadCurrency = $blLoadCurrency;
00828             }
00829         }
00830         return $this->_blLoadCurrency;
00831     }
00832 
00838     public function loadVendorTree()
00839     {
00840         if ( $this->_blLoadVendorTree == null ) {
00841             $this->_blLoadVendorTree = false;
00842             if ( $blLoadVendorTree = $this->getConfig()->getConfigParam( 'bl_perfLoadVendorTree' ) ) {
00843                 $this->_blLoadVendorTree = $blLoadVendorTree;
00844             }
00845         }
00846         return $this->_blLoadVendorTree;
00847     }
00848 
00854     public function loadManufacturerTree()
00855     {
00856         if ( $this->_blLoadManufacturerTree == null ) {
00857             $this->_blLoadManufacturerTree = false;
00858             if ( $blLoadManufacturerTree = $this->getConfig()->getConfigParam( 'bl_perfLoadManufacturerTree' ) ) {
00859                 $this->_blLoadManufacturerTree = $blLoadManufacturerTree;
00860             }
00861         }
00862         return $this->_blLoadManufacturerTree;
00863     }
00864 
00870     public function dontShowEmptyCategories()
00871     {
00872         if ( $this->_blDontShowEmptyCats == null ) {
00873             $this->_blDontShowEmptyCats = false;
00874             if ( $blDontShowEmptyCats = $this->getConfig()->getConfigParam( 'blDontShowEmptyCategories' ) ) {
00875                 $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
00876             }
00877         }
00878         return $this->_blDontShowEmptyCats;
00879     }
00880 
00886     public function isLanguageLoaded()
00887     {
00888         if ( $this->_blLoadLanguage == null ) {
00889             $this->_blLoadLanguage = false;
00890             if ( $blLoadLanguage = $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00891                 $this->_blLoadLanguage = $blLoadLanguage;
00892             }
00893         }
00894         return $this->_blLoadLanguage;
00895     }
00896 
00902     public function showTopCatNavigation()
00903     {
00904         if ( $this->_blShowTopCatNav == null ) {
00905             $this->_blShowTopCatNav = false;
00906             if ( $blShowTopCatNav = $this->getConfig()->getConfigParam( 'blTopNaviLayout' ) ) {
00907                 $this->_blShowTopCatNav = $blShowTopCatNav;
00908             }
00909         }
00910         return $this->_blShowTopCatNav;
00911     }
00912 
00918     public function getTopNavigationCatCnt()
00919     {
00920         if ( $this->_iTopCatNavItmCnt == null ) {
00921             $iTopCatNavItmCnt = $this->getConfig()->getConfigParam( 'iTopNaviCatCount' );
00922             $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
00923         }
00924         return $this->_iTopCatNavItmCnt;
00925     }
00926 
00935     public function addRssFeed($sTitle, $sUrl, $key = null)
00936     {
00937         if (!is_array($this->_aRssLinks)) {
00938             $this->_aRssLinks = array();
00939         }
00940         if ($key === null) {
00941             $this->_aRssLinks[] = array('title'=>$sTitle, 'link' => $sUrl);
00942         } else {
00943             $this->_aRssLinks[$key] = array('title'=>$sTitle, 'link' => $sUrl);
00944         }
00945 
00946         $this->_aViewData['rsslinks'] = $this->getRssLinks();
00947     }
00948 
00963     public function prepareSortColumns()
00964     {
00965         $aSortColumns = $this->getConfig()->getConfigParam( 'aSortCols' );
00966         if ( count( $aSortColumns ) > 0 ) {
00967 
00968             $this->_blActiveSorting = true;
00969             $this->_aSortColumns = $aSortColumns;
00970 
00971             $sCnid = oxConfig::getParameter( 'cnid' );
00972 
00973             $sSortBy  = oxConfig::getParameter( 'listorderby' );
00974             $sSortDir = oxConfig::getParameter( 'listorder' );
00975 
00976             if ( !$sSortBy && $aSorting = $this->getSorting( $sCnid ) ) {
00977                 $sSortBy  = $aSorting['sortby'];
00978                 $sSortDir = $aSorting['sortdir'];
00979             }
00980 
00981             if ( $sSortBy && oxDb::getInstance()->isValidFieldName( $sSortBy ) &&
00982                  $sSortDir && oxUtils::getInstance()->isValidAlpha( $sSortDir ) ) {
00983 
00984                 $this->_sListOrderBy  = $sSortBy;
00985                 $this->_sListOrderDir = $sSortDir;
00986 
00987                 // caching sorting config
00988                 $this->setItemSorting( $sCnid, $sSortBy, $sSortDir );
00989             }
00990         }
00991     }
00992 
00998     public function getListOrderBy()
00999     {
01000         return $this->_sListOrderBy;
01001     }
01002 
01008     public function getListOrderDirection()
01009     {
01010         return $this->_sListOrderDir;
01011     }
01012 
01020     public function setMetaDescription ( $sDescription )
01021     {
01022         return $this->_sMetaDescription = $sDescription;
01023     }
01024 
01032     public function setMetaKeywords( $sKeywords )
01033     {
01034         return $this->_sMetaKeywords = $sKeywords;
01035     }
01036 
01042     public function getMetaKeywords()
01043     {
01044         if ( $this->_sMetaKeywords === null ) {
01045             $this->_sMetaKeywords = false;
01046             // set special meta keywords ?
01047             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01048                  ( $sKeywords = oxSeoEncoder::getInstance()->getMetaData( $sOxid , 'oxkeywords' ) ) ) {
01049                 return $this->_sMetaKeywords = $sKeywords;
01050             } elseif ( $this->_sMetaKeywordsIdent ) {
01051                 $oContent = oxNew( 'oxcontent' );
01052                 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
01053                     $this->_sMetaKeywords = strip_tags( $oContent->oxcontents__oxcontent->value );
01054                 }
01055             }
01056             $this->_sMetaKeywords = $this->_prepareMetaKeyword( $this->_sMetaKeywords );
01057         }
01058         return $this->_sMetaKeywords;
01059     }
01060 
01066     public function getMetaDescription()
01067     {
01068         if ( $this->_sMetaDescription === null ) {
01069             $this->_sMetaDescription = false;
01070             // set special meta description ?
01071             if ( oxUtils::getInstance()->seoIsActive() && ( $sOxid = $this->_getSeoObjectId() ) &&
01072                  ( $sMeta = oxSeoEncoder::getInstance()->getMetaData( $sOxid , 'oxdescription' ) ) ) {
01073                 return $this->_sMetaDescription = $sMeta;
01074             } elseif ( $this->_sMetaDescriptionIdent ) {
01075                 $oContent = oxNew( 'oxcontent' );
01076                 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
01077                     $this->_sMetaDescription = strip_tags( $oContent->oxcontents__oxcontent->value );
01078                 }
01079             }
01080             $this->_sMetaDescription = $this->_prepareMetaDescription( $this->_sMetaDescription );
01081         }
01082         return $this->_sMetaDescription;
01083     }
01084 
01090     public function getActCurrency()
01091     {
01092         return $this->_oActCurrency;
01093     }
01094 
01102     public function setActCurrency( $oCur )
01103     {
01104         $this->_oActCurrency = $oCur;
01105     }
01106 
01112     public function getCompareItemsCnt()
01113     {
01114         return $this->_iCompItemsCnt;
01115     }
01116 
01124     public function setCompareItemsCnt( $iCount )
01125     {
01126         $this->_iCompItemsCnt = $iCount;
01127     }
01128 
01134     public function getWishlistName()
01135     {
01136         return $this->_sWishlistName;
01137     }
01138 
01146     public function setWishlistName( $sName )
01147     {
01148         $this->_sWishlistName = $sName;
01149     }
01150 
01156     protected function _forceNoIndex()
01157     {
01158         $this->_blForceNoIndex = true;
01159     }
01160 
01167     public function noIndex()
01168     {
01169         if ( $this->_blForceNoIndex ) {
01170             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01171         } elseif ( oxConfig::getParameter( 'cur' ) ) {
01172             $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01173         } else {
01174             switch ( oxConfig::getParameter( 'fnc' ) ) {
01175                 case 'tocomparelist':
01176                 case 'tobasket':
01177                     $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
01178                     break;
01179             }
01180         }
01181         return $this->_iViewIndexState;
01182     }
01183 
01190     public function getContentId()
01191     {
01192         if ( $this->_sContentId === null) {
01193             $oContent = oxNew( 'oxcontent' );
01194             $oContent->loadByIdent( 'oximpressum' );
01195             $this->_sContentId = $oContent->getId();
01196         }
01197 
01198         return $this->_sContentId;
01199     }
01200 
01207     public function getContent()
01208     {
01209         if ( $this->_oContent === null) {
01210             $oContent = oxNew( 'oxcontent' );
01211             if ( $oContent->load( $this->getContentId() ) && $oContent->oxcontents__oxactive->value ) {
01212                 $this->_oContent = $oContent;
01213             }
01214         }
01215 
01216         return $this->_oContent;
01217     }
01218 
01224     public function isSortingActive()
01225     {
01226         return $this->_blActiveSorting;
01227     }
01228 
01234     public function getMenueList()
01235     {
01236         return $this->_aMenueList;
01237     }
01238 
01246     public function setMenueList( $aMenue )
01247     {
01248         $this->_aMenueList = $aMenue;
01249     }
01250 
01251 
01257     protected function _setNrOfArtPerPage()
01258     {
01259         $myConfig  = $this->getConfig();
01260         $aViewData = array();
01261 
01262         //setting default values to avoid possible errors showing article list
01263         $iNrofCatArticles = $myConfig->getConfigParam( 'iNrofCatArticles' );
01264         $iNrofCatArticles = ( $iNrofCatArticles) ? $iNrofCatArticles : 10;
01265 
01266         // checking if all needed data is set
01267         $aNrofCatArticles = $myConfig->getConfigParam( 'aNrofCatArticles' );
01268         if ( !is_array( $aNrofCatArticles ) || !isset( $aNrofCatArticles[0] ) ) {
01269             $myConfig->setConfigParam( 'aNrofCatArticles', array( $iNrofCatArticles ) );
01270         } else {
01271             $iNrofCatArticles = $aNrofCatArticles[0];
01272         }
01273 
01274         $oViewConf = $this->getViewConfig();
01275         //value from user input
01276         if ( ( $iUserArtPerPage = (int) oxConfig::getParameter( '_artperpage' ) ) ) {
01277             // performing floor() to skip such variants as 7.5 etc
01278             $iNrofArticles = ( $iUserArtPerPage > 100 ) ? 10 : abs( $iUserArtPerPage );
01279             // M45 Possibility to push any "Show articles per page" number parameter
01280             $iNrofCatArticles = ( in_array( $iNrofArticles, $aNrofCatArticles ) ) ? $iNrofArticles : $iNrofCatArticles;
01281             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01282             oxSession::setVar( '_artperpage', $iNrofCatArticles );
01283         } elseif ( ( $iSessArtPerPage = oxSession::getVar( '_artperpage' ) )&& is_numeric( $iSessArtPerPage ) ) {
01284             // M45 Possibility to push any "Show articles per page" number parameter
01285             $iNrofCatArticles = ( in_array( $iSessArtPerPage, $aNrofCatArticles ) ) ? $iSessArtPerPage : $iNrofCatArticles;
01286             $oViewConf->setViewConfigParam( 'iartPerPage', $iSessArtPerPage );
01287             $iNrofCatArticles = $iSessArtPerPage;
01288         } else {
01289             $oViewConf->setViewConfigParam( 'iartPerPage', $iNrofCatArticles );
01290         }
01291 
01292         //setting number of articles per page to config value
01293         $myConfig->setConfigParam( 'iNrofCatArticles', $iNrofCatArticles );
01294 
01295         $this->_aViewData = array_merge( $this->_aViewData, $aViewData );
01296     }
01297 
01303     protected function _getSeoObjectId()
01304     {
01305     }
01306 
01316     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
01317     {
01318         if ( $sMeta ) {
01319 
01320             $oStr = getStr();
01321             if ( $iLength != -1 ) {
01322                 /* *
01323                  * performance - we dont need a huge amount of initial text.
01324                  * assume that effective text may be double longer than $iLength
01325                  * and simple turncate it
01326                  */
01327                 $iELength = ( $iLength * 2 );
01328                 $sMeta = $oStr->substr( $sMeta, 0, $iELength );
01329             }
01330 
01331             // decoding html entities
01332             $sMeta = $oStr->html_entity_decode( $sMeta );
01333             // stripping HTML tags
01334             $sMeta = strip_tags( $sMeta );
01335 
01336             // removing some special chars
01337             $sMeta = $oStr->cleanStr( $sMeta );
01338 
01339             // removing duplicate words
01340             if ( !$blDescTag ) {
01341                 $sMeta = $this->_removeDuplicatedWords( $sMeta );
01342             }
01343 
01344             // some special cases
01345             $sMeta = str_replace( ' ,', ',', $sMeta );
01346             $aPattern = array( "/,[\s\+\-\*]*,/", "/\s+,/" );
01347             $sMeta = preg_replace( $aPattern, ',', $sMeta );
01348             $sMeta = oxUtilsString::getInstance()->minimizeTruncateString( $sMeta, $iLength );
01349 
01350             return trim( $sMeta );
01351         }
01352     }
01353 
01361     protected function _prepareMetaKeyword( $sKeywords )
01362     {
01363         $sString = $this->_prepareMetaDescription( $sKeywords, -1, true );
01364         $sString = $this->_removeDuplicatedWords( $sString );
01365         // removing in admin defined strings
01366         $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
01367         if ( is_array( $aSkipTags ) && $sString ) {
01368             $oStr = getStr();
01369             foreach ( $aSkipTags as $sSkip ) {
01370                 //$aPattern = array( '/\W'.$sSkip.'\W/iu', '/^'.$sSkip.'\W/iu', '/\"'.$sSkip.'$/iu' );
01371                 //$aPattern = array( '/\s+'.$sSkip.'\,/iu', '/^'.$sSkip.'\s+/iu', '/\"\s+'.$sSkip.'$/iu' );
01372                 $aPattern = array( '/\s+'.$sSkip.'\,/i', '/^'.$sSkip.',\s+/i', '/\",\s+'.$sSkip.'$/i' );
01373                 $sString  = $oStr->preg_replace( $aPattern, '', $sString );
01374             }
01375         }
01376         return trim( $sString );
01377     }
01378 
01386     protected function _removeDuplicatedWords( $aInput )
01387     {
01388         $oStr = getStr();
01389         if ( is_array( $aInput ) ) {
01390             $aStrings = $aInput;
01391         } else {
01392             //is String
01393             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01394         }
01395 
01396         foreach ( $aStrings as $iANum => $sAString ) {
01397             $sAString = $oStr->strtolower( $sAString );
01398             foreach ( $aStrings as $iBNum => $sBString ) {
01399                 // duplicates
01400                 $sBString = $oStr->strtolower( $sBString );
01401                 if ( $sAString && $iANum != $iBNum && strcmp( $sAString, $sBString ) === 0 ) {
01402                     unset( $aStrings[$iANum] );
01403                 }
01404             }
01405         }
01406 
01407         return implode( ', ', $aStrings );
01408     }
01409 
01417     public function getNavigationParams()
01418     {
01419         $aParams['cnid'] = $this->getCategoryId();
01420         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01421 
01422         $aParams['listtype'] = $this->getListType();
01423         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01424 
01425         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01426         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01427         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01428 
01429         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01430         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01431         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01432 
01433         return $aParams;
01434     }
01435 
01445     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01446     {
01447         $aSorting = oxSession::getVar( 'aSorting' );
01448         $aSorting[$sCnid]['sortby']  = $sSortBy;
01449         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01450 
01451         oxSession::setVar( 'aSorting', $aSorting );
01452     }
01453 
01461     public function getSorting( $sCnid )
01462     {
01463         $aSorting = oxSession::getVar( 'aSorting' );
01464         if ( isset( $aSorting[$sCnid] ) ) {
01465             return $aSorting[$sCnid];
01466         }
01467     }
01468 
01476     public function getSortingSql( $sCnid )
01477     {
01478         $aSorting = $this->getSorting( $sCnid );
01479         if ( is_array( $aSorting ) ) {
01480             return implode( " ", $aSorting );
01481         }
01482     }
01483 
01489     public function getTitleSuffix()
01490     {
01491         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01492     }
01493 
01500     public function getTitlePrefix()
01501     {
01502         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01503     }
01504 
01511     protected function _getSubject()
01512     {
01513         return null;
01514     }
01515 
01521     public function getDynUrlParams()
01522     {
01523         $sRet = '';
01524         $sListType = $this->getListType();
01525 
01526         switch ($sListType) {
01527             default:
01528                 break;
01529             case 'search':
01530                 $sRet .= "&amp;listtype={$sListType}";
01531                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01532                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01533                 }
01534 
01535                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01536                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01537                 }
01538                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01539                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01540                 }
01541                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01542                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01543                 }
01544                break;
01545             case 'tag':
01546                 $sRet .= "&amp;listtype={$sListType}";
01547                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01548                     $sRet .= "&amp;searchtag={$sParam}";
01549                 }
01550                break;
01551         }
01552 
01553         return $sRet;
01554     }
01555 
01563     public function getLink( $iLang = null )
01564     {
01565         if ( !isset( $iLang ) ) {
01566             $iLang = oxLang::getInstance()->getBaseLanguage();
01567         }
01568 
01569         $oDisplayObj = null;
01570         if ( oxUtils::getInstance()->seoIsActive() ) {
01571             $blTrySeo = true;
01572             $oDisplayObj = $this->_getSubject();
01573         }
01574         $iActPageNr = $this->getActPage();
01575 
01576         if ( $oDisplayObj ) {
01577 
01578             // if languages do not match object must be reload, but reference to view object should be broken
01579             if ( $oDisplayObj->getLanguage() != $iLang ) {
01580                 $sOxId = $oDisplayObj->getId();
01581                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01582                 $oDisplayObj->load( $sOxId );
01583             }
01584 
01585             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01586         } else {
01587             $myConfig = $this->getConfig();
01588 
01589             if ( $blTrySeo ) {
01590                 $oEncoder = oxSeoEncoder::getInstance();
01591                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01592                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01593                 }
01594             }
01595 
01596             $sForceLangChange = '';
01597             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01598                 $sForceLangChange = "&amp;lang={$iLang}";
01599             }
01600 
01601             // fallback to old non seo url
01602             return $this->_addPageNrParam( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange, $iActPageNr, $iLang );
01603         }
01604     }
01605 
01612     public function getSimilarRecommLists()
01613     {
01614     }
01615 
01623     protected function _getRequestParams( $blAddPageNr  = true )
01624     {
01625         $sClass = $this->getClassName();
01626         $sFnc   = $this->getFncName();
01627 
01628         // #921 S
01629         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01630         if ( in_array( $sFnc, $aFnc ) ) {
01631             $sFnc = '';
01632         }
01633 
01634         // #680
01635         $sURL = "cl={$sClass}";
01636         if ( $sFnc ) {
01637             $sURL .= "&amp;fnc={$sFnc}";
01638         }
01639         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01640             $sURL .= "&amp;cnid={$sVal}";
01641         }
01642         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01643             $sURL .= "&amp;mnid={$sVal}";
01644         }
01645         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01646             $sURL .= "&amp;anid={$sVal}";
01647         }
01648 
01649         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01650             $sURL .= "&amp;page={$sVal}";
01651         }
01652 
01653         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01654             $sURL .= "&amp;tpl={$sVal}";
01655         }
01656 
01657         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01658         // don't include page number for navigation
01659         // it will be done in oxubase::generatePageNavigation
01660         if ( $blAddPageNr && $iPgNr > 0 ) {
01661             $sURL .= "&amp;pgNr={$iPgNr}";
01662         }
01663 
01664         // #1184M - specialchar search
01665         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01666             $sURL .= "&amp;searchparam={$sVal}";
01667         }
01668 
01669         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01670             $sURL .= "&amp;searchcnid={$sVal}";
01671         }
01672 
01673         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01674             $sURL .= "&amp;searchvendor={$sVal}";
01675         }
01676 
01677         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01678             $sURL .= "&amp;searchmanufacturer={$sVal}";
01679         }
01680 
01681         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01682             $sURL .= "&amp;searchrecomm={$sVal}";
01683         }
01684 
01685         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01686             $sURL .= "&amp;searchtag={$sVal}";
01687         }
01688 
01689         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01690             $sURL .= "&amp;recommid={$sVal}";
01691         }
01692 
01693         return $sURL;
01694     }
01695 
01701     protected function _getSeoRequestParams()
01702     {
01703         $sClass = $this->getClassName();
01704         $sFnc   = $this->getFncName();
01705 
01706         // #921 S
01707         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01708         if ( in_array( $sFnc, $aFnc ) ) {
01709             $sFnc = '';
01710         }
01711 
01712         // #680
01713         $sURL = "cl={$sClass}";
01714         if ( $sFnc ) {
01715             $sURL .= "&amp;fnc={$sFnc}";
01716         }
01717         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01718             $sURL .= "&amp;page={$sVal}";
01719         }
01720 
01721         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01722             $sURL .= "&amp;tpl={$sVal}";
01723         }
01724 
01725         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01726         if ( $iPgNr > 0 ) {
01727             $sURL .= "&amp;pgNr={$iPgNr}";
01728         }
01729 
01730         return $sURL;
01731     }
01732 
01738     public function showSearch()
01739     {
01740         $blShow = true;
01741         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01742             $blShow = false;
01743         }
01744         return (int) $blShow;
01745     }
01746 
01752     public function getRssLinks()
01753     {
01754         return $this->_aRssLinks;
01755     }
01756 
01762     public function getSortColumns()
01763     {
01764         return $this->_aSortColumns;
01765     }
01766 
01772     public function getEditTags()
01773     {
01774     }
01775 
01781     public function getRecommSearch()
01782     {
01783     }
01784 
01790     public function getReviewUserId()
01791     {
01792     }
01793 
01799     public function getPaymentList()
01800     {
01801     }
01802 
01808     public function getActiveRecommList()
01809     {
01810     }
01811 
01817     public function getAccessoires()
01818     {
01819     }
01820 
01826     public function getCrossSelling()
01827     {
01828     }
01829 
01835     public function getSimilarProducts()
01836     {
01837     }
01838 
01844     public function getAlsoBoughtThiesProducts()
01845     {
01846     }
01847 
01853     public function getArticleId()
01854     {
01855     }
01856 
01862     public function isMoreTagsVisible()
01863     {
01864         return false;
01865     }
01866 
01872     public function getTitle()
01873     {
01874     }
01875 
01881     public function getActiveLangAbbr()
01882     {
01883         // Performance
01884         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01885             return;
01886         }
01887 
01888         if ( !isset($this->_sActiveLangAbbr ) ) {
01889             $aLanguages = oxLang::getInstance()->getLanguageArray();
01890             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01891                 if ( $oVal->selected ) {
01892                     $this->_sActiveLangAbbr = $oVal->abbr;
01893                     break;
01894                 }
01895             }
01896         }
01897 
01898         return $this->_sActiveLangAbbr;
01899     }
01900 
01914     public function addGlobalParams( $oShop = null)
01915     {
01916         $myConfig = $this->getConfig();
01917 
01918         $oViewConf = parent::addGlobalParams( $oShop );
01919 
01920         $this->_aViewData['isfiltering'] = true;
01921         $this->_aViewData['isnewsletter'] = true;
01922         $this->_aViewData['isvarianten'] = true;
01923         $this->_aViewData['isreview'] = true;
01924         $this->_aViewData['isaddsales'] = true;
01925         $this->_aViewData['isvoucher'] = true;
01926         $this->_aViewData['ispricealarm'] = true;
01927         $this->_aViewData['iswishlist'] = true;
01928         $this->_aViewData['isipayment'] = true;
01929         $this->_aViewData['istrusted'] = true;
01930         $this->_aViewData['isfiltering'] = true;
01931         $this->_aViewData['isgooglestats'] = true;
01932         $this->_aViewData['iswishlist'] = true;
01933 
01934 
01935         // show baskets
01936         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01937         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01938         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01939 
01940         // allow currency swiching
01941         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01942 
01943         // show/hide vendors
01944         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01945 
01946         // show/hide Manufacturers
01947         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01948 
01949         // show/hide empty categories
01950         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01951 
01952         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01953 
01954         // used for compatibility with older templates
01955         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01956         $this->_aViewData['urlsign']    = '&';
01957         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01958         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01959 
01960         $this->_aViewData['sListType'] = $this->getListType();
01961         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01962 
01963         // new navigation ?
01964         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01965         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01966 
01967         $this->_setNrOfArtPerPage();
01968 
01969 
01970         return $oViewConf;
01971     }
01972 
01978     public function getAdditionalParams()
01979     {
01980         if ( $this->_sAdditionalParams === null ) {
01981             // #1018A
01982             $this->_sAdditionalParams  = parent::getAdditionalParams();
01983             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01984 
01985             // #1834M - specialchar search
01986             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01987             if ( isset( $sSearchParamForLink ) ) {
01988                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01989             }
01990             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01991                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01992             }
01993             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01994                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01995             }
01996             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01997                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01998             }
01999             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02000                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02001             }
02002             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02003                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02004             }
02005             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02006                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02007             }
02008         }
02009 
02010         return $this->_sAdditionalParams;
02011     }
02012 
02018     protected function _setListType()
02019     {
02020         if ( !oxConfig::getParameter( 'listtype' ) && isset( $this->_sListType ) ) {
02021             $this->getConfig()->setGlobalParameter( 'listtype', $this->_sListType );
02022         }
02023     }
02024 
02032     public function generatePageNavigationUrl()
02033     {
02034 //        $sClass = $this->_sThisAction;
02035         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02036     }
02037 
02047     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02048     {
02049         if ( $iPage ) {
02050             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02051         }
02052         return $sUrl;
02053     }
02054 
02060     public function generatePageNavigation( )
02061     {
02062         startProfile('generatePageNavigation');
02063         // generate the page navigation
02064         $pageNavigation = new stdClass();
02065         $pageNavigation->NrOfPages = $this->_iCntPages;
02066         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02067         $iActPage = $this->getActPage();
02068         $pageNavigation->actPage   = $iActPage + 1;
02069 
02070         $sUrl = $this->generatePageNavigationUrl( );
02071 
02072         if ( $iActPage > 0) {
02073             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02074         }
02075 
02076         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02077             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02078         }
02079 
02080         if ( $pageNavigation->NrOfPages > 1 ) {
02081             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02082                 $page = new Oxstdclass();
02083                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02084                 $page->selected = 0;
02085                 if ( $i == $pageNavigation->actPage ) {
02086                     $page->selected = 1;
02087                 }
02088                 $pageNavigation->changePage[$i] = $page;
02089             }
02090 
02091             // first/last one
02092             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02093             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02094         }
02095 
02096         stopProfile('generatePageNavigation');
02097 
02098         return $pageNavigation;
02099     }
02100 
02106     public function prepareMinimumOrderPrice4View()
02107     {
02108         $myConfig = $this->getConfig();
02109         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02110         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02111             $oBasket = $this->getSession()->getBasket();
02112             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02113                 return;
02114             }
02115             $oCur    = $myConfig->getActShopCurrencyObject();
02116             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02117             // Coupons and discounts should be considered in "Min order price" check
02118             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02119                 $this->_iLowOrderPrice = 1;
02120                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02121             }
02122         }
02123     }
02124 
02131     public function render()
02132     {
02133         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02134             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02135         }
02136 
02137         parent::render();
02138 
02139         if ( $this->getIsOrderStep() ) {
02140 
02141             // min. order price check
02142             $this->prepareMinimumOrderPrice4View();
02143 
02144             // disabling navigation during order ...
02145             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02146                 $this->_iNewsRealStatus = 1;
02147                 $this->setShowNewsletter( 0 );
02148                 // for old tpl. will be removed later
02149                 $this->_aViewData['isnewsletter'] = 0;
02150                 $this->setShowRightBasket( 0 );
02151                 $this->setShowLeftBasket( 0 );
02152                 $this->setShowTopBasket( 0 );
02153             }
02154             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02155             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02156         }
02157 
02158         // meta data
02159         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02160         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02161 
02162         // show baskets
02163         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02164         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02165         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02166 
02167         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02168 
02169         $this->_aViewData['noindex'] = $this->noIndex();
02170 
02171         return $this->_sThisTemplate;
02172     }
02173 
02179     public function getViewProduct()
02180     {
02181         return $this->getProduct();
02182     }
02183 
02191     public function setViewProduct( $oProduct )
02192     {
02193         $this->_oProduct = $oProduct;
02194     }
02195 
02201     public function getViewProductList()
02202     {
02203         return $this->_aArticleList;
02204     }
02205 
02211     public function getActPage()
02212     {
02213         if ( $this->_iActPage === null ) {
02214             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02215             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02216         }
02217         return $this->_iActPage;
02218     }
02219 
02227     public function getActCategory()
02228     {
02229         // if active category is not set yet - trying to load it from request params
02230         // this may be usefull when category component was unable to load active category
02231         // and we still need some object to mount navigation info
02232         if ( $this->_oClickCat === null ) {
02233 
02234             $this->_oClickCat = false;
02235             $oCategory = oxNew( 'oxcategory' );
02236             if ( $oCategory->load( $this->getCategoryId() ) ) {
02237                 $this->_oClickCat = $oCategory;
02238             }
02239         }
02240 
02241         return $this->_oClickCat;
02242     }
02243 
02251     public function setActCategory( $oCategory )
02252     {
02253         $this->_oClickCat = $oCategory;
02254     }
02255 
02263     public function getActTag()
02264     {
02265         if ( $this->_oActTag === null ) {
02266             $this->_oActTag = new Oxstdclass();
02267             $this->_oActTag->sTag = oxConfig::getParameter("searchtag", 1);
02268 
02269             $sUrl = $this->getConfig()->getShopHomeURL();
02270             $this->_oActTag->link = "{$sUrl}cl=tag";
02271         }
02272         return $this->_oActTag;
02273     }
02274 
02282     public function getActVendor()
02283     {
02284         // if active vendor is not set yet - trying to load it from request params
02285         // this may be usefull when category component was unable to load active vendor
02286         // and we still need some object to mount navigation info
02287         if ( $this->_oActVendor === null ) {
02288             $this->_oActVendor = false;
02289             $sVendorId = oxConfig::getParameter( 'cnid' );
02290             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02291             if ( 'root' == $sVendorId ) {
02292                 $this->_oActVendor = oxVendor::getRootVendor();
02293             } elseif ( $sVendorId ) {
02294                 $oVendor = oxNew( 'oxvendor' );
02295                 if ( $oVendor->load( $sVendorId ) ) {
02296                     $this->_oActVendor = $oVendor;
02297                 }
02298             }
02299         }
02300 
02301         return $this->_oActVendor;
02302     }
02303 
02311     public function getActManufacturer()
02312     {
02313         // if active Manufacturer is not set yet - trying to load it from request params
02314         // this may be usefull when category component was unable to load active Manufacturer
02315         // and we still need some object to mount navigation info
02316         if ( $this->_oActManufacturer === null ) {
02317 
02318             $this->_oActManufacturer = false;
02319             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02320             if ( 'root' == $sManufacturerId ) {
02321                 $this->_oActManufacturer = oxManufacturer::getRootManufacturer();
02322             } elseif ( $sManufacturerId ) {
02323                 $oManufacturer = oxNew( 'oxmanufacturer' );
02324                 if ( $oManufacturer->load( $sManufacturerId ) ) {
02325                     $this->_oActManufacturer = $oManufacturer;
02326                 }
02327             }
02328         }
02329 
02330         return $this->_oActManufacturer;
02331     }
02332 
02340     public function setActVendor( $oVendor )
02341     {
02342         $this->_oActVendor = $oVendor;
02343     }
02344 
02352     public function setActManufacturer( $oManufacturer )
02353     {
02354         $this->_oActManufacturer = $oManufacturer;
02355     }
02356 
02362     public function getActSearch()
02363     {
02364         if ( $this->_oActSearch === null ) {
02365             $this->_oActSearch = new oxStdClass();
02366             $sUrl = $this->getConfig()->getShopHomeURL();
02367             $this->_oActSearch->link = "{$sUrl}cl=search";
02368         }
02369         return $this->_oActSearch;
02370     }
02371 
02377     public function getActRecommList()
02378     {
02379         if ( $this->_oActRecomm === null ) {
02380             $this->_oActRecomm = false;
02381             $sRecommId = oxConfig::getParameter( 'recommid' );
02382 
02383             $oRecommList = oxNew( 'oxrecommlist' );
02384 
02385             if ( $oRecommList->load( $sRecommId ) ) {
02386                 $this->_oActRecomm = $oRecommList;
02387             }
02388         }
02389         return $this->_oActRecomm;
02390     }
02391 
02397     public function getCategoryTree()
02398     {
02399         return $this->_oCategoryTree;
02400     }
02401 
02409     public function setCategoryTree( $oCatTree )
02410     {
02411         $this->_oCategoryTree = $oCatTree;
02412     }
02413 
02419     public function getVendorTree()
02420     {
02421         return $this->_oVendorTree;
02422     }
02423 
02431     public function setVendorTree( $oVendorTree )
02432     {
02433         $this->_oVendorTree = $oVendorTree;
02434     }
02435 
02441     public function getManufacturerTree()
02442     {
02443         return $this->_oManufacturerTree;
02444     }
02445 
02453     public function setManufacturerTree( $oManufacturerTree )
02454     {
02455         $this->_oManufacturerTree = $oManufacturerTree;
02456     }
02466     protected function _loadActions()
02467     {
02468         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02469         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02470     }
02471 
02480     public function setSessionCategoryId( $sCategoryId )
02481     {
02482         oxSession::setVar( 'cnid', $sCategoryId );
02483     }
02484 
02490     public function getSessionCategoryId()
02491     {
02492         return oxSession::getVar( 'cnid' );
02493     }
02494 
02500     protected function _processListArticles()
02501     {
02502         $sAddParams = $this->getAddUrlParams();
02503         if ( $sAddParams && $this->_aArticleList ) {
02504             foreach ( $this->_aArticleList as $oArticle ) {
02505                 $oArticle->appendLink( $sAddParams );
02506             }
02507         }
02508     }
02509 
02515     public function getAddUrlParams()
02516     {
02517     }
02518 
02525     public function getTop5ArticleList()
02526     {
02527         if ( !$this->_blTop5Action ) {
02528             return null;
02529         }
02530 
02531         if ( $this->_aTop5ArticleList === null ) {
02532             $this->_aTop5ArticleList = false;
02533             $myConfig = $this->getConfig();
02534             if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02535                 // top 5 articles
02536                 $oArtList = oxNew( 'oxarticlelist' );
02537                 $oArtList->loadTop5Articles();
02538                 if ( $oArtList->count() ) {
02539                     $this->_aTop5ArticleList = $oArtList;
02540                 }
02541             }
02542         }
02543         return $this->_aTop5ArticleList;
02544     }
02545 
02552     public function getBargainArticleList()
02553     {
02554         if ( !$this->_blBargainAction ) {
02555             return null;
02556         }
02557 
02558         if ( $this->_aBargainArticleList === null ) {
02559             $this->_aBargainArticleList = array();
02560             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02561                 $oArtList = oxNew( 'oxarticlelist' );
02562                 $oArtList->loadAktionArticles( 'OXBARGAIN' );
02563                 if ( $oArtList->count() ) {
02564                     $this->_aBargainArticleList = $oArtList;
02565                 }
02566             }
02567         }
02568         return $this->_aBargainArticleList;
02569     }
02570 
02576     public function isLowOrderPrice()
02577     {
02578         return $this->_iLowOrderPrice;
02579     }
02580 
02586     public function getMinOrderPrice()
02587     {
02588         return $this->_sMinOrderPrice;
02589     }
02590 
02596     public function getNewsRealStatus()
02597     {
02598         return $this->_iNewsRealStatus;
02599     }
02600 
02606     protected function _canRedirect()
02607     {
02608         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02609             if ( oxConfig::getParameter( $sParam ) !== null ) {
02610                 return false;
02611             }
02612         }
02613 
02614         return true;
02615     }
02616 
02622     public function getProduct()
02623     {
02624     }
02625 
02631     public function getVendorlist()
02632     {
02633         return $this->_aVendorlist;
02634     }
02635 
02643     public function setVendorlist( $aList )
02644     {
02645         $this->_aVendorlist = $aList;
02646     }
02647 
02653     public function getManufacturerlist()
02654     {
02655         return $this->_aManufacturerlist;
02656     }
02657 
02665     public function setManufacturerlist( $aList )
02666     {
02667         $this->_aManufacturerlist = $aList;
02668     }
02669 
02677     public function setRootVendor( $oVendor )
02678     {
02679         $this->_oRootVendor = $oVendor;
02680     }
02681 
02687     public function getRootVendor()
02688     {
02689         return $this->_oRootVendor;
02690     }
02691 
02699     public function setRootManufacturer( $oManufacturer )
02700     {
02701         $this->_oRootManufacturer = $oManufacturer;
02702     }
02703 
02709     public function getRootManufacturer()
02710     {
02711         return $this->_oRootManufacturer;
02712     }
02713 
02719     public function getVendorId()
02720     {
02721         if ( $this->_sVendorId === null ) {
02722             $this->_sVendorId = false;
02723             if ( ( $oVendor = $this->getActVendor() ) ) {
02724                 $this->_sVendorId = $oVendor->getId();
02725             }
02726         }
02727         return $this->_sVendorId;
02728     }
02729 
02735     public function getManufacturerId()
02736     {
02737         if ( $this->_sManufacturerId === null ) {
02738             $this->_sManufacturerId = false;
02739             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02740                 $this->_sManufacturerId = $oManufacturer->getId();
02741             }
02742         }
02743         return $this->_sManufacturerId;
02744     }
02745 
02751     public function getSearchCatTree()
02752     {
02753         return $this->_aSearchCatTree;
02754     }
02755 
02763     public function setSearchCatTree( $aTree )
02764     {
02765         $this->_aSearchCatTree = $aTree;
02766     }
02767 
02773     public function getCatMore()
02774     {
02775         return $this->_oCatMore;
02776     }
02777 
02785     public function setCatMore( $oCat )
02786     {
02787         $this->_oCatMore = $oCat;
02788     }
02789 
02795     public function isNewsSubscribed()
02796     {
02797         return $this->_blNewsSubscribed;
02798     }
02799 
02807     public function setNewsSubscribed( $blNewsSubscribed )
02808     {
02809         $this->_blNewsSubscribed = $blNewsSubscribed;
02810     }
02811 
02817     public function showShipAddress()
02818     {
02819         return $this->_blShowShipAddress;
02820     }
02821 
02829     public function setShowShipAddress( $blShowShipAddress )
02830     {
02831         $this->_blShowShipAddress = $blShowShipAddress;
02832     }
02833 
02839     public function getDelAddress()
02840     {
02841         return $this->_oDelAddress;
02842     }
02843 
02851     public function setDelAddress( $oDelAddress )
02852     {
02853         $this->_oDelAddress = $oDelAddress;
02854     }
02855 
02861     public function getCatTreePath()
02862     {
02863         return $this->_sCatTreePath;
02864     }
02865 
02873     public function getContentByIdent( $sIdent )
02874     {
02875         if ( !isset( $this->_aContents[$sIdent] ) ) {
02876             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02877             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02878         }
02879         return $this->_aContents[$sIdent];
02880     }
02881 
02887     public function getContentCategory()
02888     {
02889         return false;
02890     }
02891 }

Generated on Tue Apr 21 15:45:45 2009 for OXID eShop CE by  doxygen 1.5.5