Go to the documentation of this file.00001 <?php
00002
00007 class User extends oxUBase
00008 {
00013 protected $_sThisTemplate = 'page/checkout/user.tpl';
00014
00019 protected $_blIsOrderStep = true;
00020
00025 protected $_blShowNoRegOpt = null;
00026
00031 protected $_sSelectedAddress = null;
00032
00037 protected $_iOption = null;
00038
00043 protected $_oCountryList = null;
00044
00049 protected $_sOrderRemark = null;
00050
00055 protected $_sWishId = null;
00056
00057
00068 public function render()
00069 {
00070 $myConfig = $this->getConfig();
00071
00072 if ( $this->getIsOrderStep() ) {
00073 if ($myConfig->getConfigParam( 'blPsBasketReservationEnabled' )) {
00074 $this->getSession()->getBasketReservations()->renewExpiration();
00075 }
00076
00077 $oBasket = $this->getSession()->getBasket();
00078 if ( $this->_blIsOrderStep && $myConfig->getConfigParam( 'blPsBasketReservationEnabled' ) && (!$oBasket || ( $oBasket && !$oBasket->getProductsCount() )) ) {
00079 oxRegistry::getUtils()->redirect( $myConfig->getShopHomeURL() .'cl=basket', true, 302 );
00080 }
00081 }
00082
00083 parent::render();
00084
00085 if ( $myConfig->getConfigParam( "bl_showFbConnect" ) && !$this->getUser() ) {
00086 $this->_fillFormWithFacebookData();
00087 }
00088
00089 return $this->_sThisTemplate;
00090 }
00091
00097 public function getShowNoRegOption()
00098 {
00099 if ( $this->_blShowNoRegOpt === null ) {
00100 $this->_blShowNoRegOpt = !$this->getConfig()->getConfigParam( 'blOrderDisWithoutReg' );
00101 }
00102 return $this->_blShowNoRegOpt;
00103 }
00104
00110 public function getLoginOption()
00111 {
00112 if ( $this->_iOption === null ) {
00113
00114 $iOption = oxConfig::getParameter( 'option' );
00115
00116 if ( $iOption == 2 && !$this->getUser() ) {
00117 $iOption = 0;
00118 }
00119 $this->_iOption = $iOption;
00120 }
00121 return $this->_iOption;
00122 }
00123
00129 public function getOrderRemark()
00130 {
00131 if ( $this->_sOrderRemark === null ) {
00132 $sOrderRemark = false;
00133
00134 if ( $this->getUser() ) {
00135 $sOrderRemark = oxSession::getVar( 'ordrem' );
00136 } else {
00137
00138 $sOrderRemark = oxConfig::getParameter( 'order_remark', true );
00139 }
00140
00141 $this->_sOrderRemark = $sOrderRemark ? oxRegistry::getConfig()->checkParamSpecialChars( $sOrderRemark ) : false;
00142 }
00143 return $this->_sOrderRemark;
00144 }
00145
00151 public function isNewsSubscribed()
00152 {
00153 if ( $this->_blNewsSubscribed === null ) {
00154 $blNews = false;
00155 if ( ( $blNews = oxConfig::getParameter( 'blnewssubscribed' ) ) === null ) {
00156 $blNews = false;
00157 }
00158 if ( ( $oUser = $this->getUser() ) ) {
00159 $blNews = $oUser->getNewsSubscription()->getOptInStatus();
00160 }
00161 $this->_blNewsSubscribed = $blNews;
00162 }
00163
00164 if (is_null($this->_blNewsSubscribed))
00165 $this->_blNewsSubscribed = false;
00166
00167 return $this->_blNewsSubscribed;
00168 }
00169
00175 public function showShipAddress()
00176 {
00177 return oxSession::getVar( 'blshowshipaddress' );
00178 }
00179
00185 protected function _fillFormWithFacebookData()
00186 {
00187
00188 $oFacebook = oxRegistry::get("oxFb");
00189
00190 if ( $oFacebook->isConnected() ) {
00191 $aMe = $oFacebook->api('/me');
00192
00193 $aInvAdr = $this->getInvoiceAddress();
00194 $sCharset = oxRegistry::getLang()->translateString( "charset" );
00195
00196
00197 $sCharset .= '//TRANSLIT';
00198
00199 if ( !$aInvAdr["oxuser__oxfname"] ) {
00200 $aInvAdr["oxuser__oxfname"] = iconv( 'UTF-8', $sCharset, $aMe["first_name"] );
00201 }
00202
00203 if ( !$aInvAdr["oxuser__oxlname"] ) {
00204 $aInvAdr["oxuser__oxlname"] = iconv( 'UTF-8', $sCharset, $aMe["last_name"] );
00205 }
00206
00207 $this->setInvoiceAddress( $aInvAdr );
00208 }
00209 }
00210
00216 public function modifyBillAddress()
00217 {
00218 return oxConfig::getParameter( 'blnewssubscribed' );
00219 }
00220
00226 public function getBreadCrumb()
00227 {
00228 $aPaths = array();
00229 $aPath = array();
00230
00231 $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_CHECKOUT_USER', oxRegistry::getLang()->getBaseLanguage(), false );
00232 $aPath['link'] = $this->getLink();
00233
00234 $aPaths[] = $aPath;
00235
00236 return $aPaths;
00237 }
00238
00244 public function isDownloadableProductWarning()
00245 {
00246 $oBasket = $this->getSession()->getBasket();
00247 if ( $oBasket && $this->getConfig()->getConfigParam( "blEnableDownloads" ) ) {
00248 if ( $oBasket->hasDownloadableProducts() ) {
00249 return true;
00250 }
00251 }
00252 return false;
00253 }
00254 }