wishlist.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Wishlist extends oxUBase
00007 {
00008 
00013     protected $_sThisTemplate = 'page/wishlist/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 
00055 
00061     public function getWishUser()
00062     {
00063 
00064         if ( $this->_oWishUser === null) {
00065             $this->_oWishUser = false;
00066 
00067             $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
00068             if ( $sUserId ) {
00069                 $oUser = oxNew( 'oxuser' );
00070                 if ( $oUser->load( $sUserId ) ) {
00071 
00072                     // passing wishlist information
00073                     $this->_oWishUser = $oUser;
00074 
00075                     // store this one to session
00076                     oxSession::setVar( 'wishid', $sUserId );
00077                 }
00078             }
00079         }
00080         return $this->_oWishUser;
00081     }
00082 
00088     public function getWishList()
00089     {
00090         if ( $this->_oWishList === null) {
00091             $this->_oWishList = false;
00092 
00093             // passing wishlist information
00094             if ( $oUser = $this->getWishUser() ) {
00095 
00096                 $oWishlistBasket = $oUser->getBasket( 'wishlist' );
00097                 $this->_oWishList = $oWishlistBasket->getArticles();
00098 
00099                 if (!$oWishlistBasket->isVisible())
00100                     $this->_oWishList = false;
00101 
00102 
00103             }
00104         }
00105         return $this->_oWishList;
00106     }
00107 
00117     public function searchForWishList()
00118     {
00119         if ( $sSearch = oxConfig::getParameter( 'search' ) ) {
00120 
00121             // search for baskets
00122             $oUserList = oxNew( 'oxuserlist' );
00123             $oUserList->loadWishlistUsers( $sSearch );
00124             if ( $oUserList->count() ) {
00125                 $this->_oWishListUsers = $oUserList;
00126             }
00127             $this->_sSearchParam = $sSearch;
00128         }
00129     }
00130 
00137     public function getWishListUsers()
00138     {
00139         return $this->_oWishListUsers;
00140     }
00141 
00147     public function getWishListSearchParam()
00148     {
00149         return $this->_sSearchParam;
00150     }
00151 
00157     public function getBreadCrumb()
00158     {
00159         $aPaths = array();
00160         $aPath = array();
00161 
00162         $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_WISHLIST_PRODUCTS_TITLE', oxRegistry::getLang()->getBaseLanguage(), false );
00163         $aPath['link']  = $this->getLink();
00164         $aPaths[] = $aPath;
00165 
00166         return $aPaths;
00167     }
00168 }