Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_CatalogSearch_AdvancedController
  • Mage_CatalogSearch_AjaxController
  • Mage_CatalogSearch_Block_Advanced_Form
  • Mage_CatalogSearch_Block_Advanced_Result
  • Mage_CatalogSearch_Block_Autocomplete
  • Mage_CatalogSearch_Block_Layer
  • Mage_CatalogSearch_Block_Layer_Filter_Attribute
  • Mage_CatalogSearch_Block_Result
  • Mage_CatalogSearch_Block_Term
  • Mage_CatalogSearch_Helper_Data
  • Mage_CatalogSearch_Model_Advanced
  • Mage_CatalogSearch_Model_Fulltext
  • Mage_CatalogSearch_Model_Fulltext_Observer
  • Mage_CatalogSearch_Model_Indexer_Fulltext
  • Mage_CatalogSearch_Model_Layer
  • Mage_CatalogSearch_Model_Layer_Filter_Attribute
  • Mage_CatalogSearch_Model_Mysql4_Advanced
  • Mage_CatalogSearch_Model_Mysql4_Advanced_Collection
  • Mage_CatalogSearch_Model_Mysql4_Fulltext
  • Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
  • Mage_CatalogSearch_Model_Mysql4_Fulltext_Engine
  • Mage_CatalogSearch_Model_Mysql4_Indexer_Fulltext
  • Mage_CatalogSearch_Model_Mysql4_Query
  • Mage_CatalogSearch_Model_Mysql4_Query_Collection
  • Mage_CatalogSearch_Model_Mysql4_Search_Collection
  • Mage_CatalogSearch_Model_Query
  • Mage_CatalogSearch_Model_Resource_Advanced
  • Mage_CatalogSearch_Model_Resource_Advanced_Collection
  • Mage_CatalogSearch_Model_Resource_Fulltext
  • Mage_CatalogSearch_Model_Resource_Fulltext_Collection
  • Mage_CatalogSearch_Model_Resource_Fulltext_Engine
  • Mage_CatalogSearch_Model_Resource_Indexer_Fulltext
  • Mage_CatalogSearch_Model_Resource_Query
  • Mage_CatalogSearch_Model_Resource_Query_Collection
  • Mage_CatalogSearch_Model_Resource_Search_Collection
  • Mage_CatalogSearch_Model_Session
  • Mage_Catalogsearch_Model_System_Config_Backend_Sitemap
  • Mage_CatalogSearch_ResultController
  • Mage_CatalogSearch_TermController
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_CatalogSearch
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Product search result block
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_CatalogSearch
 33:  * @module     Catalog
 34:  */
 35: class Mage_CatalogSearch_Block_Result extends Mage_Core_Block_Template
 36: {
 37:     /**
 38:      * Catalog Product collection
 39:      *
 40:      * @var Mage_CatalogSearch_Model_Resource_Fulltext_Collection
 41:      */
 42:     protected $_productCollection;
 43: 
 44:     /**
 45:      * Retrieve query model object
 46:      *
 47:      * @return Mage_CatalogSearch_Model_Query
 48:      */
 49:     protected function _getQuery()
 50:     {
 51:         return $this->helper('catalogsearch')->getQuery();
 52:     }
 53: 
 54:     /**
 55:      * Prepare layout
 56:      *
 57:      * @return Mage_CatalogSearch_Block_Result
 58:      */
 59:     protected function _prepareLayout()
 60:     {
 61:         // add Home breadcrumb
 62:         $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
 63:         if ($breadcrumbs) {
 64:             $title = $this->__("Search results for: '%s'", $this->helper('catalogsearch')->getQueryText());
 65: 
 66:             $breadcrumbs->addCrumb('home', array(
 67:                 'label' => $this->__('Home'),
 68:                 'title' => $this->__('Go to Home Page'),
 69:                 'link'  => Mage::getBaseUrl()
 70:             ))->addCrumb('search', array(
 71:                 'label' => $title,
 72:                 'title' => $title
 73:             ));
 74:         }
 75: 
 76:         // modify page title
 77:         $title = $this->__("Search results for: '%s'", $this->helper('catalogsearch')->getEscapedQueryText());
 78:         $this->getLayout()->getBlock('head')->setTitle($title);
 79: 
 80:         return parent::_prepareLayout();
 81:     }
 82: 
 83:     /**
 84:      * Retrieve additional blocks html
 85:      *
 86:      * @return string
 87:      */
 88:     public function getAdditionalHtml()
 89:     {
 90:         return $this->getLayout()->getBlock('search_result_list')->getChildHtml('additional');
 91:     }
 92: 
 93:     /**
 94:      * Retrieve search list toolbar block
 95:      *
 96:      * @return Mage_Catalog_Block_Product_List
 97:      */
 98:     public function getListBlock()
 99:     {
100:         return $this->getChild('search_result_list');
101:     }
102: 
103:     /**
104:      * Set search available list orders
105:      *
106:      * @return Mage_CatalogSearch_Block_Result
107:      */
108:     public function setListOrders()
109:     {
110:         $category = Mage::getSingleton('catalog/layer')
111:             ->getCurrentCategory();
112:         /* @var $category Mage_Catalog_Model_Category */
113:         $availableOrders = $category->getAvailableSortByOptions();
114:         unset($availableOrders['position']);
115:         $availableOrders = array_merge(array(
116:             'relevance' => $this->__('Relevance')
117:         ), $availableOrders);
118: 
119:         $this->getListBlock()
120:             ->setAvailableOrders($availableOrders)
121:             ->setDefaultDirection('desc')
122:             ->setSortBy('relevance');
123: 
124:         return $this;
125:     }
126: 
127:     /**
128:      * Set available view mode
129:      *
130:      * @return Mage_CatalogSearch_Block_Result
131:      */
132:     public function setListModes()
133:     {
134:         $this->getListBlock()
135:             ->setModes(array(
136:                 'grid' => $this->__('Grid'),
137:                 'list' => $this->__('List'))
138:             );
139:         return $this;
140:     }
141: 
142:     /**
143:      * Set Search Result collection
144:      *
145:      * @return Mage_CatalogSearch_Block_Result
146:      */
147:     public function setListCollection()
148:     {
149: //        $this->getListBlock()
150: //           ->setCollection($this->_getProductCollection());
151:        return $this;
152:     }
153: 
154:     /**
155:      * Retrieve Search result list HTML output
156:      *
157:      * @return string
158:      */
159:     public function getProductListHtml()
160:     {
161:         return $this->getChildHtml('search_result_list');
162:     }
163: 
164:     /**
165:      * Retrieve loaded category collection
166:      *
167:      * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
168:      */
169:     protected function _getProductCollection()
170:     {
171:         if (is_null($this->_productCollection)) {
172:             $this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
173:         }
174: 
175:         return $this->_productCollection;
176:     }
177: 
178:     /**
179:      * Retrieve search result count
180:      *
181:      * @return string
182:      */
183:     public function getResultCount()
184:     {
185:         if (!$this->getData('result_count')) {
186:             $size = $this->_getProductCollection()->getSize();
187:             $this->_getQuery()->setNumResults($size);
188:             $this->setResultCount($size);
189:         }
190:         return $this->getData('result_count');
191:     }
192: 
193:     /**
194:      * Retrieve No Result or Minimum query length Text
195:      *
196:      * @return string
197:      */
198:     public function getNoResultText()
199:     {
200:         if (Mage::helper('catalogsearch')->isMinQueryLength()) {
201:             return Mage::helper('catalogsearch')->__('Minimum Search query length is %s', $this->_getQuery()->getMinQueryLength());
202:         }
203:         return $this->_getData('no_result_text');
204:     }
205: 
206:     /**
207:      * Retrieve Note messages
208:      *
209:      * @return array
210:      */
211:     public function getNoteMessages()
212:     {
213:         return Mage::helper('catalogsearch')->getNoteMessages();
214:     }
215: }
216: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0