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, false );
01363         $aSkipTags = $this->getConfig()->getConfigParam( 'aSkipTags' );
01364         $sString = $this->_removeDuplicatedWords( $sString, $aSkipTags );
01365         // removing in admin defined strings
01366         
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 
01387     protected function _removeDuplicatedWords( $aInput, $aSkipTags = array() )
01388     {
01389         $oStr = getStr();
01390         if ( is_array( $aInput ) ) {
01391             $aStrings = $aInput;
01392         } else {
01393             //is String
01394             $aStrings = $oStr->preg_split( "/[\s,]+/", $aInput );
01395         }
01396 
01397         if ( $sCount = count( $aSkipTags ) ) {
01398             for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01399                 $aSkipTags[$iNum] = $oStr->strtolower( $aSkipTags[$iNum] );
01400             }
01401         }
01402         $sCount = count($aStrings);
01403         for ( $iNum = 0; $iNum < $sCount; $iNum++ ) {
01404             $aStrings[$iNum] = $oStr->strtolower( $aStrings[$iNum] );
01405             // removing in admin defined strings
01406             if ( in_array( $aStrings[$iNum], $aSkipTags ) ) {
01407                 unset( $aStrings[$iNum] );
01408             }
01409         }
01410 
01411         // duplicates
01412         $aStrings = array_unique($aStrings);
01413 
01414         return implode( ', ', $aStrings );
01415     }
01416 
01424     public function getNavigationParams()
01425     {
01426         $aParams['cnid'] = $this->getCategoryId();
01427         $aParams['mnid'] = oxConfig::getParameter( 'mnid' );
01428 
01429         $aParams['listtype'] = $this->getListType();
01430         $aParams['recommid'] = oxConfig::getParameter( 'recommid' );
01431 
01432         $aParams['searchrecomm'] = oxConfig::getParameter( 'searchrecomm', true );
01433         $aParams['searchparam']  = oxConfig::getParameter( 'searchparam', true );
01434         $aParams['searchtag']    = oxConfig::getParameter( 'searchtag', true );
01435 
01436         $aParams['searchvendor'] = oxConfig::getParameter( 'searchvendor' );
01437         $aParams['searchcnid']   = oxConfig::getParameter( 'searchcnid' );
01438         $aParams['searchmanufacturer'] = oxConfig::getParameter( 'searchmanufacturer' );
01439 
01440         return $aParams;
01441     }
01442 
01452     public function setItemSorting( $sCnid, $sSortBy, $sSortDir = null )
01453     {
01454         $aSorting = oxSession::getVar( 'aSorting' );
01455         $aSorting[$sCnid]['sortby']  = $sSortBy;
01456         $aSorting[$sCnid]['sortdir'] = $sSortDir?$sSortDir:null;
01457 
01458         oxSession::setVar( 'aSorting', $aSorting );
01459     }
01460 
01468     public function getSorting( $sCnid )
01469     {
01470         $aSorting = oxSession::getVar( 'aSorting' );
01471         if ( isset( $aSorting[$sCnid] ) ) {
01472             return $aSorting[$sCnid];
01473         }
01474     }
01475 
01483     public function getSortingSql( $sCnid )
01484     {
01485         $aSorting = $this->getSorting( $sCnid );
01486         if ( is_array( $aSorting ) ) {
01487             return implode( " ", $aSorting );
01488         }
01489     }
01490 
01496     public function getTitleSuffix()
01497     {
01498         return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
01499     }
01500 
01507     public function getTitlePrefix()
01508     {
01509         return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
01510     }
01511 
01518     protected function _getSubject()
01519     {
01520         return null;
01521     }
01522 
01528     public function getDynUrlParams()
01529     {
01530         $sRet = '';
01531         $sListType = $this->getListType();
01532 
01533         switch ($sListType) {
01534             default:
01535                 break;
01536             case 'search':
01537                 $sRet .= "&amp;listtype={$sListType}";
01538                 if ( $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01539                     $sRet .= "&amp;searchparam={$sSearchParamForLink}";
01540                 }
01541 
01542                 if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
01543                     $sRet .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
01544                 }
01545                 if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
01546                     $sRet .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
01547                 }
01548                 if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
01549                     $sRet .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
01550                 }
01551                 break;
01552             case 'tag':
01553                 $sRet .= "&amp;listtype={$sListType}";
01554                 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
01555                     $sRet .= "&amp;searchtag={$sParam}";
01556                 }
01557                 break;
01558         }
01559 
01560         return $sRet;
01561     }
01562 
01570     public function getLink( $iLang = null )
01571     {
01572         if ( !isset( $iLang ) ) {
01573             $iLang = oxLang::getInstance()->getBaseLanguage();
01574         }
01575 
01576         $oDisplayObj = null;
01577         if ( oxUtils::getInstance()->seoIsActive() ) {
01578             $blTrySeo = true;
01579             $oDisplayObj = $this->_getSubject();
01580         }
01581         $iActPageNr = $this->getActPage();
01582 
01583         if ( $oDisplayObj ) {
01584 
01585             // if languages do not match object must be reload, but reference to view object should be broken
01586             if ( $oDisplayObj->getLanguage() != $iLang ) {
01587                 $sOxId = $oDisplayObj->getId();
01588                 $oDisplayObj = oxNew( $oDisplayObj->getClassName() );
01589                 $oDisplayObj->load( $sOxId );
01590             }
01591 
01592             return $this->_addPageNrParam( $oDisplayObj->getLink( $iLang ), $iActPageNr, $iLang );
01593         } else {
01594             $myConfig = $this->getConfig();
01595 
01596             if ( $blTrySeo ) {
01597                 $oEncoder = oxSeoEncoder::getInstance();
01598                 if ( ( $sSeoUrl = $oEncoder->getStaticUrl( $myConfig->getShopHomeURL( $iLang ) . $this->_getSeoRequestParams(), $iLang ) ) ) {
01599                     return $this->_addPageNrParam( $sSeoUrl, $iActPageNr, $iLang );
01600                 }
01601             }
01602 
01603             $sForceLangChange = '';
01604             if ( oxLang::getInstance()->getBaseLanguage() != $iLang ) {
01605                 $sForceLangChange = "&amp;lang={$iLang}";
01606             }
01607 
01608             // fallback to old non seo url
01609             return $this->_addPageNrParam( $myConfig->getShopCurrentURL( $iLang ) . $this->_getRequestParams() . $sForceLangChange, $iActPageNr, $iLang );
01610         }
01611     }
01612 
01619     public function getSimilarRecommLists()
01620     {
01621     }
01622 
01630     protected function _getRequestParams( $blAddPageNr  = true )
01631     {
01632         $sClass = $this->getClassName();
01633         $sFnc   = $this->getFncName();
01634 
01635         // #921 S
01636         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01637         if ( in_array( $sFnc, $aFnc ) ) {
01638             $sFnc = '';
01639         }
01640 
01641         // #680
01642         $sURL = "cl={$sClass}";
01643         if ( $sFnc ) {
01644             $sURL .= "&amp;fnc={$sFnc}";
01645         }
01646         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
01647             $sURL .= "&amp;cnid={$sVal}";
01648         }
01649         if ( $sVal = oxConfig::getParameter( 'mnid' ) ) {
01650             $sURL .= "&amp;mnid={$sVal}";
01651         }
01652         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
01653             $sURL .= "&amp;anid={$sVal}";
01654         }
01655 
01656         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01657             $sURL .= "&amp;page={$sVal}";
01658         }
01659 
01660         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01661             $sURL .= "&amp;tpl={$sVal}";
01662         }
01663 
01664         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01665         // don't include page number for navigation
01666         // it will be done in oxubase::generatePageNavigation
01667         if ( $blAddPageNr && $iPgNr > 0 ) {
01668             $sURL .= "&amp;pgNr={$iPgNr}";
01669         }
01670 
01671         // #1184M - specialchar search
01672         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
01673             $sURL .= "&amp;searchparam={$sVal}";
01674         }
01675 
01676         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
01677             $sURL .= "&amp;searchcnid={$sVal}";
01678         }
01679 
01680         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
01681             $sURL .= "&amp;searchvendor={$sVal}";
01682         }
01683 
01684         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
01685             $sURL .= "&amp;searchmanufacturer={$sVal}";
01686         }
01687 
01688         if ( $sVal = oxConfig::getParameter( 'searchrecomm' ) ) {
01689             $sURL .= "&amp;searchrecomm={$sVal}";
01690         }
01691 
01692         if ( $sVal = oxConfig::getParameter( 'searchtag' ) ) {
01693             $sURL .= "&amp;searchtag={$sVal}";
01694         }
01695 
01696         if ( $sVal = oxConfig::getParameter( 'recommid' ) ) {
01697             $sURL .= "&amp;recommid={$sVal}";
01698         }
01699 
01700         return $sURL;
01701     }
01702 
01708     protected function _getSeoRequestParams()
01709     {
01710         $sClass = $this->getClassName();
01711         $sFnc   = $this->getFncName();
01712 
01713         // #921 S
01714         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
01715         if ( in_array( $sFnc, $aFnc ) ) {
01716             $sFnc = '';
01717         }
01718 
01719         // #680
01720         $sURL = "cl={$sClass}";
01721         if ( $sFnc ) {
01722             $sURL .= "&amp;fnc={$sFnc}";
01723         }
01724         if ( $sVal = basename( oxConfig::getParameter( 'page' ) ) ) {
01725             $sURL .= "&amp;page={$sVal}";
01726         }
01727 
01728         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
01729             $sURL .= "&amp;tpl={$sVal}";
01730         }
01731 
01732         $iPgNr = (int) oxConfig::getParameter( 'pgNr' );
01733         if ( $iPgNr > 0 ) {
01734             $sURL .= "&amp;pgNr={$iPgNr}";
01735         }
01736 
01737         return $sURL;
01738     }
01739 
01745     public function showSearch()
01746     {
01747         $blShow = true;
01748         if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) && $this->getIsOrderStep() ) {
01749             $blShow = false;
01750         }
01751         return (int) $blShow;
01752     }
01753 
01759     public function getRssLinks()
01760     {
01761         return $this->_aRssLinks;
01762     }
01763 
01769     public function getSortColumns()
01770     {
01771         return $this->_aSortColumns;
01772     }
01773 
01779     public function getEditTags()
01780     {
01781     }
01782 
01788     public function getRecommSearch()
01789     {
01790     }
01791 
01797     public function getReviewUserId()
01798     {
01799     }
01800 
01806     public function getPaymentList()
01807     {
01808     }
01809 
01815     public function getActiveRecommList()
01816     {
01817     }
01818 
01824     public function getAccessoires()
01825     {
01826     }
01827 
01833     public function getCrossSelling()
01834     {
01835     }
01836 
01842     public function getSimilarProducts()
01843     {
01844     }
01845 
01851     public function getAlsoBoughtThiesProducts()
01852     {
01853     }
01854 
01860     public function getArticleId()
01861     {
01862     }
01863 
01869     public function isMoreTagsVisible()
01870     {
01871         return false;
01872     }
01873 
01879     public function getTitle()
01880     {
01881     }
01882 
01888     public function getActiveLangAbbr()
01889     {
01890         // Performance
01891         if ( !$this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
01892             return;
01893         }
01894 
01895         if ( !isset($this->_sActiveLangAbbr ) ) {
01896             $aLanguages = oxLang::getInstance()->getLanguageArray();
01897             while ( list( $sKey, $oVal ) = each( $aLanguages ) ) {
01898                 if ( $oVal->selected ) {
01899                     $this->_sActiveLangAbbr = $oVal->abbr;
01900                     break;
01901                 }
01902             }
01903         }
01904 
01905         return $this->_sActiveLangAbbr;
01906     }
01907 
01921     public function addGlobalParams( $oShop = null)
01922     {
01923         $myConfig = $this->getConfig();
01924 
01925         $oViewConf = parent::addGlobalParams( $oShop );
01926 
01927         $this->_aViewData['isfiltering'] = true;
01928         $this->_aViewData['isnewsletter'] = true;
01929         $this->_aViewData['isvarianten'] = true;
01930         $this->_aViewData['isreview'] = true;
01931         $this->_aViewData['isaddsales'] = true;
01932         $this->_aViewData['isvoucher'] = true;
01933         $this->_aViewData['ispricealarm'] = true;
01934         $this->_aViewData['iswishlist'] = true;
01935         $this->_aViewData['isipayment'] = true;
01936         $this->_aViewData['istrusted'] = true;
01937         $this->_aViewData['isfiltering'] = true;
01938         $this->_aViewData['isgooglestats'] = true;
01939         $this->_aViewData['iswishlist'] = true;
01940 
01941 
01942         // show baskets
01943         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
01944         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
01945         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
01946 
01947         // allow currency swiching
01948         $this->_aViewData['bl_perfLoadCurrency'] = $this->loadCurrency();
01949 
01950         // show/hide vendors
01951         $this->_aViewData['bl_perfLoadVendorTree'] = $this->loadVendorTree();
01952 
01953         // show/hide Manufacturers
01954         $this->_aViewData['bl_perfLoadManufacturerTree'] = $this->loadManufacturerTree();
01955 
01956         // show/hide empty categories
01957         $this->_aViewData['blDontShowEmptyCategories'] = $this->dontShowEmptyCategories();
01958 
01959         $this->_aViewData['iShopID_TrustedShops'] = $this->getTrustedShopId();
01960 
01961         // used for compatibility with older templates
01962         $this->_aViewData['fixedwidth'] = $myConfig->getConfigParam( 'blFixedWidthLayout' );
01963         $this->_aViewData['urlsign']    = '&';
01964         $this->_aViewData['wishid']    = oxConfig::getParameter( 'wishid' );
01965         $this->_aViewData['shownewbasketmessage'] = oxUtils::getInstance()->isSearchEngine()?0:$myConfig->getConfigParam( 'iNewBasketItemMessage' );
01966 
01967         $this->_aViewData['sListType'] = $this->getListType();
01968         $this->_aViewData['bl_perfLoadLanguage'] = $this->isLanguageLoaded();
01969 
01970         // new navigation ?
01971         $this->_aViewData['showtopcatnavigation']   = $this->showTopCatNavigation();
01972         $this->_aViewData['topcatnavigationitmcnt'] = $this->getTopNavigationCatCnt();
01973 
01974         $this->_setNrOfArtPerPage();
01975 
01976 
01977         return $oViewConf;
01978     }
01979 
01985     public function getAdditionalParams()
01986     {
01987         if ( $this->_sAdditionalParams === null ) {
01988             // #1018A
01989             $this->_sAdditionalParams  = parent::getAdditionalParams();
01990             $this->_sAdditionalParams .= 'cl='.$this->getConfig()->getActiveView()->getClassName();
01991 
01992             // #1834M - specialchar search
01993             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
01994             if ( isset( $sSearchParamForLink ) ) {
01995                 $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
01996             }
01997             if ( ( $sVar = oxConfig::getParameter( 'searchtag' ) ) ) {
01998                 $this->_sAdditionalParams .= '&amp;searchtag='.rawurlencode( rawurldecode( $sVar ) );
01999             }
02000             if ( ( $sVar = oxConfig::getParameter( 'searchcnid' ) ) ) {
02001                 $this->_sAdditionalParams .= '&amp;searchcnid='.rawurlencode( rawurldecode( $sVar ) );
02002             }
02003             if ( ( $sVar = oxConfig::getParameter( 'searchvendor' ) ) ) {
02004                 $this->_sAdditionalParams .= '&amp;searchvendor='.rawurlencode( rawurldecode( $sVar ) );
02005             }
02006             if ( ( $sVar = oxConfig::getParameter( 'searchmanufacturer' ) ) ) {
02007                 $this->_sAdditionalParams .= '&amp;searchmanufacturer='.rawurlencode( rawurldecode( $sVar ) );
02008             }
02009             if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
02010                 $this->_sAdditionalParams .= '&amp;cnid='.rawurlencode( rawurldecode( $sVar ) );
02011             }
02012             if ( ( $sVar = oxConfig::getParameter( 'mnid' ) ) ) {
02013                 $this->_sAdditionalParams .= '&amp;mnid='.rawurlencode( rawurldecode( $sVar ) );
02014             }
02015         }
02016 
02017         return $this->_sAdditionalParams;
02018     }
02019 
02025     protected function _setListType()
02026     {
02027         if ( !oxConfig::getParameter( 'listtype' ) && isset( $this->_sListType ) ) {
02028             $this->getConfig()->setGlobalParameter( 'listtype', $this->_sListType );
02029         }
02030     }
02031 
02037     public function generatePageNavigationUrl()
02038     {
02039         // $sClass = $this->_sThisAction;
02040         return $this->getConfig()->getShopHomeURL().$this->_getRequestParams( false );
02041     }
02042 
02052     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null )
02053     {
02054         if ( $iPage ) {
02055             $sUrl .= ( ( strpos( $sUrl, '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr='.$iPage;
02056         }
02057         return $sUrl;
02058     }
02059 
02065     public function generatePageNavigation( )
02066     {
02067         startProfile('generatePageNavigation');
02068         // generate the page navigation
02069         $pageNavigation = new stdClass();
02070         $pageNavigation->NrOfPages = $this->_iCntPages;
02071         $pageNavigation->iArtCnt   = $this->_iAllArtCnt;
02072         $iActPage = $this->getActPage();
02073         $pageNavigation->actPage   = $iActPage + 1;
02074 
02075         $sUrl = $this->generatePageNavigationUrl( );
02076 
02077         if ( $iActPage > 0) {
02078             $pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
02079         }
02080 
02081         if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
02082             $pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
02083         }
02084 
02085         if ( $pageNavigation->NrOfPages > 1 ) {
02086             for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
02087                 $page = new Oxstdclass();
02088                 $page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
02089                 $page->selected = 0;
02090                 if ( $i == $pageNavigation->actPage ) {
02091                     $page->selected = 1;
02092                 }
02093                 $pageNavigation->changePage[$i] = $page;
02094             }
02095 
02096             // first/last one
02097             $pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
02098             $pageNavigation->lastpage  = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
02099         }
02100 
02101         stopProfile('generatePageNavigation');
02102 
02103         return $pageNavigation;
02104     }
02105 
02111     public function prepareMinimumOrderPrice4View()
02112     {
02113         $myConfig = $this->getConfig();
02114         $iMinOrderPrice = $myConfig->getConfigParam( 'iMinOrderPrice' );
02115         if ( isset( $iMinOrderPrice ) && $iMinOrderPrice) {
02116             $oBasket = $this->getSession()->getBasket();
02117             if ( !$oBasket || ( $oBasket && !$oBasket->getProductsCount() ) ) {
02118                 return;
02119             }
02120             $oCur    = $myConfig->getActShopCurrencyObject();
02121             $dMinOrderPrice = $iMinOrderPrice * $oCur->rate;
02122             // Coupons and discounts should be considered in "Min order price" check
02123             if ( $dMinOrderPrice > ( $oBasket->getDiscountProductsPrice()->getBruttoSum() - $oBasket->getTotalDiscount()->getBruttoPrice() - $oBasket->getVoucherDiscount()->getBruttoPrice()) ) {
02124                 $this->_iLowOrderPrice = 1;
02125                 $this->_sMinOrderPrice = oxLang::getInstance()->formatCurrency( $dMinOrderPrice, $oCur );
02126             }
02127         }
02128     }
02129 
02136     public function render()
02137     {
02138         foreach ( array_keys( $this->_oaComponents ) as $sComponentName ) {
02139             $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
02140         }
02141 
02142         parent::render();
02143 
02144         if ( $this->getIsOrderStep() ) {
02145 
02146             // min. order price check
02147             $this->prepareMinimumOrderPrice4View();
02148 
02149             // disabling navigation during order ...
02150             if ( $this->getConfig()->getConfigParam( 'blDisableNavBars' ) ) {
02151                 $this->_iNewsRealStatus = 1;
02152                 $this->setShowNewsletter( 0 );
02153                 // for old tpl. will be removed later
02154                 $this->_aViewData['isnewsletter'] = 0;
02155                 $this->setShowRightBasket( 0 );
02156                 $this->setShowLeftBasket( 0 );
02157                 $this->setShowTopBasket( 0 );
02158             }
02159             $this->_aViewData['loworderprice'] = $this->isLowOrderPrice();
02160             $this->_aViewData['minorderprice'] = $this->getMinOrderPrice();
02161         }
02162 
02163         // meta data
02164         $this->_aViewData['meta_description'] = $this->getMetaDescription();
02165         $this->_aViewData['meta_keywords']    = $this->getMetaKeywords();
02166 
02167         // show baskets
02168         $this->_aViewData['bl_perfShowLeftBasket']  = $this->showLeftBasket();
02169         $this->_aViewData['bl_perfShowRightBasket'] = $this->showRightBasket();
02170         $this->_aViewData['bl_perfShowTopBasket']   = $this->showTopBasket();
02171 
02172         $this->_aViewData['isnewsletter_truth'] = $this->getNewsRealStatus();
02173 
02174         $this->_aViewData['noindex'] = $this->noIndex();
02175 
02176         return $this->_sThisTemplate;
02177     }
02178 
02184     public function getViewProduct()
02185     {
02186         return $this->getProduct();
02187     }
02188 
02196     public function setViewProduct( $oProduct )
02197     {
02198         $this->_oProduct = $oProduct;
02199     }
02200 
02206     public function getViewProductList()
02207     {
02208         return $this->_aArticleList;
02209     }
02210 
02216     public function getActPage()
02217     {
02218         if ( $this->_iActPage === null ) {
02219             $this->_iActPage = ( int ) oxConfig::getParameter( 'pgNr' );
02220             $this->_iActPage = ( $this->_iActPage < 0 ) ? 0 : $this->_iActPage;
02221         }
02222         return $this->_iActPage;
02223     }
02224 
02232     public function getActCategory()
02233     {
02234         // if active category is not set yet - trying to load it from request params
02235         // this may be usefull when category component was unable to load active category
02236         // and we still need some object to mount navigation info
02237         if ( $this->_oClickCat === null ) {
02238 
02239             $this->_oClickCat = false;
02240             $oCategory = oxNew( 'oxcategory' );
02241             if ( $oCategory->load( $this->getCategoryId() ) ) {
02242                 $this->_oClickCat = $oCategory;
02243             }
02244         }
02245 
02246         return $this->_oClickCat;
02247     }
02248 
02256     public function setActCategory( $oCategory )
02257     {
02258         $this->_oClickCat = $oCategory;
02259     }
02260 
02268     public function getActTag()
02269     {
02270         if ( $this->_oActTag === null ) {
02271             $this->_oActTag = new Oxstdclass();
02272             $this->_oActTag->sTag = oxConfig::getParameter("searchtag", 1);
02273 
02274             $sUrl = $this->getConfig()->getShopHomeURL();
02275             $this->_oActTag->link = "{$sUrl}cl=tag";
02276         }
02277         return $this->_oActTag;
02278     }
02279 
02287     public function getActVendor()
02288     {
02289         // if active vendor is not set yet - trying to load it from request params
02290         // this may be usefull when category component was unable to load active vendor
02291         // and we still need some object to mount navigation info
02292         if ( $this->_oActVendor === null ) {
02293             $this->_oActVendor = false;
02294             $sVendorId = oxConfig::getParameter( 'cnid' );
02295             $sVendorId = $sVendorId ? str_replace( 'v_', '', $sVendorId ) : $sVendorId;
02296             if ( 'root' == $sVendorId ) {
02297                 $this->_oActVendor = oxVendor::getRootVendor();
02298             } elseif ( $sVendorId ) {
02299                 $oVendor = oxNew( 'oxvendor' );
02300                 if ( $oVendor->load( $sVendorId ) ) {
02301                     $this->_oActVendor = $oVendor;
02302                 }
02303             }
02304         }
02305 
02306         return $this->_oActVendor;
02307     }
02308 
02316     public function getActManufacturer()
02317     {
02318         // if active Manufacturer is not set yet - trying to load it from request params
02319         // this may be usefull when category component was unable to load active Manufacturer
02320         // and we still need some object to mount navigation info
02321         if ( $this->_oActManufacturer === null ) {
02322 
02323             $this->_oActManufacturer = false;
02324             $sManufacturerId = oxConfig::getParameter( 'mnid' );
02325             if ( 'root' == $sManufacturerId ) {
02326                 $this->_oActManufacturer = oxManufacturer::getRootManufacturer();
02327             } elseif ( $sManufacturerId ) {
02328                 $oManufacturer = oxNew( 'oxmanufacturer' );
02329                 if ( $oManufacturer->load( $sManufacturerId ) ) {
02330                     $this->_oActManufacturer = $oManufacturer;
02331                 }
02332             }
02333         }
02334 
02335         return $this->_oActManufacturer;
02336     }
02337 
02345     public function setActVendor( $oVendor )
02346     {
02347         $this->_oActVendor = $oVendor;
02348     }
02349 
02357     public function setActManufacturer( $oManufacturer )
02358     {
02359         $this->_oActManufacturer = $oManufacturer;
02360     }
02361 
02367     public function getActSearch()
02368     {
02369         if ( $this->_oActSearch === null ) {
02370             $this->_oActSearch = new oxStdClass();
02371             $sUrl = $this->getConfig()->getShopHomeURL();
02372             $this->_oActSearch->link = "{$sUrl}cl=search";
02373         }
02374         return $this->_oActSearch;
02375     }
02376 
02382     public function getActRecommList()
02383     {
02384         if ( $this->_oActRecomm === null ) {
02385             $this->_oActRecomm = false;
02386             $sRecommId = oxConfig::getParameter( 'recommid' );
02387 
02388             $oRecommList = oxNew( 'oxrecommlist' );
02389 
02390             if ( $oRecommList->load( $sRecommId ) ) {
02391                 $this->_oActRecomm = $oRecommList;
02392             }
02393         }
02394         return $this->_oActRecomm;
02395     }
02396 
02402     public function getCategoryTree()
02403     {
02404         return $this->_oCategoryTree;
02405     }
02406 
02414     public function setCategoryTree( $oCatTree )
02415     {
02416         $this->_oCategoryTree = $oCatTree;
02417     }
02418 
02424     public function getVendorTree()
02425     {
02426         return $this->_oVendorTree;
02427     }
02428 
02436     public function setVendorTree( $oVendorTree )
02437     {
02438         $this->_oVendorTree = $oVendorTree;
02439     }
02440 
02446     public function getManufacturerTree()
02447     {
02448         return $this->_oManufacturerTree;
02449     }
02450 
02458     public function setManufacturerTree( $oManufacturerTree )
02459     {
02460         $this->_oManufacturerTree = $oManufacturerTree;
02461     }
02471     protected function _loadActions()
02472     {
02473         $this->_aViewData['articlebargainlist'] = $this->getBargainArticleList();
02474         $this->_aViewData['aTop5Articles']      = $this->getTop5ArticleList();
02475     }
02476 
02485     public function setSessionCategoryId( $sCategoryId )
02486     {
02487         oxSession::setVar( 'cnid', $sCategoryId );
02488     }
02489 
02495     public function getSessionCategoryId()
02496     {
02497         return oxSession::getVar( 'cnid' );
02498     }
02499 
02505     protected function _processListArticles()
02506     {
02507         $sAddParams = $this->getAddUrlParams();
02508         if ( $sAddParams && $this->_aArticleList ) {
02509             foreach ( $this->_aArticleList as $oArticle ) {
02510                 $oArticle->appendLink( $sAddParams );
02511             }
02512         }
02513     }
02514 
02520     public function getAddUrlParams()
02521     {
02522     }
02523 
02530     public function getTop5ArticleList()
02531     {
02532         if ( !$this->_blTop5Action ) {
02533             return null;
02534         }
02535 
02536         if ( $this->_aTop5ArticleList === null ) {
02537             $this->_aTop5ArticleList = false;
02538             $myConfig = $this->getConfig();
02539             if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
02540                 // top 5 articles
02541                 $oArtList = oxNew( 'oxarticlelist' );
02542                 $oArtList->loadTop5Articles();
02543                 if ( $oArtList->count() ) {
02544                     $this->_aTop5ArticleList = $oArtList;
02545                 }
02546             }
02547         }
02548         return $this->_aTop5ArticleList;
02549     }
02550 
02557     public function getBargainArticleList()
02558     {
02559         if ( !$this->_blBargainAction ) {
02560             return null;
02561         }
02562 
02563         if ( $this->_aBargainArticleList === null ) {
02564             $this->_aBargainArticleList = array();
02565             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
02566                 $oArtList = oxNew( 'oxarticlelist' );
02567                 $oArtList->loadAktionArticles( 'OXBARGAIN' );
02568                 if ( $oArtList->count() ) {
02569                     $this->_aBargainArticleList = $oArtList;
02570                 }
02571             }
02572         }
02573         return $this->_aBargainArticleList;
02574     }
02575 
02581     public function isLowOrderPrice()
02582     {
02583         return $this->_iLowOrderPrice;
02584     }
02585 
02591     public function getMinOrderPrice()
02592     {
02593         return $this->_sMinOrderPrice;
02594     }
02595 
02601     public function getNewsRealStatus()
02602     {
02603         return $this->_iNewsRealStatus;
02604     }
02605 
02611     protected function _canRedirect()
02612     {
02613         foreach ( $this->_aBlockRedirectParams as $sParam ) {
02614             if ( oxConfig::getParameter( $sParam ) !== null ) {
02615                 return false;
02616             }
02617         }
02618 
02619         return true;
02620     }
02621 
02627     public function getProduct()
02628     {
02629     }
02630 
02636     public function getVendorlist()
02637     {
02638         return $this->_aVendorlist;
02639     }
02640 
02648     public function setVendorlist( $aList )
02649     {
02650         $this->_aVendorlist = $aList;
02651     }
02652 
02658     public function getManufacturerlist()
02659     {
02660         return $this->_aManufacturerlist;
02661     }
02662 
02670     public function setManufacturerlist( $aList )
02671     {
02672         $this->_aManufacturerlist = $aList;
02673     }
02674 
02682     public function setRootVendor( $oVendor )
02683     {
02684         $this->_oRootVendor = $oVendor;
02685     }
02686 
02692     public function getRootVendor()
02693     {
02694         return $this->_oRootVendor;
02695     }
02696 
02704     public function setRootManufacturer( $oManufacturer )
02705     {
02706         $this->_oRootManufacturer = $oManufacturer;
02707     }
02708 
02714     public function getRootManufacturer()
02715     {
02716         return $this->_oRootManufacturer;
02717     }
02718 
02724     public function getVendorId()
02725     {
02726         if ( $this->_sVendorId === null ) {
02727             $this->_sVendorId = false;
02728             if ( ( $oVendor = $this->getActVendor() ) ) {
02729                 $this->_sVendorId = $oVendor->getId();
02730             }
02731         }
02732         return $this->_sVendorId;
02733     }
02734 
02740     public function getManufacturerId()
02741     {
02742         if ( $this->_sManufacturerId === null ) {
02743             $this->_sManufacturerId = false;
02744             if ( ( $oManufacturer = $this->getActManufacturer() ) ) {
02745                 $this->_sManufacturerId = $oManufacturer->getId();
02746             }
02747         }
02748         return $this->_sManufacturerId;
02749     }
02750 
02756     public function getSearchCatTree()
02757     {
02758         return $this->_aSearchCatTree;
02759     }
02760 
02768     public function setSearchCatTree( $aTree )
02769     {
02770         $this->_aSearchCatTree = $aTree;
02771     }
02772 
02778     public function getCatMore()
02779     {
02780         return $this->_oCatMore;
02781     }
02782 
02790     public function setCatMore( $oCat )
02791     {
02792         $this->_oCatMore = $oCat;
02793     }
02794 
02800     public function isNewsSubscribed()
02801     {
02802         return $this->_blNewsSubscribed;
02803     }
02804 
02812     public function setNewsSubscribed( $blNewsSubscribed )
02813     {
02814         $this->_blNewsSubscribed = $blNewsSubscribed;
02815     }
02816 
02822     public function showShipAddress()
02823     {
02824         return $this->_blShowShipAddress;
02825     }
02826 
02834     public function setShowShipAddress( $blShowShipAddress )
02835     {
02836         $this->_blShowShipAddress = $blShowShipAddress;
02837     }
02838 
02844     public function getDelAddress()
02845     {
02846         return $this->_oDelAddress;
02847     }
02848 
02856     public function setDelAddress( $oDelAddress )
02857     {
02858         $this->_oDelAddress = $oDelAddress;
02859     }
02860 
02866     public function getCatTreePath()
02867     {
02868         return $this->_sCatTreePath;
02869     }
02870 
02878     public function getContentByIdent( $sIdent )
02879     {
02880         if ( !isset( $this->_aContents[$sIdent] ) ) {
02881             $this->_aContents[$sIdent] = oxNew( 'oxcontent' );
02882             $this->_aContents[$sIdent]->loadByIdent( $sIdent );
02883         }
02884         return $this->_aContents[$sIdent];
02885     }
02886 
02892     public function getContentCategory()
02893     {
02894         return false;
02895     }
02896 }

Generated on Wed May 13 13:25:55 2009 for OXID eShop CE by  doxygen 1.5.5