OXID eShop CE  4.8.11
 All Classes Files Functions Variables Pages
wishlist.php
Go to the documentation of this file.
1 <?php
2 
6 class Wishlist extends oxUBase
7 {
8 
13  protected $_sThisTemplate = 'page/wishlist/wishlist.tpl';
14 
20  protected $_oWishUser = null;
21 
27  protected $_oWishList = null;
28 
34  protected $_sSearchParam = null;
35 
41  protected $_oWishListUsers = false;
42 
47  protected $_blBargainAction = true;
48 
49 
55  public function getWishUser()
56  {
57 
58  if ( $this->_oWishUser === null) {
59  $this->_oWishUser = false;
60 
61  $sUserId = oxConfig::getParameter( 'wishid') ? oxConfig::getParameter( 'wishid' ): oxSession::getVar( 'wishid');
62  if ( $sUserId ) {
63  $oUser = oxNew( 'oxuser' );
64  if ( $oUser->load( $sUserId ) ) {
65 
66  // passing wishlist information
67  $this->_oWishUser = $oUser;
68 
69  // store this one to session
70  oxSession::setVar( 'wishid', $sUserId );
71  }
72  }
73  }
74  return $this->_oWishUser;
75  }
76 
82  public function getWishList()
83  {
84  if ( $this->_oWishList === null) {
85  $this->_oWishList = false;
86 
87  // passing wishlist information
88  if ( $oUser = $this->getWishUser() ) {
89 
90  $oWishlistBasket = $oUser->getBasket( 'wishlist' );
91  $this->_oWishList = $oWishlistBasket->getArticles();
92 
93  if (!$oWishlistBasket->isVisible())
94  $this->_oWishList = false;
95 
96 
97  }
98  }
99  return $this->_oWishList;
100  }
101 
111  public function searchForWishList()
112  {
113  if ( $sSearch = oxConfig::getParameter( 'search' ) ) {
114 
115  // search for baskets
116  $oUserList = oxNew( 'oxuserlist' );
117  $oUserList->loadWishlistUsers( $sSearch );
118  if ( $oUserList->count() ) {
119  $this->_oWishListUsers = $oUserList;
120  }
121  $this->_sSearchParam = $sSearch;
122  }
123  }
124 
131  public function getWishListUsers()
132  {
133  return $this->_oWishListUsers;
134  }
135 
141  public function getWishListSearchParam()
142  {
143  return $this->_sSearchParam;
144  }
145 
151  public function getBreadCrumb()
152  {
153  $aPaths = array();
154  $aPath = array();
155 
156  $aPath['title'] = oxRegistry::getLang()->translateString( 'PUBLIC_GIFT_REGISTRIES', oxRegistry::getLang()->getBaseLanguage(), false );
157  $aPath['link'] = $this->getLink();
158  $aPaths[] = $aPath;
159 
160  return $aPaths;
161  }
162 }