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