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 = 'page/checkout/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 
00112     public function render()
00113     {
00114         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00115             oxUtils::getInstance()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start' );
00116         }
00117 
00118         parent::render();
00119 
00120         $oUser = $this->getUser();
00121         if ( !$oUser ) {
00122             oxSession::deleteVar( 'usr' );
00123             oxSession::deleteVar( 'dynvalue' );
00124         }
00125 
00126         // loading order sometimes needed in template
00127         if ( $this->_oBasket->getOrderId() ) {
00128             // owners stock reminder
00129             $oEmail = oxNew( 'oxemail' );
00130             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00131         }
00132 
00133         // we must set active class as start
00134         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00135 
00136         return $this->_sThisTemplate;
00137     }
00138 
00144     public function getBasket()
00145     {
00146         return $this->_oBasket;
00147     }
00148 
00154     public function showFinalStep()
00155     {
00156         if ( $this->_blShowFinalStep === null ) {
00157             $this->_blShowFinalStep = false;
00158             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00159                 $this->_blShowFinalStep = true;
00160             }
00161         }
00162         return $this->_blShowFinalStep;
00163     }
00164 
00170     public function getAlsoBoughtTheseProducts()
00171     {
00172         if ( $this->_aLastProducts === null ) {
00173             $this->_aLastProducts = false;
00174             // 5th order step
00175             if ( $this->showFinalStep() ) {
00176                 $aBasketContents = array_values($this->getBasket()->getContents());
00177                 if ( $oBasketItem = $aBasketContents[0] ) {
00178                     if ( $oProduct = $oBasketItem->getArticle(false) ) {
00179                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00180                     }
00181                 }
00182             }
00183         }
00184         return $this->_aLastProducts;
00185     }
00186 
00192     public function getCurrencyCovIndex()
00193     {
00194         if ( $this->_dConvIndex === null ) {
00195             // currency conversion index value
00196             $oCur = $this->getConfig()->getActShopCurrencyObject();
00197             $this->_dConvIndex = 1 / $oCur->rate;
00198         }
00199         return $this->_dConvIndex;
00200     }
00201 
00207     public function getIPaymentBasket()
00208     {
00209         if ( $this->_dIPaymentBasket === null ) {
00210             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00211         }
00212         return $this->_dIPaymentBasket;
00213     }
00214 
00220     public function getIPaymentAccount()
00221     {
00222         if ( $this->_sIPaymentAccount === null ) {
00223             $this->_sIPaymentAccount = false;
00224             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00225         }
00226         return $this->_sIPaymentAccount;
00227     }
00228 
00234     public function getIPaymentUser()
00235     {
00236         if ( $this->_sIPaymentUser === null ) {
00237             $this->_sIPaymentUser = false;
00238             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00239         }
00240         return $this->_sIPaymentUser;
00241     }
00242 
00248     public function getIPaymentPassword()
00249     {
00250         if ( $this->_sIPaymentPassword === null ) {
00251             $this->_sIPaymentPassword = false;
00252             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00253         }
00254         return $this->_sIPaymentPassword;
00255     }
00256 
00262     public function getMailError()
00263     {
00264         if ( $this->_sMailError === null ) {
00265             $this->_sMailError = false;
00266             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00267         }
00268         return $this->_sMailError;
00269     }
00270 
00276     public function getOrder()
00277     {
00278         if ( $this->_oOrder === null ) {
00279             $this->_oOrder = oxNew( 'oxorder' );
00280             // loading order sometimes needed in template
00281             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00282                 $this->_oOrder->load( $sOrderId );
00283             }
00284         }
00285         return $this->_oOrder;
00286     }
00287 
00293     public function getCountryISO3()
00294     {
00295         $oOrder = $this->getOrder();
00296         if ( $oOrder ) {
00297             $oCountry = oxNew( 'oxcountry' );
00298             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00299             return $oCountry->oxcountry__oxisoalpha3->value;
00300         }
00301     }
00302 
00309     public function getActionClassName()
00310     {
00311         return 'start';
00312     }
00313 
00319     public function getBreadCrumb()
00320     {
00321         $aPaths = array();
00322         $aPath = array();
00323 
00324 
00325         $aPath['title'] = oxLang::getInstance()->translateString( 'PAGE_CHECKOUT_THANKYOU', oxLang::getInstance()->getBaseLanguage(), false );
00326         $aPaths[] = $aPath;
00327 
00328         return $aPaths;
00329     }
00330 
00331 }