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 $_blBargainAction = true;
00048 
00049 
00055     public function getWishUser()
00056     {
00057 
00058         if ( $this->_oWishUser === null) {
00059             $this->_oWishUser = false;
00060 
00061             $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
00062             if ( $sUserId ) {
00063                 $oUser = oxNew( 'oxuser' );
00064                 if ( $oUser->load( $sUserId ) ) {
00065 
00066                     // passing wishlist information
00067                     $this->_oWishUser = $oUser;
00068 
00069                     // store this one to session
00070                     oxSession::setVar( 'wishid', $sUserId );
00071                 }
00072             }
00073         }
00074         return $this->_oWishUser;
00075     }
00076 
00082     public function getWishList()
00083     {
00084         if ( $this->_oWishList === null) {
00085             $this->_oWishList = false;
00086 
00087             // passing wishlist information
00088             if ( $oUser = $this->getWishUser() ) {
00089 
00090                 $oWishlistBasket = $oUser->getBasket( 'wishlist' );
00091                 $this->_oWishList = $oWishlistBasket->getArticles();
00092 
00093                 if (!$oWishlistBasket->isVisible())
00094                     $this->_oWishList = false;
00095 
00096 
00097             }
00098         }
00099         return $this->_oWishList;
00100     }
00101 
00111     public function searchForWishList()
00112     {
00113         if ( $sSearch = oxConfig::getParameter( 'search' ) ) {
00114 
00115             // search for baskets
00116             $oUserList = oxNew( 'oxuserlist' );
00117             $oUserList->loadWishlistUsers( $sSearch );
00118             if ( $oUserList->count() ) {
00119                 $this->_oWishListUsers = $oUserList;
00120             }
00121             $this->_sSearchParam = $sSearch;
00122         }
00123     }
00124 
00131     public function getWishListUsers()
00132     {
00133         return $this->_oWishListUsers;
00134     }
00135 
00141     public function getWishListSearchParam()
00142     {
00143         return $this->_sSearchParam;
00144     }
00145 
00151     public function getBreadCrumb()
00152     {
00153         $aPaths = array();
00154         $aPath = array();
00155 
00156         $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_WISHLIST_PRODUCTS_TITLE', oxRegistry::getLang()->getBaseLanguage(), false );
00157         $aPath['link']  = $this->getLink();
00158         $aPaths[] = $aPath;
00159 
00160         return $aPaths;
00161     }
00162 }