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 
00075 
00080     protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
00081 
00090     public function init()
00091     {
00092         parent::init();
00093 
00094         // get basket we might need some information from it here
00095         $oBasket = $this->getSession()->getBasket();
00096         $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
00097 
00098         // copying basket object
00099         $this->_oBasket = clone $oBasket;
00100 
00101         // delete it from the session
00102         $oBasket->deleteBasket();
00103         oxSession::deleteVar( 'sess_challenge' );
00104     }
00105 
00113     public function render()
00114     {
00115         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00116             oxRegistry::getUtils()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start', true, 302 );
00117         }
00118 
00119         parent::render();
00120 
00121         $oUser = $this->getUser();
00122 
00123         // removing also unregistered user info (#2580)
00124         if ( !$oUser || !$oUser->oxuser__oxpassword->value) {
00125             oxSession::deleteVar( 'usr' );
00126             oxSession::deleteVar( 'dynvalue' );
00127         }
00128 
00129         // loading order sometimes needed in template
00130         if ( $this->_oBasket->getOrderId() ) {
00131             // owners stock reminder
00132             $oEmail = oxNew( 'oxemail' );
00133             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00134         }
00135 
00136         // we must set active class as start
00137         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00138 
00139         return $this->_sThisTemplate;
00140     }
00141 
00147     public function getBasket()
00148     {
00149         return $this->_oBasket;
00150     }
00151 
00157     public function showFinalStep()
00158     {
00159         if ( $this->_blShowFinalStep === null ) {
00160             $this->_blShowFinalStep = false;
00161             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00162                 $this->_blShowFinalStep = true;
00163             }
00164         }
00165         return $this->_blShowFinalStep;
00166     }
00167 
00173     public function getAlsoBoughtTheseProducts()
00174     {
00175         if ( $this->_aLastProducts === null ) {
00176             $this->_aLastProducts = false;
00177             // 5th order step
00178             if ( $this->showFinalStep() ) {
00179                 $aBasketContents = array_values($this->getBasket()->getContents());
00180                 if ( $oBasketItem = $aBasketContents[0] ) {
00181                     if ( $oProduct = $oBasketItem->getArticle(false) ) {
00182                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00183                     }
00184                 }
00185             }
00186         }
00187         return $this->_aLastProducts;
00188     }
00189 
00195     public function getCurrencyCovIndex()
00196     {
00197         if ( $this->_dConvIndex === null ) {
00198             // currency conversion index value
00199             $oCur = $this->getConfig()->getActShopCurrencyObject();
00200             $this->_dConvIndex = 1 / $oCur->rate;
00201         }
00202         return $this->_dConvIndex;
00203     }
00204 
00210     public function getIPaymentBasket()
00211     {
00212         if ( $this->_dIPaymentBasket === null ) {
00213             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00214         }
00215         return $this->_dIPaymentBasket;
00216     }
00217 
00223     public function getIPaymentAccount()
00224     {
00225         if ( $this->_sIPaymentAccount === null ) {
00226             $this->_sIPaymentAccount = false;
00227             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00228         }
00229         return $this->_sIPaymentAccount;
00230     }
00231 
00237     public function getIPaymentUser()
00238     {
00239         if ( $this->_sIPaymentUser === null ) {
00240             $this->_sIPaymentUser = false;
00241             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00242         }
00243         return $this->_sIPaymentUser;
00244     }
00245 
00251     public function getIPaymentPassword()
00252     {
00253         if ( $this->_sIPaymentPassword === null ) {
00254             $this->_sIPaymentPassword = false;
00255             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00256         }
00257         return $this->_sIPaymentPassword;
00258     }
00259 
00265     public function getMailError()
00266     {
00267         if ( $this->_sMailError === null ) {
00268             $this->_sMailError = false;
00269             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00270         }
00271         return $this->_sMailError;
00272     }
00273 
00279     public function getOrder()
00280     {
00281         if ( $this->_oOrder === null ) {
00282             $this->_oOrder = oxNew( 'oxorder' );
00283             // loading order sometimes needed in template
00284             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00285                 $this->_oOrder->load( $sOrderId );
00286             }
00287         }
00288         return $this->_oOrder;
00289     }
00290 
00296     public function getCountryISO3()
00297     {
00298         $oOrder = $this->getOrder();
00299         if ( $oOrder ) {
00300             $oCountry = oxNew( 'oxcountry' );
00301             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00302             return $oCountry->oxcountry__oxisoalpha3->value;
00303         }
00304     }
00305 
00312     public function getActionClassName()
00313     {
00314         return 'start';
00315     }
00316 
00322     public function getBreadCrumb()
00323     {
00324         $aPaths = array();
00325         $aPath = array();
00326 
00327 
00328         $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_CHECKOUT_THANKYOU', oxRegistry::getLang()->getBaseLanguage(), false );
00329         $aPath['link']  = $this->getLink();
00330         $aPaths[] = $aPath;
00331 
00332         return $aPaths;
00333     }
00334 }