Mage_CatalogSearch_Block_Result Class Reference

Inheritance diagram for Mage_CatalogSearch_Block_Result:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getListBlock ()
 setListOrders ()
 setListModes ()
 setListCollection ()
 getProductListHtml ()
 getResultCount ()
 getNoResultText ()
 getNoteMessages ()

Protected Member Functions

 _getQuery ()
 _prepareLayout ()
 _getProductCollection ()

Protected Attributes

 $_productCollection


Detailed Description

Definition at line 35 of file Result.php.


Member Function Documentation

_getProductCollection (  )  [protected]

Retrieve loaded category collection

Returns:
Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection

Definition at line 152 of file Result.php.

00153     {
00154         if (is_null($this->_productCollection)) {
00155             $this->_productCollection = Mage::getSingleton('catalogsearch/layer')->getProductCollection();
00156         }
00157 
00158         return $this->_productCollection;
00159     }

_getQuery (  )  [protected]

Retrieve query model object

Returns:
Mage_CatalogSearch_Model_Query

Definition at line 49 of file Result.php.

00050     {
00051         return $this->helper('catalogSearch')->getQuery();
00052     }

_prepareLayout (  )  [protected]

Prepare layout

Returns:
Mage_CatalogSearch_Block_Result

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 59 of file Result.php.

00060     {
00061         $title = $this->__("Search results for: '%s'", $this->helper('catalogSearch')->getEscapedQueryText());
00062 
00063         // add Home breadcrumb
00064         if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
00065             $breadcrumbs->addCrumb('home', array(
00066                 'label' => $this->__('Home'),
00067                 'title' => $this->__('Go to Home Page'),
00068                 'link'  => Mage::getBaseUrl()
00069             ))->addCrumb('search', array(
00070                 'label' => $title,
00071                 'title' => $title
00072             ));
00073         }
00074         $this->getLayout()->getBlock('head')->setTitle($title);
00075 
00076         return parent::_prepareLayout();
00077     }

getListBlock (  ) 

Retrieve search list toolbar block

Returns:
Mage_Catalog_Block_Product_List

Definition at line 84 of file Result.php.

00085     {
00086         return $this->getChild('search_result_list');
00087     }

getNoResultText (  ) 

Retrieve No Result or Minimum query length Text

Returns:
string

Definition at line 181 of file Result.php.

00182     {
00183         if (Mage::helper('catalogSearch')->isMinQueryLength()) {
00184             return Mage::helper('catalogSearch')->__('Minimum Search query length is %s', $this->_getQuery()->getMinQueryLenght());
00185         }
00186         return $this->_getData('no_result_text');
00187     }

getNoteMessages (  ) 

Retrieve Note messages

Returns:
array

Definition at line 194 of file Result.php.

00195     {
00196         return Mage::helper('catalogSearch')->getNoteMessages();
00197     }

getProductListHtml (  ) 

Retrieve Search result list HTML output

Returns:
string

Definition at line 142 of file Result.php.

00143     {
00144         return $this->getChildHtml('search_result_list');
00145     }

getResultCount (  ) 

Retrieve search result count

Returns:
string

Definition at line 166 of file Result.php.

00167     {
00168         if (!$this->getData('result_count')) {
00169             $size = $this->_getProductCollection()->getSize();
00170             $this->_getQuery()->setNumResults($size);
00171             $this->setResultCount($size);
00172         }
00173         return $this->getData('result_count');
00174     }

setListCollection (  ) 

Set Search Result collection

Returns:
Mage_CatalogSearch_Block_Result

Definition at line 131 of file Result.php.

00131                                         {
00132         $this->getListBlock()
00133            ->setCollection($this->_getProductCollection());
00134        return $this;
00135     }

setListModes (  ) 

Set available view mode

Returns:
Mage_CatalogSearch_Block_Result

Definition at line 117 of file Result.php.

00117                                    {
00118         $this->getListBlock()
00119             ->setModes(array(
00120                 'grid' => $this->__('Grid'),
00121                 'list' => $this->__('List'))
00122             );
00123         return $this;
00124     }

setListOrders (  ) 

Set search available list orders

Returns:
Mage_CatalogSearch_Block_Result

Definition at line 94 of file Result.php.

00094                                     {
00095         $category = Mage::getSingleton('catalog/layer')
00096             ->getCurrentCategory();
00097         /* @var $category Mage_Catalog_Model_Category */
00098         $availableOrders = $category->getAvailableSortByOptions();
00099         unset($availableOrders['position']);
00100         $availableOrders = array_merge(array(
00101             'relevance' => $this->__('Relevance')
00102         ), $availableOrders);
00103 
00104         $this->getListBlock()
00105             ->setAvailableOrders($availableOrders)
00106             ->setDefaultDirection('desc')
00107             ->setSortBy('relevance');
00108 
00109         return $this;
00110     }


Member Data Documentation

$_productCollection [protected]

Definition at line 42 of file Result.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:49 2009 for Magento by  doxygen 1.5.8