Mage_Wishlist_Model_Mysql4_Product_Collection Class Reference

Inheritance diagram for Mage_Wishlist_Model_Mysql4_Product_Collection:

Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection Mage_Catalog_Model_Resource_Eav_Mysql4_Collection_Abstract Mage_Eav_Model_Entity_Collection_Abstract Varien_Data_Collection_Db Varien_Data_Collection Mage_Reports_Model_Mysql4_Wishlist_Product_Collection

List of all members.

Public Member Functions

 addWishlistFilter (Mage_Wishlist_Model_Wishlist $wishlist)
 addWishListSortOrder ($attribute= 'added_at', $dir= 'desc')
 addStoreData ()

Protected Member Functions

 _getAttributeFieldName ($attributeCode)


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

_getAttributeFieldName ( attributeCode  )  [protected]

Rewrite retrieve attribute field name for wishlist attributes

Parameters:
string $attributeCode
Returns:
Mage_Wishlist_Model_Mysql4_Product_Collection

Reimplemented from Mage_Eav_Model_Entity_Collection_Abstract.

Definition at line 110 of file Collection.php.

00111     {
00112         if ($attributeCode == 'days_in_wishlist') {
00113             return $this->_joinFields[$attributeCode]['field'];
00114         }
00115         return parent::_getAttributeFieldName($attributeCode);
00116     }

addStoreData (  ) 

Add store data (days in wishlist)

Returns:
Mage_Wishlist_Model_Mysql4_Product_Collection

Definition at line 87 of file Collection.php.

00088     {
00089         if (!isset($this->_joinFields['e_id'])) {
00090             return $this;
00091         }
00092 
00093         $dayTable = $this->_getAttributeTableAlias('days_in_wishlist');
00094         $this->joinField('store_name', 'core/store', 'name', 'store_id=store_id');
00095         $this->joinField('days_in_wishlist',
00096             'wishlist/item',
00097             "(TO_DAYS('" . Mage::getSingleton('core/date')->date() . "') - TO_DAYS(DATE_ADD(".$dayTable.".added_at, INTERVAL " .(int) Mage::getSingleton('core/date')->getGmtOffset() . " SECOND)))",
00098             'wishlist_item_id=wishlist_item_id'
00099         );
00100 
00101         return $this;
00102     }

addWishlistFilter ( Mage_Wishlist_Model_Wishlist wishlist  ) 

Add wishlist filter to collection

Parameters:
Mage_Wishlist_Model_Wishlist $wishlist
Returns:
Mage_Wishlist_Model_Mysql4_Product_Collection

Definition at line 44 of file Collection.php.

00045     {
00046         $this->_joinFields['e_id'] = array(
00047             'table' => 'e',
00048             'field' => 'entity_id'
00049         );
00050 
00051         $this->joinTable('wishlist/item',
00052             'product_id=e_id',
00053             array(
00054                 'product_id' => 'product_id',
00055                 'wishlist_item_description' => 'description',
00056                 'store_id' => 'store_id',
00057                 'added_at' => 'added_at',
00058                 'wishlist_id' => 'wishlist_id',
00059                 'wishlist_item_id' => 'wishlist_item_id',
00060             ),
00061             array(
00062                 'wishlist_id' => $wishlist->getId(),
00063                 'store_id'    => array('in' => $wishlist->getSharedStoreIds())
00064             )
00065         );
00066         return $this;
00067     }

addWishListSortOrder ( attribute = 'added_at',
dir = 'desc' 
)

Add wishlist sort order

Parameters:
string $att
string $dir
Returns:
Mage_Wishlist_Model_Mysql4_Product_Collection

Definition at line 76 of file Collection.php.

00077     {
00078         $this->setOrder($attribute, $dir);
00079         return $this;
00080     }


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