OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
thankyou.php
Go to the documentation of this file.
1 <?php
2 
7 class Thankyou extends oxUBase
8 {
13  protected $_oBasket = null;
14 
19  protected $_aLastProducts = null;
20 
25  protected $_dConvIndex = null;
26 
31  protected $_dIPaymentBasket = null;
32 
37  protected $_sIPaymentAccount = null;
38 
43  protected $_sIPaymentUser = null;
44 
49  protected $_sIPaymentPassword = null;
50 
55  protected $_sMailError = null;
56 
61  protected $_blBargainAction = true;
62 
63 
68  protected $_sThisTemplate = 'page/checkout/thankyou.tpl';
69 
78  public function init()
79  {
80  parent::init();
81 
82  // get basket we might need some information from it here
83  $oBasket = $this->getSession()->getBasket();
84  $oBasket->setOrderId( oxSession::getVar( 'sess_challenge' ) );
85 
86  // copying basket object
87  $this->_oBasket = clone $oBasket;
88 
89  // delete it from the session
90  $oBasket->deleteBasket();
91  oxSession::deleteVar( 'sess_challenge' );
92  }
93 
101  public function render()
102  {
103  if ( !$this->_oBasket || !$this->_oBasket->getProductsCount() ) {
104  oxRegistry::getUtils()->redirect( $this->getConfig()->getShopHomeURL().'&cl=start', true, 302 );
105  }
106 
107  parent::render();
108 
109  $oUser = $this->getUser();
110 
111  // removing also unregistered user info (#2580)
112  if ( !$oUser || !$oUser->oxuser__oxpassword->value) {
113  oxSession::deleteVar( 'usr' );
114  oxSession::deleteVar( 'dynvalue' );
115  }
116 
117  // loading order sometimes needed in template
118  if ( $this->_oBasket->getOrderId() ) {
119  // owners stock reminder
120  $oEmail = oxNew( 'oxemail' );
121  $oEmail->sendStockReminder( $this->_oBasket->getContents() );
122  }
123 
124  // we must set active class as start
125  $this->getViewConfig()->setViewConfigParam( 'cl', 'start' );
126 
127  return $this->_sThisTemplate;
128  }
129 
135  public function getBasket()
136  {
137  return $this->_oBasket;
138  }
139 
147  public function showFinalStep()
148  {
149  return true;
150  }
151 
157  public function getAlsoBoughtTheseProducts()
158  {
159  if ( $this->_aLastProducts === null ) {
160  $this->_aLastProducts = false;
161  // 5th order step
162  $aBasketContents = array_values($this->getBasket()->getContents());
163  if ( $oBasketItem = $aBasketContents[0] ) {
164  if ( $oProduct = $oBasketItem->getArticle(false) ) {
165  $this->_aLastProducts = $oProduct->getCustomerAlsoBoughtThisProducts();
166  }
167  }
168  }
169  return $this->_aLastProducts;
170  }
171 
177  public function getCurrencyCovIndex()
178  {
179  if ( $this->_dConvIndex === null ) {
180  // currency conversion index value
181  $oCur = $this->getConfig()->getActShopCurrencyObject();
182  $this->_dConvIndex = 1 / $oCur->rate;
183  }
184  return $this->_dConvIndex;
185  }
186 
192  public function getIPaymentBasket()
193  {
194  if ( $this->_dIPaymentBasket === null ) {
195  $this->_dIPaymentBasket = $this->getBasket()->getPrice()->getBruttoPrice() * 100;
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  }
212  }
213 
219  public function getIPaymentUser()
220  {
221  if ( $this->_sIPaymentUser === null ) {
222  $this->_sIPaymentUser = false;
223  $this->_sIPaymentUser = $this->getConfig()->getConfigParam( 'iShopID_iPayment_User' );
224  }
225  return $this->_sIPaymentUser;
226  }
227 
233  public function getIPaymentPassword()
234  {
235  if ( $this->_sIPaymentPassword === null ) {
236  $this->_sIPaymentPassword = false;
237  $this->_sIPaymentPassword = $this->getConfig()->getConfigParam( 'iShopID_iPayment_Passwort' );
238  }
240  }
241 
247  public function getMailError()
248  {
249  if ( $this->_sMailError === null ) {
250  $this->_sMailError = false;
251  $this->_sMailError = oxConfig::getParameter( 'mailerror' );
252  }
253  return $this->_sMailError;
254  }
255 
261  public function getOrder()
262  {
263  if ( $this->_oOrder === null ) {
264  $this->_oOrder = oxNew( 'oxorder' );
265  // loading order sometimes needed in template
266  if ( $sOrderId = $this->getBasket()->getOrderId() ) {
267  $this->_oOrder->load( $sOrderId );
268  }
269  }
270  return $this->_oOrder;
271  }
272 
278  public function getCountryISO3()
279  {
280  $oOrder = $this->getOrder();
281  if ( $oOrder ) {
282  $oCountry = oxNew( 'oxcountry' );
283  $oCountry->load( $oOrder->oxorder__oxbillcountryid->value );
284  return $oCountry->oxcountry__oxisoalpha3->value;
285  }
286  }
287 
294  public function getActionClassName()
295  {
296  return 'start';
297  }
298 
304  public function getBreadCrumb()
305  {
306  $aPaths = array();
307  $aPath = array();
308 
309 
310  $aPath['title'] = oxRegistry::getLang()->translateString( 'ORDER_COMPLETED', oxRegistry::getLang()->getBaseLanguage(), false );
311  $aPath['link'] = $this->getLink();
312  $aPaths[] = $aPath;
313 
314  return $aPaths;
315  }
316 }