Go to the documentation of this file.00001 <?php
00002
00007 class Thankyou extends oxUBase
00008 {
00009
00015 protected $_oBasket = null;
00016
00022 protected $_aLastProducts = null;
00023
00029 protected $_dConvIndex = null;
00030
00036 protected $_dIPaymentBasket = null;
00037
00043 protected $_sIPaymentAccount = null;
00044
00050 protected $_sIPaymentUser = null;
00051
00057 protected $_sIPaymentPassword = null;
00058
00064 protected $_sMailError = null;
00065
00071 protected $_blBargainAction = true;
00072
00073
00079 protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
00080
00087 public function init()
00088 {
00089 parent::init();
00090
00091
00092 $oBasket = $this->getSession()->getBasket();
00093 $oBasket->setOrderId(oxRegistry::getSession()->getVariable('sess_challenge'));
00094
00095
00096 $this->_oBasket = clone $oBasket;
00097
00098
00099 $oBasket->deleteBasket();
00100 oxRegistry::getSession()->deleteVariable('sess_challenge');
00101 }
00102
00110 public function render()
00111 {
00112 if (!$this->_oBasket || !$this->_oBasket->getProductsCount()) {
00113 oxRegistry::getUtils()->redirect($this->getConfig()->getShopHomeURL() . '&cl=start', true, 302);
00114 }
00115
00116 parent::render();
00117
00118 $oUser = $this->getUser();
00119
00120
00121 if (!$oUser || !$oUser->oxuser__oxpassword->value) {
00122 oxRegistry::getSession()->deleteVariable('usr');
00123 oxRegistry::getSession()->deleteVariable('dynvalue');
00124 }
00125
00126
00127 if ($this->_oBasket->getOrderId()) {
00128
00129 $oEmail = oxNew('oxemail');
00130 $oEmail->sendStockReminder($this->_oBasket->getContents());
00131 }
00132
00133
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 getAlsoBoughtTheseProducts()
00155 {
00156 if ($this->_aLastProducts === null) {
00157 $this->_aLastProducts = false;
00158
00159 $aBasketContents = array_values($this->getBasket()->getContents());
00160 if ($oBasketItem = $aBasketContents[0]) {
00161 if ($oProduct = $oBasketItem->getArticle(false)) {
00162 $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
00163 }
00164 }
00165 }
00166
00167 return $this->_aLastProducts;
00168 }
00169
00175 public function getCurrencyCovIndex()
00176 {
00177 if ($this->_dConvIndex === null) {
00178
00179 $oCur = $this->getConfig()->getActShopCurrencyObject();
00180 $this->_dConvIndex = 1 / $oCur->rate;
00181 }
00182
00183 return $this->_dConvIndex;
00184 }
00185
00191 public function getIPaymentBasket()
00192 {
00193 if ($this->_dIPaymentBasket === null) {
00194 $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
00195 }
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
00212 return $this->_sIPaymentAccount;
00213 }
00214
00220 public function getIPaymentUser()
00221 {
00222 if ($this->_sIPaymentUser === null) {
00223 $this->_sIPaymentUser = false;
00224 $this->_sIPaymentUser = $this->getConfig()->getConfigParam('iShopID_iPayment_User');
00225 }
00226
00227 return $this->_sIPaymentUser;
00228 }
00229
00235 public function getIPaymentPassword()
00236 {
00237 if ($this->_sIPaymentPassword === null) {
00238 $this->_sIPaymentPassword = false;
00239 $this->_sIPaymentPassword = $this->getConfig()->getConfigParam('iShopID_iPayment_Passwort');
00240 }
00241
00242 return $this->_sIPaymentPassword;
00243 }
00244
00250 public function getMailError()
00251 {
00252 if ($this->_sMailError === null) {
00253 $this->_sMailError = false;
00254 $this->_sMailError = oxRegistry::getConfig()->getRequestParameter('mailerror');
00255 }
00256
00257 return $this->_sMailError;
00258 }
00259
00265 public function getOrder()
00266 {
00267 if ($this->_oOrder === null) {
00268 $this->_oOrder = oxNew('oxorder');
00269
00270 if ($sOrderId = $this->getBasket()->getOrderId()) {
00271 $this->_oOrder->load($sOrderId);
00272 }
00273 }
00274
00275 return $this->_oOrder;
00276 }
00277
00283 public function getCountryISO3()
00284 {
00285 $oOrder = $this->getOrder();
00286 if ($oOrder) {
00287 $oCountry = oxNew('oxcountry');
00288 $oCountry->load($oOrder->oxorder__oxbillcountryid->value);
00289
00290 return $oCountry->oxcountry__oxisoalpha3->value;
00291 }
00292 }
00293
00300 public function getActionClassName()
00301 {
00302 return 'start';
00303 }
00304
00310 public function getBreadCrumb()
00311 {
00312 $aPaths = array();
00313 $aPath = array();
00314
00315
00316 $iLang = oxRegistry::getLang()->getBaseLanguage();
00317 $aPath['title'] = oxRegistry::getLang()->translateString('ORDER_COMPLETED', $iLang, false);
00318 $aPath['link'] = $this->getLink();
00319 $aPaths[] = $aPath;
00320
00321 return $aPaths;
00322 }
00323 }