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 } elseif ( $sOrderRemark = oxConfig::getParameter( 'order_remark' ) ) {
00156 $this->_sOrderRemark = $sOrderRemark;
00157 }
00158 }
00159 return $this->_sOrderRemark;
00160 }
00161
00167 public function isNewsSubscribed()
00168 {
00169 if ( $this->_blNewsSubscribed === null ) {
00170 $blNews = false;
00171 if ( ( $blNews = oxConfig::getParameter( 'blnewssubscribed' ) ) === null ) {
00172 $blNews = false;
00173 }
00174 if ( ( $oUser = $this->getUser() ) ) {
00175 $blNews = $oUser->getNewsSubscription()->getOptInStatus();
00176 }
00177 $this->_blNewsSubscribed = $blNews;
00178 }
00179
00180 if (is_null($this->_blNewsSubscribed))
00181 $this->_blNewsSubscribed = false;
00182
00183 return $this->_blNewsSubscribed;
00184 }
00185
00191 public function showShipAddress()
00192 {
00193 return oxSession::getVar( 'blshowshipaddress' );
00194 }
00195
00201 protected function _fillFormWithFacebookData()
00202 {
00203
00204 $oFacebook = oxFb::getInstance();
00205
00206 if ( $oFacebook->isConnected() ) {
00207 $aMe = $oFacebook->api('/me');
00208
00209 $aInvAdr = $this->getInvoiceAddress();
00210 $sCharset = oxLang::getInstance()->translateString( "charset" );
00211
00212
00213 $sCharset .= '//TRANSLIT';
00214
00215 if ( !$aInvAdr["oxuser__oxfname"] ) {
00216 $aInvAdr["oxuser__oxfname"] = iconv( 'UTF-8', $sCharset, $aMe["first_name"] );
00217 }
00218
00219 if ( !$aInvAdr["oxuser__oxlname"] ) {
00220 $aInvAdr["oxuser__oxlname"] = iconv( 'UTF-8', $sCharset, $aMe["last_name"] );
00221 }
00222
00223 $this->setInvoiceAddress( $aInvAdr );
00224 }
00225 }
00226
00232 public function modifyBillAddress()
00233 {
00234 return oxConfig::getParameter( 'blnewssubscribed' );
00235 }
00236
00242 public function getBreadCrumb()
00243 {
00244 $aPaths = array();
00245 $aPath = array();
00246
00247 $aPath['title'] = oxLang::getInstance()->translateString( 'PAGE_CHECKOUT_USER', oxLang::getInstance()->getBaseLanguage(), false );
00248 $aPaths[] = $aPath;
00249
00250 return $aPaths;
00251 }
00252 }