/** * Retrieve wishlist item collection * * @return Mage_Wishlist_Model_Mysql4_Item_Collection */ public function getItemCollection() { if (is_null($this->_itemCollection)) { /** @var $currentWebsiteOnly boolean */ $currentWebsiteOnly = !Mage::app()->getStore()->isAdmin(); $this->_itemCollection = Mage::getResourceModel('wishlist/item_collection')->addWishlistFilter($this)->addStoreFilter($this->getSharedStoreIds($currentWebsiteOnly))->setVisibilityFilter(); if (Mage::app()->getStore()->isAdmin()) { $customer = Mage::getModel('customer/customer')->load($this->getCustomerId()); $this->_itemCollection->setWebsiteId($customer->getWebsiteId()); $this->_itemCollection->setCustomerGroupId($customer->getGroupId()); } } return $this->_itemCollection; }
/** * Add wishlist conditions to collection * * @param Mage_Wishlist_Model_Mysql4_Item_Collection $collection * @return Mage_Wishlist_Block_Customer_Wishlist */ protected function _prepareCollection($collection) { $collection->setInStockFilter(true)->setOrder('added_at', 'ASC'); return $this; }
/** * Add sidebar conditions to collection * * @param Mage_Wishlist_Model_Mysql4_Item_Collection $collection * @return Mage_Wishlist_Block_Customer_Wishlist */ protected function _prepareCollection($collection) { $collection->setCurPage(1)->setPageSize(3)->setInStockFilter(true)->addWishListSortOrder('added_at', 'desc'); return $this; }