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 = '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 
00117     public function render()
00118     {
00119         if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
00120             oxUtils::getInstance()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start' );
00121         }
00122 
00123         parent::render();
00124 
00125         $oUser = $this->getUser();
00126         if ( !$oUser ) {
00127             oxSession::deleteVar( 'usr' );
00128             oxSession::deleteVar( 'dynvalue' );
00129         }
00130 
00131         // passing basket copy
00132         $this->_aViewData['basket'] = $this->getBasket();
00133 
00134         // loading order sometimes needed in template
00135         if ( $this->_oBasket->getOrderId() ) {
00136             // owners stock reminder
00137             $oEmail = oxNew( 'oxemail' );
00138             $oEmail->sendStockReminder( $this->_oBasket->getContents() );
00139         }
00140 
00141         $this->_aViewData['order'] = $this->getOrder();
00142 
00143         // loading actions
00144         $this->_loadActions();
00145 
00146         $this->_aViewData['mailerror']      = $this->getMailError();
00147         $this->_aViewData['trusted_shopid'] = $this->getTrustedShopId();
00148 
00149         //iPayment
00150         $this->_aViewData['ipayment_basket']  = $this->getIPaymentBasket();
00151         $this->_aViewData['ipayment_account'] = $this->getIPaymentAccount();
00152         $this->_aViewData['ipayment_user']    = $this->getIPaymentUser();
00153         $this->_aViewData['ipayment_pw']      = $this->getIPaymentPassword();
00154 
00155         $this->_aViewData['convindex']  = $this->getCurrencyCovIndex();
00156 
00157         $this->_aViewData['blShowFinalStep'] = $this->showFinalStep();
00158         $this->_aViewData['aLastProducts']   = $this->getAlsoBoughtTheseProducts();
00159 
00160         // we must set active class as start
00161         $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
00162 
00163         return $this->_sThisTemplate;
00164     }
00165 
00171     public function getBasket()
00172     {
00173         return $this->_oBasket;
00174     }
00175 
00181     public function showFinalStep()
00182     {
00183         if ( $this->_blShowFinalStep === null ) {
00184             $this->_blShowFinalStep = false;
00185             if ( $this->getConfig()->getConfigParam( 'blShowFinalStep' ) ) {
00186                 $this->_blShowFinalStep = true;
00187             }
00188         }
00189         return $this->_blShowFinalStep;
00190     }
00191 
00199     public function getAlsoBoughtThiesProducts()
00200     {
00201         return $this->getAlsoBoughtTheseProducts();
00202     }
00203 
00209     public function getAlsoBoughtTheseProducts()
00210     {
00211         if ( $this->_aLastProducts === null ) {
00212             $this->_aLastProducts = false;
00213             // 5th order step
00214             if ( $this->showFinalStep() ) {
00215                 $aBasketContents = array_values($this->getBasket()->getContents());
00216                 if ( $oBasketItem = $aBasketContents[0] ) {
00217                     if ( $oProduct = $oBasketItem->getArticle(false) ) {
00218                         $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00219                     }
00220                 }
00221             }
00222         }
00223         return $this->_aLastProducts;
00224     }
00225 
00231     public function getCurrencyCovIndex()
00232     {
00233         if ( $this->_dConvIndex === null ) {
00234             // currency conversion index value
00235             $oCur = $this->getConfig()->getActShopCurrencyObject();
00236             $this->_dConvIndex = 1 / $oCur->rate;
00237         }
00238         return $this->_dConvIndex;
00239     }
00240 
00246     public function getIPaymentBasket()
00247     {
00248         if ( $this->_dIPaymentBasket === null ) {
00249             $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00250         }
00251         return $this->_dIPaymentBasket;
00252     }
00253 
00259     public function getIPaymentAccount()
00260     {
00261         if ( $this->_sIPaymentAccount === null ) {
00262             $this->_sIPaymentAccount = false;
00263             $this->_sIPaymentAccount = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Account' );
00264         }
00265         return $this->_sIPaymentAccount;
00266     }
00267 
00273     public function getIPaymentUser()
00274     {
00275         if ( $this->_sIPaymentUser === null ) {
00276             $this->_sIPaymentUser = false;
00277             $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
00278         }
00279         return $this->_sIPaymentUser;
00280     }
00281 
00287     public function getIPaymentPassword()
00288     {
00289         if ( $this->_sIPaymentPassword === null ) {
00290             $this->_sIPaymentPassword = false;
00291             $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
00292         }
00293         return $this->_sIPaymentPassword;
00294     }
00295 
00301     public function getMailError()
00302     {
00303         if ( $this->_sMailError === null ) {
00304             $this->_sMailError = false;
00305             $this->_sMailError = oxConfig::getParameter( 'mailerror' );
00306         }
00307         return $this->_sMailError;
00308     }
00309 
00315     public function getOrder()
00316     {
00317         if ( $this->_oOrder === null ) {
00318             $this->_oOrder = oxNew( 'oxorder' );
00319             // loading order sometimes needed in template
00320             if ( $sOrderId = $this->getBasket()->getOrderId() ) {
00321                 $this->_oOrder->load( $sOrderId );
00322             }
00323         }
00324         return $this->_oOrder;
00325     }
00326 
00332     public function getCountryISO3()
00333     {
00334         $oOrder = $this->getOrder();
00335         if ( $oOrder ) {
00336             $oCountry = oxNew( 'oxcountry' );
00337             $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
00338             return $oCountry->oxcountry__oxisoalpha3->value;
00339         }
00340     }
00341 
00342 }

Generated by  doxygen 1.6.2