00001 <?php 00002 00010 class Account extends oxUBase 00011 { 00016 protected $_iOrderCnt = null; 00017 00022 protected $_sArticleId = null; 00023 00028 protected $_sSearchParamForHtml = null; 00029 00034 protected $_sSearchParam = null; 00035 00040 protected $_sSearchCatId = null; 00041 00046 protected $_sSearchVendor = null; 00047 00052 protected $_sSearchManufacturer = null; 00053 00058 protected $_sListType = null; 00059 00064 protected $_sThisTemplate = 'account_main.tpl'; 00065 00070 protected $_sThisLoginTemplate = 'account_login.tpl'; 00071 00077 protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW; 00078 00083 protected $_blTop5Action = true; 00084 00089 protected $_blBargainAction = true; 00090 00102 public function render() 00103 { 00104 parent::render(); 00105 00106 // loading actions 00107 $this->_loadActions(); 00108 00109 // 00110 if ( $sArtID = oxConfig::getParameter('aid') ) { 00111 $this->_aViewData['aid'] = $this->getArticleId(); 00112 // #1834M - specialchar search 00113 $this->_aViewData['searchparam'] = $this->getSearchParam(); 00114 $this->_aViewData['searchparamforhtml'] = $this->getSearchParamForHtml(); 00115 $this->_aViewData['searchcnid'] = $this->getSearchCatId(); 00116 $this->_aViewData['searchvendor'] = $this->getSearchVendor(); 00117 $this->_aViewData['searchmanufacturer'] = $this->getSearchManufacturer(); 00118 $this->_aViewData['listtype'] = $this->getListType(); 00119 } 00120 00121 // is logged in ? 00122 $oUser = $this->getUser(); 00123 if ( !$oUser || $oUser->oxuser__oxpassword->value == '' ) { 00124 return $this->_sThisTemplate = $this->_sThisLoginTemplate; 00125 } 00126 00127 // calculating amount of orders made by user 00128 $this->_aViewData['iordersmade'] = $this->getOrderCnt(); 00129 00130 return $this->_sThisTemplate; 00131 } 00132 00138 public function login_noredirect() 00139 { 00140 $sReturn = $this->_oaComponents['oxcmp_user']->login_noredirect(); 00141 00142 $sArtID = oxConfig::getParameter( 'aid' ); 00143 if ( $sArtID ) { 00144 $sReturn = "details?anid=$sArtID"; 00145 00146 $sCatId = oxConfig::getParameter( 'cnid' ); 00147 if ( $sCatId ) { 00148 $sReturn .= "&cnid=$sCatId"; 00149 } 00150 // #1834M - specialchar search 00151 $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ); 00152 if ( $sSearchParamForLink ) { 00153 $sReturn .= "&searchparam=$sSearchParamForLink"; 00154 } 00155 00156 $sSearchCatId = oxConfig::getParameter( 'searchcnid' ); 00157 if ( $sSearchCatId ) { 00158 $sReturn .= "&searchcnid=$sSearchCatId"; 00159 } 00160 00161 if ( ( $sSearchVendor = oxConfig::getParameter( 'searchvendor' ) ) ) { 00162 $sReturn .= "&searchvendor=$sSearchVendor"; 00163 } 00164 00165 if ( ( $sSearchManufacturer = oxConfig::getParameter( 'searchmanufacturer' ) ) ) { 00166 $sReturn .= "&searchmanufacturer=$sSearchManufacturer"; 00167 } 00168 00169 $sListType = oxConfig::getParameter( 'listtype' ); 00170 if ( $sListType ) { 00171 $sReturn .= "&listtype=$sListType"; 00172 } 00173 } 00174 00175 return $sReturn; 00176 } 00177 00183 public function getOrderCnt() 00184 { 00185 if ( $this->_iOrderCnt === null ) { 00186 $this->_iOrderCnt = 0; 00187 if ( $oUser = $this->getUser() ) { 00188 $this->_iOrderCnt = $oUser->getOrderCount(); 00189 } 00190 } 00191 return $this->_iOrderCnt; 00192 } 00193 00199 public function getArticleId() 00200 { 00201 if ( $this->_sArticleId === null) { 00202 // passing wishlist information 00203 if ( $sArticleId = oxConfig::getParameter('aid') ) { 00204 $this->_sArticleId = $sArticleId; 00205 } 00206 } 00207 return $this->_sArticleId; 00208 } 00209 00215 public function getSearchParamForHtml() 00216 { 00217 if ( $this->_sSearchParamForHtml === null ) { 00218 $this->_sSearchParamForHtml = false; 00219 if ( $this->getArticleId() ) { 00220 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' ); 00221 } 00222 } 00223 return $this->_sSearchParamForHtml; 00224 } 00225 00231 public function getSearchParam() 00232 { 00233 if ( $this->_sSearchParam === null ) { 00234 $this->_sSearchParam = false; 00235 if ( $this->getArticleId() ) { 00236 $this->_sSearchParam = rawurlencode( oxConfig::getParameter( 'searchparam', true ) ); 00237 } 00238 } 00239 return $this->_sSearchParam; 00240 } 00241 00247 public function getSearchCatId() 00248 { 00249 if ( $this->_sSearchCatId === null ) { 00250 $this->_sSearchCatId = false; 00251 if ( $this->getArticleId() ) { 00252 $this->_sSearchCatId = rawurldecode( oxConfig::getParameter( 'searchcnid' ) ); 00253 } 00254 } 00255 return $this->_sSearchCatId; 00256 } 00257 00263 public function getSearchVendor() 00264 { 00265 if ( $this->_sSearchVendor === null ) { 00266 $this->_sSearchVendor = false; 00267 if ( $this->getArticleId() ) { 00268 // searching in vendor #671 00269 $this->_sSearchVendor = rawurldecode( oxConfig::getParameter( 'searchvendor' ) ); 00270 } 00271 } 00272 return $this->_sSearchVendor; 00273 } 00274 00280 public function getSearchManufacturer() 00281 { 00282 if ( $this->_sSearchManufacturer === null ) { 00283 $this->_sSearchManufacturer = false; 00284 if ( $this->getArticleId() ) { 00285 // searching in Manufacturer #671 00286 $this->_sSearchManufacturer = rawurldecode( oxConfig::getParameter( 'searchmanufacturer' ) ); 00287 } 00288 } 00289 return $this->_sSearchManufacturer; 00290 } 00291 00297 public function getListType() 00298 { 00299 if ( $this->_sListType === null ) { 00300 $this->_sListType = false; 00301 if ( $this->getArticleId() ) { 00302 // searching in vendor #671 00303 $this->_sListType = oxConfig::getParameter( 'listtype' ); 00304 } 00305 } 00306 return $this->_sListType; 00307 } 00308 00309 }