Class SearchController

Description

SearchController is responsible to control all the search actions. However, it is not responsible for filtering actions.

SearchController is used to perform the following actions:

<li>Keyword search actions</li> <li>Display category actions</li> <li>Paging actions</li>

SearchController also manages the dynamic trail of user search.

Located in /controllers/SearchController.php (line 27)

Zend_Controller_Action
   |
   --BaseController
      |
      --SearchController
Method Summary
it categorySearchAction (keywords, 0, trail, 1)
void indexAction ()
it keywordsearchAction (keywords, 0, trail, 1)
it pageAction (page, 0, trail, 1)
it pagesizeAction (page, 0, trail, 1)
Variables
Methods
categorySearchAction (line 405)

Display categories are kind of saved searches which has different criterias, such as category, manufacturer, attribute and keywords.

Display categories create main navigation search bar for any ecommerce application. These are mainly based on categories.

categorysearchAction is used to perform display category searches. It uses DCConfigManagerModel to get the display categories information by using the display category id. Display category id is defined in the urls of display category bar links. This action takes that id and passes that to DCConfigManagerModel to get the child categories for that particular display category.

Once it has all the child categories for the display category then it sets them in $parameters and pass those $parameters to $wsRequest to form a web service request. Which is then send to $gateway to perform the web service request.

WSResponse object is created for the response of http://ws.spexlive.net. WSResponse object contains the XML data returned from hosted web services. This XML data is converted into a php object and then forwarded to view. Successfull response is forwarded to view that generate different filters and search results table with pagination.

For any reason web service call is failed (even after retries) than request is forwarded to the ErrorController.

Following objects are set for the view:

<li>categoryFilter, It is used to create categories filter.</li> <li>manufacturerFilter, It is used to create manufacturers filter.</li> <li>attributeFilter, It is used to create attributes filter.</li> <li>trail, It is used to display search trail.</li> <li>productSummary, It is used to display product summarized information.</li> <li>page, It is used to display page no.</li> <li>count, It is used to display result count.</li>

it categorySearchAction (keywords, 0, trail, 1)
  • keywords, 0: this is a request parameter and is used to get keyword query string
  • trail, 1: this is a request parameter and is set to store the search trail string
indexAction (line 33)

The default action - show the home page

  • access: public
void indexAction ()
keywordsearchAction (line 80)

keywordsearchAction is used to perform keyword searches.

It initialize a new SearchTrail for every keyword search and gets keywords from GET parameters by using 'keywords' as the parameter name. Newly initiated SearchTrail is then set in the REQUEST as a string with parameter name 'trail'. 'trail' parameter is then used in the view to generate the display search trail.

This action uses web service model classes to perform the web services requests. WSFactory is used to create different keyword search requests. WSRequest is used to encapsulate the search keywords. WSRequest instance is than passed to WSGateway which passed send request to spexlive client and finally request is send to http://ws.spexlive.net.

WSResponse object is created for the response of http://ws.spexlive.net. WSResponse object contains the XML data returned from hosted web services. This XML data is converted into a php object and then forwarded to view. Successfull response is forwarded to view that generate different filters and search results table with pagination.

For any reason web service call is failed (even after retries) than request is forwarded to the ErrorController.

Following objects are set for the view:

<li>categoryFilter, It is used to create categories filter.</li> <li>manufacturerFilter, It is used to create manufacturers filter.</li> <li>attributeFilter, It is used to create attributes filter.</li> <li>trail, It is used to display search trail.</li> <li>productSummary, It is used to display product summarized information.</li> <li>page, It is used to display page no.</li> <li>count, It is used to display result count.</li>

it keywordsearchAction (keywords, 0, trail, 1)
  • keywords, 0: this is a request parameter and is used to get keyword query string
  • trail, 1: this is a request parameter and is set to store the search trail string
lazyfiltersAction (line 562)

lazyfiltersAction is used to fetch list of filters for a given search frm the target service.

It initialize a new SearchTrail for every filter request and get filter type from GET parameters by using 'type' as the parameter name. Newly initiated SearchTrail is then set in the REQUEST as a string with parameter name 'trail'. 'trail' parameter is then used in the view to generate the display search trail.

This action uses web service model classes to perform the web services requests. WSFactory is used to create different keyword search requests. WSRequest is used to encapsulate the search keywords. WSRequest instance is than passed to WSGateway which passed send request to spexlive client and finally request is send to http://ws.spexlive.net.

WSResponse object is created for the response of http://ws.spexlive.net. WSResponse object contains the XML data returned from hosted web services. This XML data is converted into a php object and then forwarded to view. Successfull response is forwarded to view that generate different filters and search results table with pagination.

For any reason web service call is failed (even after retries) than request is forwarded to the ErrorController.

Following lists output by the lazyFilter:

<li>CategoryFitler List, It is used to create categories list.</li> <li>ManufacturerFilter, It is used to create manufacturers list.</li> <li>AttributeFilter, It is used to create attributes list.</li>

This is lazy action so it require ajax to call target service and prepare and format the filter list from response xml data.

It will not send data to the view instead its output the data directly from the controller.

void lazyfiltersAction ()
pageAction (line 182)

Pagination is used to organize search results in pages and every page contains set of results to maximize searching speed.

It also created the SearchTrail from last search that is category and keyword search and apply pagination on it. for every pagination it gets page no and trail string from GET parameters by using 'page' and 'trail' as the parameters name.

Newly initiated SearchTrail is then set in the REQUEST as a string with parameter name 'trail'. 'trail' parameter is then used in the view to generate page wise search results.

it pageAction (page, 0, trail, 1)
  • page, 0: this is a request parameter and is used to get page no query string
  • trail, 1: this is a request parameter and is set to store the search trail string
pagesizeAction (line 284)

PageSize is used to select the no of results that will be shown on each result page.

It also created the SearchTrail from last search that is category and keyword search and apply page size on it. for every Page Size it gets trail string from GET parameters by using 'trail' as the parameters name.

Newly initiated SearchTrail is then set in the REQUEST as a string with parameter name 'trail'. 'trail' parameter is then used in the view to generate page wise search results.

it pagesizeAction (page, 0, trail, 1)
  • page, 0: this is a request parameter and is used to get page no query string
  • trail, 1: this is a request parameter and is set to store the search trail string

Inherited Methods

Inherited From BaseController

BaseController::getAllCategories()
BaseController::getAllManufactures()
BaseController::getChildCategories()
BaseController::populateSearchResults()
BaseController::postDispatch()
BaseController::preDispatch()
BaseController::renderDynamicTemplates()
BaseController::serviceRequest()
BaseController::setCompareProductPage()
BaseController::setFooter()
BaseController::setHeader()
BaseController::setHomePage()
BaseController::setSearchResultsPage()
BaseController::setWSRequestFailed()

Documentation generated on Wed, 13 Feb 2008 01:57:40 +0500 by phpDocumentor 1.4.0a2