oxcmp_cur.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxcmp_cur extends oxView
00008 {
00013     public $aCurrencies    = null;
00014 
00019     protected $_oActCur        = null;
00020 
00025     protected $_blIsComponent = true;
00026 
00038     public function init()
00039     {
00040         // Performance
00041         $myConfig = $this->getConfig();
00042         if ( !$myConfig->getConfigParam( 'bl_perfLoadCurrency' ) ) {
00043             //#861C -  show first currency
00044             $aCurrencies = $myConfig->getCurrencyArray();
00045             $this->_oActCur = current( $aCurrencies );
00046             return;
00047         }
00048 
00049         $iCur = oxConfig::getParameter( 'cur' );
00050         if ( isset( $iCur ) ) {
00051             $aCurrencies = $myConfig->getCurrencyArray();
00052             if (!isset( $aCurrencies[$iCur] ) ) {
00053                 $iCur = 0;
00054             }
00055 
00056             // set new currency
00057             $myConfig->setActShopCurrency( $iCur );
00058 
00059             // recalc basket
00060             $oBasket = $this->getSession()->getBasket();
00061             $oBasket->onUpdate();
00062         }
00063 
00064         $iActCur = $myConfig->getShopCurrency();
00065         $this->aCurrencies = $myConfig->getCurrencyArray( $iActCur );
00066         $this->_oActCur     = $this->aCurrencies[$iActCur];
00067 
00068         $sClass = $this->getConfig()->getActiveView()->getClassName();
00069         $sURL  = $myConfig->getShopCurrentURL();
00070         $sURL .= "cl={$sClass}";
00071 
00072         // #921 S
00073         // name of function
00074         $sVal = oxConfig::getParameter( 'fnc' );
00075         $aFnc = array( 'tobasket', 'login_noredirect', 'addVoucher' );
00076         if ( $sVal && in_array( $sVal, $aFnc ) ) {
00077             $sVal = '';
00078         }
00079 
00080         if ( $sVal ) {
00081             $sURL .= "&amp;fnc={$sVal}";
00082         }
00083 
00084         // active category
00085         if ( $sVal = oxConfig::getParameter( 'cnid' ) ) {
00086             $sURL .= "&amp;cnid={$sVal}";
00087         }
00088 
00089         // active article
00090         if ( $sVal= oxConfig::getParameter( 'anid' ) ) {
00091             $sURL .= "&amp;anid={$sVal}";
00092         }
00093 
00094         // active template
00095         if ( $sVal = basename( oxConfig::getParameter( 'tpl' ) ) ) {
00096             $sURL .= "&amp;tpl={$sVal}";
00097         }
00098 
00099         // number of active page
00100         $iPgNr = ( int ) oxConfig::getParameter( 'pgNr' );
00101         if ( $iPgNr > 0 ) {
00102             $sURL .= "&amp;pgNr={$iPgNr}";
00103         }
00104 
00105         // #1184M - specialchar search
00106         // search parameter
00107         if ( $sVal = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ) ) {
00108             $sURL .= "&amp;searchparam={$sVal}";
00109         }
00110 
00111         // search category
00112         if ( $sVal = oxConfig::getParameter( 'searchcnid' ) ) {
00113             $sURL .= "&amp;searchcnid={$sVal}";
00114         }
00115 
00116         // search vendor
00117         if ( $sVal = oxConfig::getParameter( 'searchvendor' ) ) {
00118             $sURL .= "&amp;searchvendor={$sVal}";
00119         }
00120 
00121         // search manufacturer
00122         if ( $sVal = oxConfig::getParameter( 'searchmanufacturer' ) ) {
00123             $sURL .= "&amp;searchmanufacturer={$sVal}";
00124         }
00125 
00126         reset( $this->aCurrencies );
00127         while ( list( , $oItem ) = each( $this->aCurrencies ) ) {
00128             $oItem->link = "{$sURL}&amp;cur={$oItem->id}";
00129         }
00130 
00131         parent::init();
00132     }
00133 
00143     public function render()
00144     {
00145         parent::render();
00146         $this->_oParent->setActCurrency( $this->_oActCur );
00147         // Passing to view. Left for compatibility reasons for a while. Will be removed in future
00148         $this->_oParent->addTplParam( 'currency', $this->_oParent->getActCurrency() );
00149         return $this->aCurrencies;
00150     }
00151 }

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