Mage_Wishlist_Helper_Data Class Reference

Inheritance diagram for Mage_Wishlist_Helper_Data:

Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getWishlist ()
 hasItems ()
 getItemCount ()
 getItemCollection ()
 getProductCollection ()
 getSharingUrl ()
 getRemoveUrl ($item)
 getAddUrl ($item)
 getAddToCartUrl ($item)
 getAddToCartUrlBase64 ($item)
 getListUrl ()
 isAllow ()
 isAllowInCart ()
 getCustomerName ()
 getRssUrl ()
 isRssAllow ()
 defaultCommentString ()

Protected Member Functions

 _isCustomerLogIn ()
 _getCurrentCustomer ()

Protected Attributes

 $_wishlist = null
 $_itemCount = null
 $_itemCollection = null
 $_productCollection = null


Detailed Description

Base wishlist helper

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Data.php.


Member Function Documentation

_getCurrentCustomer (  )  [protected]

Retrieve logged in customer

Returns:
Mage_Customer_Model_Customer

Definition at line 54 of file Data.php.

00055     {
00056         return Mage::getSingleton('customer/session')->getCustomer();
00057     }

_isCustomerLogIn (  )  [protected]

Retrieve customer login status

Returns:
bool

Definition at line 44 of file Data.php.

00045     {
00046         return Mage::getSingleton('customer/session')->isLoggedIn();
00047     }

defaultCommentString (  ) 

Definition at line 225 of file Data.php.

00226     {
00227         return $this->__('Please, enter your comments...');
00228     }

getAddToCartUrl ( item  ) 

Retrieve url for adding item to shoping cart

Parameters:
Mage_Wishlist_Model_Item $item
Returns:
string

Definition at line 160 of file Data.php.

00161     {
00162         return $this->_getUrl('wishlist/index/cart', array('item'=>$item->getWishlistItemId()));
00163     }

getAddToCartUrlBase64 ( item  ) 

Retrieve url for adding item to shoping cart with b64 referer

Parameters:
Mage_Wishlist_Model_Item $item
Returns:
string

Definition at line 171 of file Data.php.

00172     {
00173         return $this->_getUrl('wishlist/index/cart', array(
00174             'item'=>$item->getWishlistItemId(),
00175             Mage_Core_Controller_Front_Action::PARAM_NAME_BASE64_URL => Mage::helper('core')->urlEncode(
00176                $this->_getUrl('*/*/*', array('_current'=>true))
00177             )
00178         ));
00179     }

getAddUrl ( item  ) 

Retrieve url for adding product to wishlist

Parameters:
mixed $product
Returns:
string

Definition at line 143 of file Data.php.

00144     {
00145         if ($item instanceof Mage_Catalog_Model_Product) {
00146             return $this->_getUrl('wishlist/index/add', array('product'=>$item->getId()));
00147         }
00148         if ($item instanceof Mage_Wishlist_Model_Item) {
00149             return $this->_getUrl('wishlist/index/add', array('product'=>$item->getProductId()));
00150         }
00151         return false;
00152     }

getCustomerName (  ) 

Definition at line 205 of file Data.php.

00206     {
00207         return $this->_getCurrentCustomer()->getName();
00208     }

getItemCollection (  ) 

Retrieve wishlist items collection

Returns:

Definition at line 104 of file Data.php.

00105     {
00106         if (is_null($this->_itemCollection)) {
00107             $this->_itemCollection = $this->getWishlist()->getProductCollection();
00108         }
00109         return $this->_itemCollection;
00110     }

getItemCount (  ) 

Retrieve wishlist item count

Returns:
int

Definition at line 88 of file Data.php.

00089     {
00090         if ($this->_isCustomerLogIn() && is_null($this->_itemCount)) {
00091             $this->_itemCount = $this->getWishlist()->getItemsCount();
00092         }
00093         elseif(is_null($this->_itemCount)) {
00094             $this->_itemCount = 0;
00095         }
00096         return $this->_itemCount;
00097     }

getListUrl (  ) 

Retrieve customer wishlist url

Returns:
string

Definition at line 187 of file Data.php.

00188     {
00189         return $this->_getUrl('wishlist');
00190     }

getProductCollection (  ) 

Definition at line 112 of file Data.php.

00113     {
00114         if (is_null($this->_productCollection)) {
00115             $this->_productCollection = $this->getWishlist()->getProductCollection();
00116         }
00117         return $this->_productCollection;
00118     }

getRemoveUrl ( item  ) 

Retrieve url for removing item from wishlist

Parameters:
Mage_Wishlist_Model_Item $item
Returns:
string

Definition at line 132 of file Data.php.

00133     {
00134         return $this->_getUrl('wishlist/index/remove', array('item'=>$item->getWishlistItemId()));
00135     }

getRssUrl (  ) 

Definition at line 210 of file Data.php.

00211     {
00212         $customer = $this->_getCurrentCustomer();
00213         $key = $customer->getId().','.$customer->getEmail();
00214         return $this->_getUrl('rss/index/wishlist',array('data' => Mage::helper('core')->urlEncode($key), '_secure' => false));
00215     }

getSharingUrl (  ) 

Definition at line 121 of file Data.php.

00122     {
00123 
00124     }

getWishlist (  ) 

Retrieve wishlist by logged in customer

Returns:
Mage_Wishlist_Model_Wishlist

Definition at line 64 of file Data.php.

00065     {
00066         if (is_null($this->_wishlist)) {
00067             $this->_wishlist = Mage::getModel('wishlist/wishlist')
00068                 ->loadByCustomer($this->_getCurrentCustomer());
00069         }
00070         return $this->_wishlist;
00071     }

hasItems (  ) 

Retrieve wishlist items availability

Returns:
bool

Definition at line 78 of file Data.php.

00079     {
00080         return $this->getItemCount();
00081     }

isAllow (  ) 

Definition at line 192 of file Data.php.

00193     {
00194         if (Mage::getStoreConfig('wishlist/general/active')) {
00195             return true;
00196         }
00197         return false;
00198     }

isAllowInCart (  ) 

Definition at line 200 of file Data.php.

00201     {
00202         return $this->isAllow() && $this->_isCustomerLogIn();
00203     }

isRssAllow (  ) 

Definition at line 217 of file Data.php.

00218     {
00219          if (Mage::getStoreConfig('rss/wishlist/active')) {
00220             return true;
00221         }
00222         return false;
00223     }


Member Data Documentation

$_itemCollection = null [protected]

Definition at line 36 of file Data.php.

$_itemCount = null [protected]

Definition at line 35 of file Data.php.

$_productCollection = null [protected]

Definition at line 37 of file Data.php.

$_wishlist = null [protected]

Definition at line 34 of file Data.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:57 2009 for Magento by  doxygen 1.5.8