wishlist.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Wishlist extends oxUBase
00007 {
00008 
00013     protected $_sThisTemplate = 'wishlist.tpl';
00014 
00020     protected $_oWishUser = null;
00021 
00027     protected $_oWishList = null;
00028 
00034     protected $_sSearchParam = null;
00035 
00041     protected $_oWishListUsers = false;
00042 
00047     protected $_blTop5Action = true;
00048 
00053     protected $_blBargainAction = true;
00054 
00068     public function render()
00069     {
00070         parent::render();
00071 
00072         // loading actions
00073         $this->_loadActions();
00074 
00075         //for older templates
00076         $this->_aViewData['wishuser'] = $this->getWishUser();
00077         $this->_aViewData['wishlist'] = $this->getWishList();
00078 
00079         $this->_aViewData['wish_result'] = $this->getWishListUsers();
00080         $this->_aViewData['search']      = $this->getWishListSearchParam();
00081         return $this->_sThisTemplate;
00082     }
00083 
00084 
00090     public function getWishUser()
00091     {
00092 
00093         if ( $this->_oWishUser === null) {
00094             $this->_oWishUser = false;
00095 
00096             if ( $sUserID = oxConfig::getParameter( 'wishid' ) ) {
00097                 $oUser = oxNew( 'oxuser' );
00098                 if ( $oUser->load( $sUserID ) ) {
00099 
00100                     // passing wishlist information
00101                     $this->_oWishUser = $oUser;
00102 
00103                     // store this one to session
00104                     oxSession::setVar( 'wishid', $sUserID );
00105                 }
00106             }
00107         }
00108         return $this->_oWishUser;
00109     }
00110 
00116     public function getWishList()
00117     {
00118         if ( $this->_oWishList === null) {
00119             $this->_oWishList = false;
00120 
00121             // passing wishlist information
00122             if ( $oUser = $this->getWishUser() ) {
00123 
00124                 $oWishlistBasket = $oUser->getBasket( 'wishlist' );
00125                 $this->_oWishList = $oWishlistBasket->getArticles();
00126 
00127                 if (!$oWishlistBasket->isVisible())
00128                     $this->_oWishList = false;
00129 
00130 
00131             }
00132         }
00133         return $this->_oWishList;
00134     }
00135 
00145     public function searchForWishList()
00146     {
00147         if ( $sSearch = oxConfig::getParameter( 'search' ) ) {
00148 
00149             // search for baskets
00150             $oUserList = oxNew( 'oxuserlist' );
00151             $oUserList->loadWishlistUsers( $sSearch );
00152             if ( $oUserList->count() ) {
00153                 $this->_oWishListUsers = $oUserList;
00154             }
00155             $this->_sSearchParam = $sSearch;
00156         }
00157     }
00158 
00165     public function getWishListUsers()
00166     {
00167         return $this->_oWishListUsers;
00168     }
00169 
00175     public function getWishListSearchParam()
00176     {
00177         return $this->_sSearchParam;
00178     }
00179 }