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
00067 public function render()
00068 {
00069 $myConfig = $this->getConfig();
00070
00071 if ( $this->getIsOrderStep() ) {
00072 if ($myConfig->getConfigParam( 'blPsBasketReservationEnabled' )) {
00073 $this->getSession()->getBasketReservations()->renewExpiration();
00074 }
00075
00076 $oBasket = $this->getSession()->getBasket();
00077 if ( $this->_blIsOrderStep && $myConfig->getConfigParam( 'blPsBasketReservationEnabled' ) && (!$oBasket || ( $oBasket && !$oBasket->getProductsCount() )) ) {
00078 oxUtils::getInstance()->redirect( $myConfig->getShopHomeURL() .'cl=basket' );
00079 }
00080 }
00081
00082 parent::render();
00083
00084 if ( $myConfig->getConfigParam( "bl_showFbConnect" ) && !$this->getUser() ) {
00085 $this->_fillFormWithFacebookData();
00086 }
00087
00088 return $this->_sThisTemplate;
00089 }
00090
00096 public function getShowNoRegOption()
00097 {
00098 if ( $this->_blShowNoRegOpt === null ) {
00099 $this->_blShowNoRegOpt = !$this->getConfig()->getConfigParam( 'blOrderDisWithoutReg' );
00100 }
00101 return $this->_blShowNoRegOpt;
00102 }
00103
00109 public function getLoginOption()
00110 {
00111 if ( $this->_iOption === null ) {
00112
00113 $iOption = oxConfig::getParameter( 'option' );
00114
00115 if ( $iOption == 2 && !$this->getUser() ) {
00116 $iOption = 0;
00117 }
00118 $this->_iOption = $iOption;
00119 }
00120 return $this->_iOption;
00121 }
00122
00130 public function getCountryList()
00131 {
00132 if ( $this->_oCountryList === null ) {
00133 $this->_oCountryList = false;
00134
00135 $oCountryList = oxNew( 'oxcountrylist' );
00136 $oCountryList->loadActiveCountries();
00137 if ( $oCountryList->count() ) {
00138 $this->_oCountryList = $oCountryList;
00139 }
00140 }
00141 return $this->_oCountryList;
00142 }
00143
00149 public function getOrderRemark()
00150 {
00151 if ( $this->_sOrderRemark === null ) {
00152 $this->_sOrderRemark = false;
00153 if ( $sOrderRemark = oxSession::getVar( 'ordrem' ) ) {
00154 $this->_sOrderRemark = oxConfig::checkSpecialChars( $sOrderRemark );
00155 }
00156 }
00157 return $this->_sOrderRemark;
00158 }
00159
00165 public function isNewsSubscribed()
00166 {
00167 if ( $this->_blNewsSubscribed === null ) {
00168 $blNews = false;
00169 if ( ( $blNews = oxConfig::getParameter( 'blnewssubscribed' ) ) === null ) {
00170 $blNews = false;
00171 }
00172 if ( ( $oUser = $this->getUser() ) ) {
00173 $blNews = $oUser->getNewsSubscription()->getOptInStatus();
00174 }
00175 $this->_blNewsSubscribed = $blNews;
00176 }
00177
00178 if (is_null($this->_blNewsSubscribed))
00179 $this->_blNewsSubscribed = false;
00180
00181 return $this->_blNewsSubscribed;
00182 }
00183
00189 public function showShipAddress()
00190 {
00191 return oxSession::getVar( 'blshowshipaddress' );
00192 }
00193
00199 protected function _fillFormWithFacebookData()
00200 {
00201
00202 $oFacebook = oxFb::getInstance();
00203
00204 if ( $oFacebook->isConnected() ) {
00205 $aMe = $oFacebook->api('/me');
00206
00207 $aInvAdr = $this->getInvoiceAddress();
00208 $sCharset = oxLang::getInstance()->translateString( "charset" );
00209
00210
00211 $sCharset .= '//TRANSLIT';
00212
00213 if ( !$aInvAdr["oxuser__oxfname"] ) {
00214 $aInvAdr["oxuser__oxfname"] = iconv( 'UTF-8', $sCharset, $aMe["first_name"] );
00215 }
00216
00217 if ( !$aInvAdr["oxuser__oxlname"] ) {
00218 $aInvAdr["oxuser__oxlname"] = iconv( 'UTF-8', $sCharset, $aMe["last_name"] );
00219 }
00220
00221 $this->setInvoiceAddress( $aInvAdr );
00222 }
00223 }
00224
00230 public function modifyBillAddress()
00231 {
00232 return oxConfig::getParameter( 'blnewssubscribed' );
00233 }
00234
00240 public function getBreadCrumb()
00241 {
00242 $aPaths = array();
00243 $aPath = array();
00244
00245 $aPath['title'] = oxLang::getInstance()->translateString( 'PAGE_CHECKOUT_USER', oxLang::getInstance()->getBaseLanguage(), false );
00246 $aPath['link'] = $this->getLink();
00247
00248 $aPaths[] = $aPath;
00249
00250 return $aPaths;
00251 }
00252 }