Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added useful configurations for the search reports

  • Loading branch information...
commit 0cc39f791d195b7e971a3c864af598123b3c8b9e 1 parent 470b5fc
@rasseljandavid rasseljandavid authored
View
10 framework/modules/administration/views/administration/configure_site.tpl
@@ -41,6 +41,7 @@
<li><a href="#tab11"><em>{"Error Messages"|gettext}</em></a></li>
<li><a href="#tab12"><em>{"PDF Generation"|gettext}</em></a></li>
<li><a href="#tab13"><em>{"Minify"|gettext}</em></a></li>
+ <li><a href="#tab14"><em>{"Search Report"|gettext}</em></a></li>
{/if}
</ul>
<div class="yui-content">
@@ -222,8 +223,15 @@
{control type="text" name="sc[MINIFY_MAX_FILES]" label='Maximum # of files that can be specified in the \'f\' GET parameter'|gettext value=$smarty.const.MINIFY_MAX_FILES}
{control type="text" name="sc[MINIFY_URL_LENGTH]" label="The length of minification url"|gettext value=$smarty.const.MINIFY_URL_LENGTH}
{control type="checkbox" postfalse=1 name="sc[MINIFY_ERROR_LOGGER]" label="Enable logging of minify error messages to FirePHP?"|gettext checked=$smarty.const.MINIFY_ERROR_LOGGER value=1}
-
</div>
+
+ <div id="tab14">
+ <h2>{"Search Report Configuration"|gettext}</h2>
+
+ {control type="text" name="sc[TOP_SEARCH]" label="Number of Top Search Queries"|gettext value=$smarty.const.TOP_SEARCH}
+ {control type="checkbox" postfalse=1 name="sc[INCLUDE_AJAX_SEARCH]" label="Include ajax search in reports?"|gettext checked=$smarty.const.INCLUDE_AJAX_SEARCH value=1}
+ {control type="checkbox" postfalse=1 name="sc[INCLUDE_ANONYMOUS_SEARCH]" label="Include unregistered users search?"|gettext checked=$smarty.const.INCLUDE_ANONYMOUS_SEARCH value=1}
+ </div>
{/if}
</div>
</div>
View
10 framework/modules/ecommerce/controllers/storeController.php
@@ -1158,10 +1158,12 @@ function search_by_model() {
public function search() {
global $db, $user;
- $qry = trim($this->params['query']);
- if(!empty($qry)) {
- $search = new search();
- $r = $search->getSearchResults($this->params['query']);
+ if(INCLUDE_AJAX_SEARCH == 1) {
+ $qry = trim($this->params['query']);
+ if(!empty($qry)) {
+ $search = new search();
+ $r = $search->getSearchResults($this->params['query']);
+ }
}
//$this->params['query'] = str_ireplace('-','\-',$this->params['query']);
$terms = explode(" ",$this->params['query']);
View
10 framework/modules/search/controllers/searchController.php
@@ -200,11 +200,17 @@ public function searchQueryReport() {
public function topSearchReport() {
global $db;
+ $limit = TOP_SEARCH;
+
+ if(empty($limit)) {
+ $limit = 10;
+ }
+
$count = $db->countObjects('search_queries');
- $records = $db->selectObjectsBySql("SELECT COUNT(query) cnt, query FROM " .DB_TABLE_PREFIX . "_search_queries GROUP BY query ORDER BY cnt DESC LIMIT 0, 10");
+ $records = $db->selectObjectsBySql("SELECT COUNT(query) cnt, query FROM " .DB_TABLE_PREFIX . "_search_queries GROUP BY query ORDER BY cnt DESC LIMIT 0, {$limit}");
- assign_to_template(array('records'=>$records, 'total'=>$count));
+ assign_to_template(array('records'=>$records, 'total'=>$count, 'limit' => $limit));
}
View
15 framework/modules/search/models/search.php
@@ -36,12 +36,15 @@ public function getSearchResults($terms) {
if (SAVE_SEARCH_QUERIES)
{
- $queryObj = new stdClass();
- $queryObj->user_id = $user->id;
- $queryObj->query = $terms;
- $queryObj->timestamp = time();
-
- $db->insertObject($queryObj, 'search_queries');
+
+ if(INCLUDE_ANONYMOUS_SEARCH == 1 || $user->id <> 0) {
+ $queryObj = new stdClass();
+ $queryObj->user_id = $user->id;
+ $queryObj->query = $terms;
+ $queryObj->timestamp = time();
+
+ $db->insertObject($queryObj, 'search_queries');
+ }
}
//setup the sql query
View
4 framework/modules/search/views/search/topSearchReport.tpl
@@ -21,7 +21,7 @@
<div class="module topsearchquery report">
<div class="info-header">
- <h1>{$moduletitle|default:"Top 10 Search Queries Report"|gettext}</h1>
+ <h1>{$moduletitle|default:"Top `$limit` Search Queries Report"|gettext}</h1>
</div>
<table class="exp-skin-table">
@@ -37,7 +37,7 @@
<tr class="{cycle values='odd,even'}">
<td>{counter}</td>
<td>{$query->query}</td>
- <td>{(($query->cnt / $total)*100)|number_format:2}</td>
+ <td>{(($query->cnt / $total)*100)|number_format:2} %</td>
</tr>
{foreachelse}
<td colspan="3">No Search Query Data</td>
Please sign in to comment.
Something went wrong with that request. Please try again.