thankyou.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Thankyou extends oxUBase
00008 {
00013     protected $_oBasket = null;
00014 
00019     protected $_blShowFinalStep = null;
00020 
00025     protected $_aLastProducts = null;
00026 
00031     protected $_dConvIndex = null;
00032 
00037     protected $_dIPaymentBasket = null;
00038 
00043     protected $_sIPaymentAccount = null;
00044 
00049     protected $_sIPaymentUser = null;
00050 
00055     protected $_sIPaymentPassword = null;
00056 
00061     protected $_sMailError = null;
00062 
00067     protected $_blTop5Action = true;
00068 
00073     protected $_blBargainAction = true;
00074 
00079     protected $_sThisTemplate = 'thankyou.tpl';
00080 
00089     public function init()
00090     {
00091         parent::init();
00092 
00093         // get basket we might need some information from it here
00094         $oBasket = $this->getSession()->getBasket();
00095         $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
00096 
00097         // copying basket object
00098         $this->_oBasket = clone $oBasket;
00099 
00100         // delete it from the session
00101         $oBasket->deleteBasket();
00102         oxSession::deleteVar( 'sess_challenge' );
00103     }
00104 
00117     public function render()
00118     {
00119         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00120             oxUtils::getInstance()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start' );
00121         }
00122 
00123         parent::render();
00124 
00125         $oUser = $this->getUser();
00126         if ( !$oUser ) {
00127             oxSession::deleteVar( 'usr' );
00128             oxSession::deleteVar( 'dynvalue' );
00129         }
00130 
00131         // passing basket copy
00132         $this->_aViewData['basket'] = $this->getBasket();
00133 
00134         // loading order sometimes needed in template
00135         if ( $this->_oBasket->getOrderId() ) {
00136             // owners stock reminder
00137             $oEmail = oxNew( 'oxemail' );
00138             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00139         }
00140 
00141         $this->_aViewData['order'] = $this->getOrder();
00142 
00143         // loading actions
00144         $this->_loadActions();
00145 
00146         $this->_aViewData['mailerror']      = $this->getMailError();
00147         $this->_aViewData['trusted_shopid'] = $this->getTrustedShopId();
00148 
00149         //iPayment
00150         $this->_aViewData['ipayment_basket']  = $this->getIPaymentBasket();
00151         $this->_aViewData['ipayment_account'] = $this->getIPaymentAccount();
00152         $this->_aViewData['ipayment_user']    = $this->getIPaymentUser();
00153         $this->_aViewData['ipayment_pw']      = $this->getIPaymentPassword();
00154 
00155         $this->_aViewData['convindex']  = $this->getCurrencyCovIndex();
00156 
00157         $this->_aViewData['blShowFinalStep'] = $this->showFinalStep();
00158         $this->_aViewData['aLastProducts']   = $this->getAlsoBoughtThiesProducts();
00159 
00160         // we must set active class as start
00161         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00162 
00163         return $this->_sThisTemplate;
00164     }
00165 
00171     public function getBasket()
00172     {
00173         return $this->_oBasket;
00174     }
00175 
00181     public function showFinalStep()
00182     {
00183         if ( $this->_blShowFinalStep === null ) {
00184             $this->_blShowFinalStep = false;
00185             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00186                 $this->_blShowFinalStep = true;
00187             }
00188         }
00189         return $this->_blShowFinalStep;
00190     }
00191 
00197     public function getAlsoBoughtThiesProducts()
00198     {
00199         if ( $this->_aLastProducts === null ) {
00200             $this->_aLastProducts = false;
00201             // 5th order step
00202             if ( $this->showFinalStep() ) {
00203                 $aBasketContents = array_values($this->getBasket()->getContents());
00204                 if ( $oBasketItem = $aBasketContents[0] ) {
00205                     if ( $oProduct = $oBasketItem->getArticle() ) {
00206                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00207                     }
00208                 }
00209             }
00210         }
00211         return $this->_aLastProducts;
00212     }
00213 
00219     public function getCurrencyCovIndex()
00220     {
00221         if ( $this->_dConvIndex === null ) {
00222             // currency conversion index value
00223             $oCur = $this->getConfig()->getActShopCurrencyObject();
00224             $this->_dConvIndex = 1 / $oCur->rate;
00225         }
00226         return $this->_dConvIndex;
00227     }
00228 
00234     public function getIPaymentBasket()
00235     {
00236         if ( $this->_dIPaymentBasket === null ) {
00237             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00238         }
00239         return $this->_dIPaymentBasket;
00240     }
00241 
00247     public function getIPaymentAccount()
00248     {
00249         if ( $this->_sIPaymentAccount === null ) {
00250             $this->_sIPaymentAccount = false;
00251             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00252         }
00253         return $this->_sIPaymentAccount;
00254     }
00255 
00261     public function getIPaymentUser()
00262     {
00263         if ( $this->_sIPaymentUser === null ) {
00264             $this->_sIPaymentUser = false;
00265             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00266         }
00267         return $this->_sIPaymentUser;
00268     }
00269 
00275     public function getIPaymentPassword()
00276     {
00277         if ( $this->_sIPaymentPassword === null ) {
00278             $this->_sIPaymentPassword = false;
00279             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00280         }
00281         return $this->_sIPaymentPassword;
00282     }
00283 
00289     public function getMailError()
00290     {
00291         if ( $this->_sMailError === null ) {
00292             $this->_sMailError = false;
00293             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00294         }
00295         return $this->_sMailError;
00296     }
00297 
00303     public function getOrder()
00304     {
00305         if ( $this->_oOrder === null ) {
00306             $this->_oOrder = oxNew( 'oxorder' );
00307             // loading order sometimes needed in template
00308             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00309                 $this->_oOrder->load( $sOrderId );
00310             }
00311         }
00312         return $this->_oOrder;
00313     }
00314 
00320     public function getCountryISO3()
00321     {
00322         $oOrder = $this->getOrder();
00323         if ( $oOrder ) {
00324             $oCountry = oxNew( 'oxcountry' );
00325             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00326             return $oCountry->oxcountry__oxisoalpha3->value;
00327         }
00328     }
00329 
00330 }

Generated on Tue Aug 18 09:21:09 2009 for OXID eShop CE by  doxygen 1.5.5