示例#1
0
 protected function _prepareCollection()
 {
     if (!Mage::helper('multiplewishlist')->isEnabled()) {
         return parent::_prepareCollection();
     }
     if (method_exists($this, '_createCollection')) {
         $collection = $this->_createCollection()->addCustomerIdFilter($this->_getCustomer()->getId())->resetSortOrder()->addDaysInWishlist()->addStoreData();
     } else {
         $wishlist = Mage::getModel('wishlist/wishlist');
         $collection = $wishlist->loadByCustomer($this->_getCustomer())->getItemCollection()->resetSortOrder()->addDaysInWishlist()->addStoreData();
         /*@var $collection Mage_Core_Model_Mysql4_Collection_Abstract */
         $collection->getSelect()->reset('where');
         $collection->getSelect()->where('main_table.wishlist_id', $wishlist->getId());
     }
     Mage::getModel('multiplewishlist/tab')->addWishlistTabToSelect($collection);
     $this->setCollection($collection);
     Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
     return $this;
 }