public function getWishlist()
 {
     if (!$this->_wishlist) {
         $this->_wishlist = AO::getModel('wishlist/wishlist')->loadByCustomer(AO::getSingleton('customer/session')->getCustomer());
         $this->_wishlist->getItemCollection()->addAttributeToSelect('name')->addAttributeToSelect('price')->addAttributeToSelect('small_image')->addAttributeToFilter('store_id', array('in' => $this->_wishlist->getSharedStoreIds()))->addAttributeToSort('added_at', 'desc')->setCurPage(1)->setPageSize(3)->load();
     }
     return $this->_wishlist->getItemCollection();
 }
Exemple #2
0
 /**
  * Fetch items count
  *
  * @param Mage_Wishlist_Model_Wishlist $wishlist
  * @return int
  */
 public function fetchItemsCount(Mage_Wishlist_Model_Wishlist $wishlist)
 {
     if (is_null($this->_itemsCount)) {
         $collection = $wishlist->getItemCollection()->addStoreFilter()->setVisibilityFilter();
         $this->_itemsCount = $collection->getSize();
     }
     return $this->_itemsCount;
 }
Exemple #3
0
 /**
  * Retrieve number of wishlist items in given wishlist
  *
  * @param Mage_Wishlist_Model_Wishlist $wishlist
  * @return int
  */
 public function getWishlistItemCount(Mage_Wishlist_Model_Wishlist $wishlist)
 {
     $collection = $wishlist->getItemCollection();
     if (Mage::getStoreConfig(self::XML_PATH_WISHLIST_LINK_USE_QTY)) {
         $count = $collection->getItemsQty();
     } else {
         $count = $collection->getSize();
     }
     return $count;
 }
Exemple #4
0
 /**
  * @param Mage_Wishlist_Model_Wishlist $wishlist
  *
  * @return Bronto_Common_Model_Email_Template_Filter
  */
 protected function _filterWishlist(Mage_Wishlist_Model_Wishlist $wishlist)
 {
     if (!in_array('wishlist', $this->_filteredObjects)) {
         $index = 1;
         foreach ($wishlist->getItemCollection() as $item) {
             if (!$item->getParentItem()) {
                 $this->_filterWishlistItem($item, $index);
                 $index++;
             }
         }
         // Add Related Content
         $this->_items = $wishlist->getItemCollection();
         $queryParams = $this->getQueryParams();
         $queryParams['wishlist_id'] = urlencode(base64_encode(Mage::helper('core')->encrypt($wishlist->getId())));
         if ($store = $this->getStore()) {
             $this->setField('wishlistURL', $store->getUrl('reminder/load/index', $queryParams));
         } else {
             $this->setField('wishlistURL', Mage::getUrl('reminder/load/index', $queryParams));
         }
         // Setup wishlist items as a template
         if (class_exists('Bronto_Reminder_Block_Wishlist_Items', false)) {
             $layout = Mage::getSingleton('core/layout');
             /* @var $items Mage_Sales_Block_Items_Abstract */
             $items = $layout->createBlock('bronto/bronto_reminder_wishlist_items', 'items');
             $items->setTemplate('bronto/reminder/items.phtml');
             $items->setWishlist($item->getWishlist());
             $this->_respectDesignTheme();
             $this->setField("wishlistItems", $items->toHtml());
         }
         $this->_filteredObjects[] = 'wishlist';
     }
     return $this;
 }