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 $_blBargainAction = true;
00068 
00069 
00074     protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
00075 
00084     public function init()
00085     {
00086         parent::init();
00087 
00088         // get basket we might need some information from it here
00089         $oBasket = $this->getSession()->getBasket();
00090         $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
00091 
00092         // copying basket object
00093         $this->_oBasket = clone $oBasket;
00094 
00095         // delete it from the session
00096         $oBasket->deleteBasket();
00097         oxSession::deleteVar( 'sess_challenge' );
00098     }
00099 
00107     public function render()
00108     {
00109         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00110             oxRegistry::getUtils()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start', true, 302 );
00111         }
00112 
00113         parent::render();
00114 
00115         $oUser = $this->getUser();
00116 
00117         // removing also unregistered user info (#2580)
00118         if ( !$oUser || !$oUser->oxuser__oxpassword->value) {
00119             oxSession::deleteVar( 'usr' );
00120             oxSession::deleteVar( 'dynvalue' );
00121         }
00122 
00123         // loading order sometimes needed in template
00124         if ( $this->_oBasket->getOrderId() ) {
00125             // owners stock reminder
00126             $oEmail = oxNew( 'oxemail' );
00127             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00128         }
00129 
00130         // we must set active class as start
00131         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00132 
00133         return $this->_sThisTemplate;
00134     }
00135 
00141     public function getBasket()
00142     {
00143         return $this->_oBasket;
00144     }
00145 
00151     public function showFinalStep()
00152     {
00153         if ( $this->_blShowFinalStep === null ) {
00154             $this->_blShowFinalStep = false;
00155             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00156                 $this->_blShowFinalStep = true;
00157             }
00158         }
00159         return $this->_blShowFinalStep;
00160     }
00161 
00167     public function getAlsoBoughtTheseProducts()
00168     {
00169         if ( $this->_aLastProducts === null ) {
00170             $this->_aLastProducts = false;
00171             // 5th order step
00172             if ( $this->showFinalStep() ) {
00173                 $aBasketContents = array_values($this->getBasket()->getContents());
00174                 if ( $oBasketItem = $aBasketContents[0] ) {
00175                     if ( $oProduct = $oBasketItem->getArticle(false) ) {
00176                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00177                     }
00178                 }
00179             }
00180         }
00181         return $this->_aLastProducts;
00182     }
00183 
00189     public function getCurrencyCovIndex()
00190     {
00191         if ( $this->_dConvIndex === null ) {
00192             // currency conversion index value
00193             $oCur = $this->getConfig()->getActShopCurrencyObject();
00194             $this->_dConvIndex = 1 / $oCur->rate;
00195         }
00196         return $this->_dConvIndex;
00197     }
00198 
00204     public function getIPaymentBasket()
00205     {
00206         if ( $this->_dIPaymentBasket === null ) {
00207             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00208         }
00209         return $this->_dIPaymentBasket;
00210     }
00211 
00217     public function getIPaymentAccount()
00218     {
00219         if ( $this->_sIPaymentAccount === null ) {
00220             $this->_sIPaymentAccount = false;
00221             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00222         }
00223         return $this->_sIPaymentAccount;
00224     }
00225 
00231     public function getIPaymentUser()
00232     {
00233         if ( $this->_sIPaymentUser === null ) {
00234             $this->_sIPaymentUser = false;
00235             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00236         }
00237         return $this->_sIPaymentUser;
00238     }
00239 
00245     public function getIPaymentPassword()
00246     {
00247         if ( $this->_sIPaymentPassword === null ) {
00248             $this->_sIPaymentPassword = false;
00249             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00250         }
00251         return $this->_sIPaymentPassword;
00252     }
00253 
00259     public function getMailError()
00260     {
00261         if ( $this->_sMailError === null ) {
00262             $this->_sMailError = false;
00263             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00264         }
00265         return $this->_sMailError;
00266     }
00267 
00273     public function getOrder()
00274     {
00275         if ( $this->_oOrder === null ) {
00276             $this->_oOrder = oxNew( 'oxorder' );
00277             // loading order sometimes needed in template
00278             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00279                 $this->_oOrder->load( $sOrderId );
00280             }
00281         }
00282         return $this->_oOrder;
00283     }
00284 
00290     public function getCountryISO3()
00291     {
00292         $oOrder = $this->getOrder();
00293         if ( $oOrder ) {
00294             $oCountry = oxNew( 'oxcountry' );
00295             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00296             return $oCountry->oxcountry__oxisoalpha3->value;
00297         }
00298     }
00299 
00306     public function getActionClassName()
00307     {
00308         return 'start';
00309     }
00310 
00316     public function getBreadCrumb()
00317     {
00318         $aPaths = array();
00319         $aPath = array();
00320 
00321 
00322         $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_CHECKOUT_THANKYOU', oxRegistry::getLang()->getBaseLanguage(), false );
00323         $aPath['link']  = $this->getLink();
00324         $aPaths[] = $aPath;
00325 
00326         return $aPaths;
00327     }
00328 }