/**
  * Add option of logging search queries.
  *
  * @return Mage_CatalogSearch_Model_Query|void
  */
 public function getQuery()
 {
     $query = parent::getQuery();
     $logSearches = Mage::getStoreConfig(self::XML_PATH_LOG_SEARCHES);
     if ($logSearches && !$this->_logged) {
         $numResults = $query->getNumResults();
         if (!empty($numResults) || $numResults === 0 || $numResults === "0") {
             $queryData = 'Query: "' . $query->getQueryText() . '" ';
             $queryData .= "\n" . self::PADDING . '# Results: ' . $numResults . ' ';
             $queryData .= "\n" . self::PADDING . '[Last updated: ' . $query->getUpdatedAt() . ']';
             $file = Mage::getStoreConfig(self::XML_PATH_SEARCH_LOG_FILENAME);
             Mage::log($queryData, null, $file);
             $this->_logged = true;
         }
     }
     return $query;
 }
 /**
  * @return Mage_CatalogSearch_Model_Query
  */
 protected function getQuery()
 {
     $query = $this->helper->getQuery();
     $query->setStoreId($this->store->getId());
     return $query;
 }
Exemplo n.º 3
0
 public function getQuery()
 {
     $queryHelper = new Mage_CatalogSearch_Helper_Data();
     return $queryHelper->getQuery();
 }