OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
thankyou.php
Go to the documentation of this file.
1 <?php
2 
7 class Thankyou extends oxUBase
8 {
9 
15  protected $_oBasket = null;
16 
22  protected $_aLastProducts = null;
23 
29  protected $_dConvIndex = null;
30 
36  protected $_dIPaymentBasket = null;
37 
43  protected $_sIPaymentAccount = null;
44 
50  protected $_sIPaymentUser = null;
51 
57  protected $_sIPaymentPassword = null;
58 
64  protected $_sMailError = null;
65 
71  protected $_blBargainAction = true;
72 
73 
79  protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
80 
87  public function init()
88  {
89  parent::init();
90 
91  // get basket we might need some information from it here
92  $oBasket = $this->getSession()->getBasket();
93  $oBasket->setOrderId(oxRegistry::getSession()->getVariable('sess_challenge'));
94 
95  // copying basket object
96  $this->_oBasket = clone $oBasket;
97 
98  // delete it from the session
99  $oBasket->deleteBasket();
100  oxRegistry::getSession()->deleteVariable('sess_challenge');
101  }
102 
110  public function render()
111  {
112  if (!$this->_oBasket || !$this->_oBasket->getProductsCount()) {
113  oxRegistry::getUtils()->redirect($this->getConfig()->getShopHomeURL() . '&cl=start', true, 302);
114  }
115 
116  parent::render();
117 
118  $oUser = $this->getUser();
119 
120  // removing also unregistered user info (#2580)
121  if (!$oUser || !$oUser->oxuser__oxpassword->value) {
122  oxRegistry::getSession()->deleteVariable('usr');
123  oxRegistry::getSession()->deleteVariable('dynvalue');
124  }
125 
126  // loading order sometimes needed in template
127  if ($this->_oBasket->getOrderId()) {
128  // owners stock reminder
129  $oEmail = oxNew('oxEmail');
130  $oEmail->sendStockReminder($this->_oBasket->getContents());
131  }
132 
133  // we must set active class as start
134  $this->getViewConfig()->setViewConfigParam('cl', 'start');
135 
136  return $this->_sThisTemplate;
137  }
138 
144  public function getBasket()
145  {
146  return $this->_oBasket;
147  }
148 
154  public function getAlsoBoughtTheseProducts()
155  {
156  if ($this->_aLastProducts === null) {
157  $this->_aLastProducts = false;
158  // 5th order step
159  $aBasketContents = array_values($this->getBasket()->getContents());
160  if ($oBasketItem = $aBasketContents[0]) {
161  if ($oProduct = $oBasketItem->getArticle(false)) {
162  $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
163  }
164  }
165  }
166 
167  return $this->_aLastProducts;
168  }
169 
175  public function getCurrencyCovIndex()
176  {
177  if ($this->_dConvIndex === null) {
178  // currency conversion index value
179  $oCur = $this->getConfig()->getActShopCurrencyObject();
180  $this->_dConvIndex = 1 / $oCur->rate;
181  }
182 
183  return $this->_dConvIndex;
184  }
185 
191  public function getIPaymentBasket()
192  {
193  if ($this->_dIPaymentBasket === null) {
194  $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
195  }
196 
198  }
199 
205  public function getIPaymentAccount()
206  {
207  if ($this->_sIPaymentAccount === null) {
208  $this->_sIPaymentAccount = false;
209  $this->_sIPaymentAccount = $this->getConfig()->getConfigParam('iShopID_iPayment_Account');
210  }
211 
213  }
214 
220  public function getIPaymentUser()
221  {
222  if ($this->_sIPaymentUser === null) {
223  $this->_sIPaymentUser = false;
224  $this->_sIPaymentUser = $this->getConfig()->getConfigParam('iShopID_iPayment_User');
225  }
226 
227  return $this->_sIPaymentUser;
228  }
229 
235  public function getIPaymentPassword()
236  {
237  if ($this->_sIPaymentPassword === null) {
238  $this->_sIPaymentPassword = false;
239  $this->_sIPaymentPassword = $this->getConfig()->getConfigParam('iShopID_iPayment_Passwort');
240  }
241 
243  }
244 
250  public function getMailError()
251  {
252  if ($this->_sMailError === null) {
253  $this->_sMailError = false;
254  $this->_sMailError = oxRegistry::getConfig()->getRequestParameter('mailerror');
255  }
256 
257  return $this->_sMailError;
258  }
259 
265  public function getOrder()
266  {
267  if ($this->_oOrder === null) {
268  $this->_oOrder = oxNew('oxorder');
269  // loading order sometimes needed in template
270  if ($sOrderId = $this->getBasket()->getOrderId()) {
271  $this->_oOrder->load($sOrderId);
272  }
273  }
274 
275  return $this->_oOrder;
276  }
277 
283  public function getCountryISO3()
284  {
285  $oOrder = $this->getOrder();
286  if ($oOrder) {
287  $oCountry = oxNew('oxCountry');
288  $oCountry->load($oOrder->oxorder__oxbillcountryid->value);
289 
290  return $oCountry->oxcountry__oxisoalpha3->value;
291  }
292  }
293 
300  public function getActionClassName()
301  {
302  return 'start';
303  }
304 
310  public function getBreadCrumb()
311  {
312  $aPaths = array();
313  $aPath = array();
314 
315 
316  $iLang = oxRegistry::getLang()->getBaseLanguage();
317  $aPath['title'] = oxRegistry::getLang()->translateString('ORDER_COMPLETED', $iLang, false);
318  $aPath['link'] = $this->getLink();
319  $aPaths[] = $aPath;
320 
321  return $aPaths;
322  }
323 }