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 $_aLastProducts = null;
00020 
00025     protected $_dConvIndex = null;
00026 
00031     protected $_dIPaymentBasket = null;
00032 
00037     protected $_sIPaymentAccount = null;
00038 
00043     protected $_sIPaymentUser = null;
00044 
00049     protected $_sIPaymentPassword = null;
00050 
00055     protected $_sMailError = null;
00056 
00061     protected $_blBargainAction = true;
00062 
00063 
00068     protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
00069 
00078     public function init()
00079     {
00080         parent::init();
00081 
00082         // get basket we might need some information from it here
00083         $oBasket = $this->getSession()->getBasket();
00084         $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
00085 
00086         // copying basket object
00087         $this->_oBasket = clone $oBasket;
00088 
00089         // delete it from the session
00090         $oBasket->deleteBasket();
00091         oxSession::deleteVar( 'sess_challenge' );
00092     }
00093 
00101     public function render()
00102     {
00103         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00104             oxRegistry::getUtils()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start', true, 302 );
00105         }
00106 
00107         parent::render();
00108 
00109         $oUser = $this->getUser();
00110 
00111         // removing also unregistered user info (#2580)
00112         if ( !$oUser || !$oUser->oxuser__oxpassword->value) {
00113             oxSession::deleteVar( 'usr' );
00114             oxSession::deleteVar( 'dynvalue' );
00115         }
00116 
00117         // loading order sometimes needed in template
00118         if ( $this->_oBasket->getOrderId() ) {
00119             // owners stock reminder
00120             $oEmail = oxNew( 'oxemail' );
00121             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00122         }
00123 
00124         // we must set active class as start
00125         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00126 
00127         return $this->_sThisTemplate;
00128     }
00129 
00135     public function getBasket()
00136     {
00137         return $this->_oBasket;
00138     }
00139 
00147     public function showFinalStep()
00148     {
00149         return true;
00150     }
00151 
00157     public function getAlsoBoughtTheseProducts()
00158     {
00159         if ( $this->_aLastProducts === null ) {
00160             $this->_aLastProducts = false;
00161             // 5th order step
00162             $aBasketContents = array_values($this->getBasket()->getContents());
00163             if ( $oBasketItem = $aBasketContents[0] ) {
00164                 if ( $oProduct = $oBasketItem->getArticle(false) ) {
00165                     $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00166                 }
00167             }
00168         }
00169         return $this->_aLastProducts;
00170     }
00171 
00177     public function getCurrencyCovIndex()
00178     {
00179         if ( $this->_dConvIndex === null ) {
00180             // currency conversion index value
00181             $oCur = $this->getConfig()->getActShopCurrencyObject();
00182             $this->_dConvIndex = 1 / $oCur->rate;
00183         }
00184         return $this->_dConvIndex;
00185     }
00186 
00192     public function getIPaymentBasket()
00193     {
00194         if ( $this->_dIPaymentBasket === null ) {
00195             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00196         }
00197         return $this->_dIPaymentBasket;
00198     }
00199 
00205     public function getIPaymentAccount()
00206     {
00207         if ( $this->_sIPaymentAccount === null ) {
00208             $this->_sIPaymentAccount = false;
00209             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00210         }
00211         return $this->_sIPaymentAccount;
00212     }
00213 
00219     public function getIPaymentUser()
00220     {
00221         if ( $this->_sIPaymentUser === null ) {
00222             $this->_sIPaymentUser = false;
00223             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00224         }
00225         return $this->_sIPaymentUser;
00226     }
00227 
00233     public function getIPaymentPassword()
00234     {
00235         if ( $this->_sIPaymentPassword === null ) {
00236             $this->_sIPaymentPassword = false;
00237             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00238         }
00239         return $this->_sIPaymentPassword;
00240     }
00241 
00247     public function getMailError()
00248     {
00249         if ( $this->_sMailError === null ) {
00250             $this->_sMailError = false;
00251             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00252         }
00253         return $this->_sMailError;
00254     }
00255 
00261     public function getOrder()
00262     {
00263         if ( $this->_oOrder === null ) {
00264             $this->_oOrder = oxNew( 'oxorder' );
00265             // loading order sometimes needed in template
00266             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00267                 $this->_oOrder->load( $sOrderId );
00268             }
00269         }
00270         return $this->_oOrder;
00271     }
00272 
00278     public function getCountryISO3()
00279     {
00280         $oOrder = $this->getOrder();
00281         if ( $oOrder ) {
00282             $oCountry = oxNew( 'oxcountry' );
00283             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00284             return $oCountry->oxcountry__oxisoalpha3->value;
00285         }
00286     }
00287 
00294     public function getActionClassName()
00295     {
00296         return 'start';
00297     }
00298 
00304     public function getBreadCrumb()
00305     {
00306         $aPaths = array();
00307         $aPath = array();
00308 
00309 
00310         $aPath['title'] = oxRegistry::getLang()->translateString( 'ORDER_COMPLETED', oxRegistry::getLang()->getBaseLanguage(), false );
00311         $aPath['link']  = $this->getLink();
00312         $aPaths[] = $aPath;
00313 
00314         return $aPaths;
00315     }
00316 }