Skip to content

Commit e262431

Browse files
authored
Merge pull request #1 from shopbetreuung/master
feat: update codestyle, change filenames, add moduleinfo.json, add doc
2 parents d2ac18b + 0d283f4 commit e262431

File tree

20 files changed

+483
-443
lines changed

20 files changed

+483
-443
lines changed

docs/install.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### EINE SICHERUNG DER DATENBANK ERSTELLEN
2+
###### Die Tabellen `configuration` und `admin_access` werden geändert.
3+
###### Es wird eine neue Tabelle `t10_searchstats` erstellt.
4+
5+
---
6+
7+
# Installation
8+
1. Loggen Sie sich in den Admin-Bereich ein
9+
2. Öffnen Sie die *Menüoption Module > Systemmodule*.
10+
3. Wählen Sie das **T10 Suchbegriffstatistik** Modul und klicken Sie auf Installieren..
11+
12+
---

docs/usage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* Die t10:Suchbegriffstatistik zeigt Ihnen die Suchbegriffe, die Ihre Besucher und Kunden über die shopinterne Suchfunktion eingeben und wie viele Produkte für die verwendeten Begriffe gefunden werden.
2+
* Natürlich sehen Sie so auch, welche Suchbegriffe besonders häufig eingegeben werden.
3+
* Die Begriffe lassen sich nun komfortabel und direkt aus der Statistik heraus zu Ihren bestehenden Produkten zuordnen, sodass diese beim nächsten mal ebenfalls über die shopinterne Suche gefunden werden.
4+
* So reagieren Sie schnell und flexibel auf das Suchverhalten Ihrer Kunden und verbessern die Suchergebnisse Ihres Shops (und somit auch Ihre Umsätze).

images/mcm_searchstats.png

59.2 KB
Loading

moduleinfo.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "T10 Suchstatistik ",
3+
"archiveName": "modifiedcommunitymodules/t-zehn-search-statistic",
4+
"sourceDir": "new_files",
5+
"version": "auto",
6+
"shortDescription": "Die t10:Suchbegriffstatistik zeigt Ihnen die Suchbegriffe, die Ihre Besucher und Kunden über die shopinterne Suchfunktion eingeben",
7+
"description": "Die t10:Suchbegriffstatistik zeigt Ihnen die Suchbegriffe, die Ihre Besucher und Kunden über die shopinterne Suchfunktion eingeben und wie viele Produkte für die verwendeten Begriffe gefunden werden. Natürlich sehen Sie so auch, welche Suchbegriffe besonders häufig eingegeben werden. Die Begriffe lassen sich nun komfortabel und direkt aus der Statistik heraus zu Ihren bestehenden Produkten zuordnen, sodass diese beim nächsten mal ebenfalls über die shopinterne Suche gefunden werden. So reagieren Sie schnell und flexibel auf das Suchverhalten Ihrer Kunden und verbessern die Suchergebnisse Ihres Shops (und somit auch Ihre Umsätze).",
8+
"price": "free",
9+
"require": {
10+
"composer/autoload": "^1.1.0",
11+
"robinthehood/modified-std-module": "^0.1.0"
12+
},
13+
"modifiedCompatibility": [
14+
"2.0.5.0","2.0.5.1","2.0.6.0"
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"ModifiedCommunityModules\\": "/vendor-no-composer/modifiedcommunitymodules"
19+
}
20+
}
21+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
$user_exclusions[] = 'mcm_searchstats.php';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
define('FILENAME_MODULE_T10_SEARCHSTATS', 't10_searchstats.php');
2+
define('FILENAME_MODULE_T10_SEARCHSTATS', 'mcm_searchstats.php');

new_files/admin/includes/extra/menu/mcm_searchstats.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
<?php
22
defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
33

4+
if (!defined('MODULE_MCM_SEARCHSTATS_STATUS') && (MODULE_MCM_SEARCHSTATS_STATUS != 'true')) {
5+
return;
6+
}
7+
48
//Sprachabhaengiger Menueeintrag, kann fuer weiter Sprachen ergaenzt werden
59
switch ($_SESSION['language_code']) {
610
case 'de':
711
define('BOX_T10_SEARCHSTATS', 'Suchbegriffstatistik');
812
break;
913
case 'en':
1014
define('BOX_T10_SEARCHSTATS', 'Search statistics');
11-
break;
15+
break;
1216
default:
1317
define('BOX_T10_SEARCHSTATS', 'Search statistics');
1418
break;
1519
}
1620

1721
//BOX_HEADING_TOOLS = Name der box in der der neue Menueeintrag erscheinen soll
1822
$add_contents[BOX_HEADING_STATISTICS][] = [
19-
'admin_access_name' => 't10_searchstats', // Eintrag fuer Adminrechte
20-
'filename' => 't10_searchstats.php', // Dateiname der neuen Admindatei
23+
'admin_access_name' => 'mcm_searchstats', // Eintrag fuer Adminrechte
24+
'filename' => 'mcm_searchstats.php', // Dateiname der neuen Admindatei
2125
'boxname' => BOX_T10_SEARCHSTATS, // Anzeigename im Menue
2226
'parameter' => '', // zusaetzliche Parameter z.B. 'set=export'
2327
'ssl' => '' // SSL oder NONSSL, kein Eintrag = NONSSL

new_files/admin/includes/modules/system/t10_searchstats.php renamed to new_files/admin/includes/modules/system/mcm_searchstats.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@
1212

1313
defined('_VALID_XTC' ) or die('Direct Access to this location is not allowed.');
1414

15-
class t10_searchstats
15+
class mcm_searchstats
1616
{
1717
public $code;
1818
public $title;
1919
public $description;
2020
public $enabled;
2121

22-
public function __construct()
22+
public function __construct()
2323
{
24-
$this->code = 't10_searchstats';
25-
$this->title = MODULE_T10_SEARCHSTATS_TEXT_TITLE;
26-
$this->description = MODULE_T10_SEARCHSTATS_TEXT_DESCRIPTION;
27-
$this->sort_order = ((defined('MODULE_T10_SEARCHSTATS_SORT_ORDER')) ? MODULE_T10_SEARCHSTATS_SORT_ORDER : '');
28-
$this->enabled = ((defined('MODULE_T10_SEARCHSTATS_STATUS') && MODULE_T10_SEARCHSTATS_STATUS == 'true') ? true : false);
24+
$this->code = 'mcm_searchstats';
25+
$this->title = MODULE_MCM_SEARCHSTATS_TEXT_TITLE;
26+
$this->description = MODULE_MCM_SEARCHSTATS_TEXT_DESCRIPTION;
27+
$this->sort_order = ((defined('MODULE_MCM_SEARCHSTATS_SORT_ORDER')) ? MODULE_MCM_SEARCHSTATS_SORT_ORDER : '');
28+
$this->enabled = ((defined('MODULE_MCM_SEARCHSTATS_STATUS') && MODULE_MCM_SEARCHSTATS_STATUS == 'true') ? true : false);
2929
}
3030

31-
public function process($file)
31+
public function process($file)
3232
{
3333
//do nothing
3434
}
3535

36-
public function display()
36+
public function display()
3737
{
38-
return ['text' =>
38+
return ['text' =>
3939
'<br>' . xtc_button(BUTTON_SAVE) . '&nbsp;' . xtc_button_link(BUTTON_CANCEL, xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=' . $this->code))
4040
];
4141
}
4242

43-
public function check()
43+
public function check()
4444
{
4545
if (!isset($this->_check)) {
46-
$check_query = xtc_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_T10_SEARCHSTATS_STATUS'");
46+
$check_query = xtc_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_MCM_SEARCHSTATS_STATUS'");
4747
$this->_check = xtc_db_num_rows($check_query);
4848
}
4949
return $this->_check;
5050
}
5151

52-
public function install()
52+
public function install()
5353
{
54-
xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_T10_SEARCHSTATS_STATUS', 'true', '6', '1', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");
55-
xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_T10_SEARCHSTATS_ADMIN_COUNT', 'true', '6', '1', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");
54+
xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_MCM_SEARCHSTATS_STATUS', 'true', '6', '1', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");
55+
xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_MCM_SEARCHSTATS_ADMIN_COUNT', 'true', '6', '1', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");
5656

5757
xtc_db_query("CREATE TABLE IF NOT EXISTS " . TABLE_T10_SEARCHSTATS." (
5858
id int(11) NOT NULL AUTO_INCREMENT,
@@ -64,22 +64,22 @@ public function install()
6464
PRIMARY KEY (id),
6565
UNIQUE KEY `query` (`query`)
6666
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
67-
xtc_db_query("ALTER TABLE " . TABLE_ADMIN_ACCESS . " ADD `t10_searchstats` INT( 1 ) NOT NULL DEFAULT '0'");
68-
xtc_db_query("UPDATE " . TABLE_ADMIN_ACCESS . " SET `t10_searchstats` = 1 WHERE customers_id = 1 LIMIT 1;");
67+
xtc_db_query("ALTER TABLE " . TABLE_ADMIN_ACCESS . " ADD `mcm_searchstats` INT( 1 ) NOT NULL DEFAULT '0'");
68+
xtc_db_query("UPDATE " . TABLE_ADMIN_ACCESS . " SET `mcm_searchstats` = 1 WHERE customers_id = 1 LIMIT 1;");
6969
}
7070

7171
public function remove()
7272
{
73-
xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key LIKE 'MODULE_T10_SEARCHSTATS_%'");
73+
xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key LIKE 'MODULE_MCM_SEARCHSTATS_%'");
7474
xtc_db_query("DROP TABLE " . TABLE_T10_SEARCHSTATS);
75-
xtc_db_query("ALTER TABLE " . TABLE_ADMIN_ACCESS ." DROP COLUMN `t10_searchstats`");
75+
xtc_db_query("ALTER TABLE " . TABLE_ADMIN_ACCESS ." DROP COLUMN `mcm_searchstats`");
7676
}
7777

78-
public function keys()
78+
public function keys()
7979
{
8080
return [
81-
'MODULE_T10_SEARCHSTATS_STATUS',
82-
'MODULE_T10_SEARCHSTATS_ADMIN_COUNT'
81+
'MODULE_MCM_SEARCHSTATS_STATUS',
82+
'MODULE_MCM_SEARCHSTATS_ADMIN_COUNT'
8383
];
8484
}
8585
}

new_files/admin/mcm_searchstats.php

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
require 'includes/application_top.php';
4343
require_once DIR_WS_CLASSES . 'split_page_results.php';
44-
require_once DIR_WS_CLASSES . 't10.searchstats.php';
44+
use ModifiedCommunityModules\SearchStats\Classes\{SearchStatsKeywords, SearchStatsAdmin};
45+
require_once DIR_FS_DOCUMENT_ROOT . '/vendor-no-composer/autoload.php';
4546

4647
// product assignment via ajax
4748
if (isset($_POST['assignQuery'])) {
@@ -67,7 +68,7 @@
6768
}
6869

6970
foreach ($_POST['addProduct'] as $pID) {
70-
$k = new t10_productKeywords($pID, $_SESSION['languages_id']);
71+
$k = new SearchStatsKeywords($pID, $_SESSION['languages_id']);
7172
$return[$pID] = $k->saveKeywords($pID, strip_tags(trim($_POST['query'])));
7273
}
7374

@@ -83,9 +84,17 @@
8384
xtc_redirect(FILENAME_MODULE_T10_SEARCHSTATS);
8485
}
8586

87+
// delete one record
88+
if (isset($_POST['delete']) && (int)$_POST['delete'] == 1 && (int)$_POST['id'] > 0) {
89+
90+
$q = xtc_db_query(sprintf('DELETE FROM %s WHERE id=%u', TABLE_T10_SEARCHSTATS, (int) $_POST['id']));
91+
xtc_redirect(FILENAME_MODULE_T10_SEARCHSTATS);
92+
93+
}
94+
8695
// product search via ajax
8796
if (isset($_GET['productSearch'])) {
88-
$search = new t10_searchstats($_GET['query'], $_SESSION['languages_id']);
97+
$search = new SearchStatsAdmin($_GET['query'], $_SESSION['languages_id']);
8998

9099
header('Cache-Control: no-cache, must-revalidate');
91100
header('Expires: Tue, 10 Jul 1984 13:37:00 GMT');
@@ -96,10 +105,10 @@
96105

97106
// whitelist possible order fields
98107
$orderFields = [
99-
'query' => QUERY,
108+
'query' => QUERY,
100109
'searches' => SEARCHES,
101-
'crdate' => CRDATE,
102-
'tstamp' => TSTAMP,
110+
'crdate' => CRDATE,
111+
'tstamp' => TSTAMP,
103112
'products' => PRODUCTS
104113
];
105114

@@ -134,7 +143,7 @@
134143
require DIR_WS_INCLUDES . 'head.php';
135144
?>
136145

137-
<link rel="stylesheet" type="text/css" href="includes/css/t10.searchstats.css">
146+
<link rel="stylesheet" type="text/css" href="includes/css/mcm_searchstats.css">
138147
</head>
139148
<body>
140149
<!-- header //-->
@@ -155,8 +164,11 @@
155164
<table border="0" width="100%" cellspacing="0" cellpadding="2">
156165
<tr>
157166
<td>
158-
<?php if (xtc_db_num_rows($q) > 0) {?>
159-
<form action="<?php echo FILENAME_MODULE_T10_SEARCHSTATS; ?>" method="post">
167+
<?php
168+
if (xtc_db_num_rows($q) > 0) {
169+
170+
echo xtc_draw_form('truncateList', FILENAME_MODULE_T10_SEARCHSTATS);
171+
?>
160172
<a href="#" class="truncate button fr" data-msg="<?php echo TRUNCATE; ?>"><?php echo TRUNCATE_LABEL; ?></a>
161173
<input type="hidden" name="truncate" value="1">
162174
</form>
@@ -169,7 +181,9 @@
169181
<tr>
170182
<td valign="top">
171183
<div class="productSearch" style="display:none;">
172-
<form action="<?php echo sprintf('%s?%s', FILENAME_MODULE_T10_SEARCHSTATS, http_build_query(array('productSearch' => true))); ?>" method="get" class="productSearch">
184+
<?php
185+
echo xtc_draw_form('truncateList', FILENAME_MODULE_T10_SEARCHSTATS, http_build_query(array('productSearch' => true)), "get", ' class="productSearch"');
186+
?>
173187
<input type="search" name="q" placeholder="<?php echo SEARCH_FILED_PLACEHOLDER; ?>">
174188
<input type="hidden" name="query" value="">
175189
<input type="submit" class="go" value="<?php echo SEARCH_BUTTON_LABEL; ?>">
@@ -206,7 +220,7 @@
206220
$currtenFilter = $_SESSION['t10']['filter_stats'];
207221

208222
foreach ($orderFields as $orderField => $label) {
209-
// indicate the current direction
223+
// indicate the current direction
210224
$classes = [$currtenFilter['orderDirection']];
211225
// keep the currently selected direction
212226
$direction = $currtenFilter['orderDirection'];
@@ -238,19 +252,29 @@
238252
<?php
239253
$rows = [];
240254
while ($r = xtc_db_fetch_array($q)) {
255+
$delete = sprintf('%s
256+
<input type="hidden" name="id" value="%u">
257+
<input type="hidden" name="delete" value="1">
258+
<a href="#" data-msg="%s" class="button confirm">%s</a>
259+
</form>',
260+
xtc_draw_form('deleteEntry', FILENAME_MODULE_T10_SEARCHSTATS),
261+
$r['id'],
262+
sprintf(DELETE_QUERY_MESSAGE, $r['query']),
263+
DELETE_QUERY_LABEL);
241264
$url = sprintf('%sadvanced_search_result.php?%s', DIR_WS_CATALOG, http_build_query(array('keywords' => $r['query'], 'dnt' => true)));
242265
$link = sprintf('<a href="%s" class="viewNewTab nw" title="%s">%s</a>', $url, sprintf(QUERY_TITLE_TEXT, $r['query']), $r['query']);
243266

244267
$options = [
245-
defined("FILENAME_MODULE_T10_TAGS") ?
246-
sprintf('<a href="%s" class="button">%s</a>',
247-
sprintf('%s?%s', FILENAME_MODULE_T10_TAGS, http_build_query(array('tag_id' => $r['query'], 'action' => 'new_tag'))), CREATE_LP) :
268+
defined("FILENAME_MODULE_T10_TAGS") ?
269+
sprintf('<a href="%s" class="button">%s</a>',
270+
sprintf('%s?%s', FILENAME_MODULE_T10_TAGS, http_build_query(array('tag_id' => $r['query'], 'action' => 'new_tag'))), CREATE_LP) :
248271
sprintf('<!--a href="http://j.mp/1g5d8MN" class="button toggleLPMInfo">%s</a-->', CREATE_LP),
249-
sprintf('<a href="%s" data-query="%s" class="button toggleSearch">%s</a>', '#', $r['query'], PRODUCT_ASSIGNEMNT)
272+
sprintf('<a href="%s" data-query="%s" class="button toggleSearch">%s</a>', '#', $r['query'], PRODUCT_ASSIGNEMNT),
273+
$delete
250274
];
251275

252276
$row = [
253-
$link,
277+
$link,
254278
$r['searches'],
255279
date('d.m.Y H:i:s', $r['crdate']),
256280
date('d.m.Y H:i:s', $r['tstamp']),
@@ -287,7 +311,7 @@
287311
</table>
288312
</div>
289313

290-
<script src="includes/javascript/t10.searchstats.js"></script>
314+
<script src="includes/javascript/mcm_searchstats.js"></script>
291315

292316
<!-- footer //-->
293317
<?php require DIR_WS_INCLUDES . 'footer.php'; ?>

0 commit comments

Comments
 (0)