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 $_sThisTemplate = 'thankyou.tpl';
00068 
00077     public function init()
00078     {
00079         parent::init();
00080 
00081         // get basket we might need some information from it here
00082         $oBasket = $this->getSession()->getBasket();
00083         $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
00084 
00085         // copying basket object
00086         $this->_oBasket = clone $oBasket;
00087 
00088         // delete it from the session
00089         $oBasket->deleteBasket();
00090         oxSession::deleteVar( 'sess_challenge' );
00091     }
00092 
00105     public function render()
00106     {
00107         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00108             oxUtils::getInstance()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start' );
00109         }
00110 
00111         parent::render();
00112 
00113         $oUser = $this->getUser();
00114         if ( !$oUser ) {
00115             oxSession::deleteVar( 'usr' );
00116             oxSession::deleteVar( 'dynvalue' );
00117         }
00118 
00119         // passing basket copy
00120         $this->_aViewData['basket'] = $this->getBasket();
00121 
00122         // loading order sometimes needed in template
00123         if ( $this->_oBasket->getOrderId() ) {
00124             // owners stock reminder
00125             $oEmail = oxNew( 'oxemail' );
00126             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00127         }
00128 
00129         $this->_aViewData['order'] = $this->getOrder();
00130 
00131         // loading actions
00132         $this->_loadActions();
00133 
00134         $this->_aViewData['mailerror']      = $this->getMailError();
00135         $this->_aViewData['trusted_shopid'] = $this->getTrustedShopId();
00136 
00137         //iPayment
00138         $this->_aViewData['ipayment_basket']  = $this->getIPaymentBasket();
00139         $this->_aViewData['ipayment_account'] = $this->getIPaymentAccount();
00140         $this->_aViewData['ipayment_user']    = $this->getIPaymentUser();
00141         $this->_aViewData['ipayment_pw']      = $this->getIPaymentPassword();
00142 
00143         $this->_aViewData['convindex']  = $this->getCurrencyCovIndex();
00144 
00145         $this->_aViewData['blShowFinalStep'] = $this->showFinalStep();
00146         $this->_aViewData['aLastProducts']   = $this->getAlsoBoughtThiesProducts();
00147 
00148         // we must set active class as start
00149         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00150 
00151         return $this->_sThisTemplate;
00152     }
00153 
00159     public function getBasket()
00160     {
00161         return $this->_oBasket;
00162     }
00163 
00169     public function showFinalStep()
00170     {
00171         if ( $this->_blShowFinalStep === null ) {
00172             $this->_blShowFinalStep = false;
00173             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00174                 $this->_blShowFinalStep = true;
00175             }
00176         }
00177         return $this->_blShowFinalStep;
00178     }
00179 
00185     public function getAlsoBoughtThiesProducts()
00186     {
00187         if ( $this->_aLastProducts === null ) {
00188             $this->_aLastProducts = false;
00189             // 5th order step
00190             if ( $this->showFinalStep() ) {
00191                 $aBasketContents = array_values($this->getBasket()->getContents());
00192                 if ( $oBasketItem = $aBasketContents[0] ) {
00193                     if ( $oProduct = $oBasketItem->getArticle() ) {
00194                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00195                     }
00196                 }
00197             }
00198         }
00199         return $this->_aLastProducts;
00200     }
00201 
00207     public function getCurrencyCovIndex()
00208     {
00209         if ( $this->_dConvIndex === null ) {
00210             // currency conversion index value
00211             $oCur = $this->getConfig()->getActShopCurrencyObject();
00212             $this->_dConvIndex = 1 / $oCur->rate;
00213         }
00214         return $this->_dConvIndex;
00215     }
00216 
00222     public function getIPaymentBasket()
00223     {
00224         if ( $this->_dIPaymentBasket === null ) {
00225             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00226         }
00227         return $this->_dIPaymentBasket;
00228     }
00229 
00235     public function getIPaymentAccount()
00236     {
00237         if ( $this->_sIPaymentAccount === null ) {
00238             $this->_sIPaymentAccount = false;
00239             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00240         }
00241         return $this->_sIPaymentAccount;
00242     }
00243 
00249     public function getIPaymentUser()
00250     {
00251         if ( $this->_sIPaymentUser === null ) {
00252             $this->_sIPaymentUser = false;
00253             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00254         }
00255         return $this->_sIPaymentUser;
00256     }
00257 
00263     public function getIPaymentPassword()
00264     {
00265         if ( $this->_sIPaymentPassword === null ) {
00266             $this->_sIPaymentPassword = false;
00267             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00268         }
00269         return $this->_sIPaymentPassword;
00270     }
00271 
00277     public function getMailError()
00278     {
00279         if ( $this->_sMailError === null ) {
00280             $this->_sMailError = false;
00281             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00282         }
00283         return $this->_sMailError;
00284     }
00285 
00291     public function getOrder()
00292     {
00293         if ( $this->_oOrder === null ) {
00294             $this->_oOrder = oxNew( 'oxorder' );
00295             // loading order sometimes needed in template
00296             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00297                 $this->_oOrder->load( $sOrderId );
00298             }
00299         }
00300         return $this->_oOrder;
00301     }
00302 
00303 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5