Version Notes
First release
Download this release
Release Info
Developer | Chris Munshaw |
Extension | ThinkGlobal_Search-Term-Filters |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
app/code/community/Thinkglobal/Searchtermfilter/Helper/Data.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Search Term Filter helper
|
26 |
+
*
|
27 |
+
* @author ThinkGlobal.co
|
28 |
+
*/
|
29 |
+
class Thinkglobal_Searchtermfilter_Helper_Data extends Mage_CatalogSearch_Helper_Data
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* Retrieve search query text
|
33 |
+
*
|
34 |
+
* @return string
|
35 |
+
*/
|
36 |
+
public function getQueryText()
|
37 |
+
{
|
38 |
+
if (is_null($this->_queryText)) {
|
39 |
+
$this->_queryText = $this->_getRequest()->getParam($this->getQueryParamName());
|
40 |
+
if ($this->_queryText === null) {
|
41 |
+
$this->_queryText = '';
|
42 |
+
} else {
|
43 |
+
if (is_array($this->_queryText)) {
|
44 |
+
$this->_queryText = null;
|
45 |
+
}
|
46 |
+
|
47 |
+
$this->_queryText = str_ireplace(Mage::getStoreConfig('searchtermfilter/filter_group/filter1'), "", $this->_queryText);
|
48 |
+
$this->_queryText = str_ireplace(Mage::getStoreConfig('searchtermfilter/filter_group/filter2'), "", $this->_queryText);
|
49 |
+
$this->_queryText = str_ireplace(Mage::getStoreConfig('searchtermfilter/filter_group/filter3'), "", $this->_queryText);
|
50 |
+
|
51 |
+
$this->_queryText = trim($this->_queryText);
|
52 |
+
$this->_queryText = Mage::helper('core/string')->cleanString($this->_queryText);
|
53 |
+
|
54 |
+
if (Mage::helper('core/string')->strlen($this->_queryText) > $this->getMaxQueryLength()) {
|
55 |
+
$this->_queryText = Mage::helper('core/string')->substr(
|
56 |
+
$this->_queryText,
|
57 |
+
0,
|
58 |
+
$this->getMaxQueryLength()
|
59 |
+
);
|
60 |
+
$this->_isMaxLength = true;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return $this->_queryText;
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Thinkglobal/Searchtermfilter/etc/config.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* @category Updraft
|
6 |
+
* @package Updraft_BackorderNotification
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Thinkglobal_Searchtermfilter>
|
12 |
+
<version>1.0.0</version>
|
13 |
+
</Thinkglobal_Searchtermfilter>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<helpers>
|
17 |
+
<searchtermfilter>
|
18 |
+
<class>Thinkglobal_Searchtermfilter_Helper</class>
|
19 |
+
</searchtermfilter>
|
20 |
+
<catalogsearch>
|
21 |
+
<rewrite>
|
22 |
+
<data>Thinkglobal_Searchtermfilter_Helper_Data</data>
|
23 |
+
</rewrite>
|
24 |
+
</catalogsearch>
|
25 |
+
</helpers>
|
26 |
+
</global>
|
27 |
+
<adminhtml>
|
28 |
+
<acl>
|
29 |
+
<resources>
|
30 |
+
<all>
|
31 |
+
<title>Allow Everything</title>
|
32 |
+
</all>
|
33 |
+
<admin>
|
34 |
+
<children>
|
35 |
+
<system>
|
36 |
+
<children>
|
37 |
+
<config>
|
38 |
+
<children>
|
39 |
+
<searchtermfilter>
|
40 |
+
<title>Search Term Filters</title>
|
41 |
+
</searchtermfilter>
|
42 |
+
</children>
|
43 |
+
</config>
|
44 |
+
</children>
|
45 |
+
</system>
|
46 |
+
</children>
|
47 |
+
</admin>
|
48 |
+
</resources>
|
49 |
+
</acl>
|
50 |
+
</adminhtml>
|
51 |
+
</config>
|
app/code/community/Thinkglobal/Searchtermfilter/etc/system.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<searchtermfilter translate="label" module="searchtermfilter">
|
5 |
+
<label>ThinkGlobal.co Search Term Filter</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</searchtermfilter>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<searchtermfilter translate="label" module="searchtermfilter">
|
11 |
+
<label>Search Term Filters</label>
|
12 |
+
<tab>searchtermfilter</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>100</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<filter_group translate="label">
|
20 |
+
<label>Search Term Filters</label>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<sort_order>100</sort_order>
|
25 |
+
<fields>
|
26 |
+
<filter3 translate="label">
|
27 |
+
<label>Filter 3</label>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>101</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</filter3>
|
34 |
+
<filter2 translate="label">
|
35 |
+
<label>Filter 2</label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>101</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
</filter2>
|
42 |
+
<filter1 translate="label">
|
43 |
+
<label>Filter 1</label>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>101</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
</filter1>
|
50 |
+
</fields>
|
51 |
+
</filter_group>
|
52 |
+
</groups>
|
53 |
+
</searchtermfilter>
|
54 |
+
</sections>
|
55 |
+
</config>
|
app/etc/modules/Thinkglobal_Searchtermfilter.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Thinkglobal
|
5 |
+
* @package Thinkglobal_Searchtermfilter
|
6 |
+
* @author Thinkglobal.co
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Thinkglobal_Searchtermfilter>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</Thinkglobal_Searchtermfilter>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ThinkGlobal_Search-Term-Filters</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A Magento extension for pre-filtering search terms based on keywords in the front-end.</summary>
|
10 |
+
<description>A Magento extension for pre-filtering search terms based on keywords in the front-end.</description>
|
11 |
+
<notes>First release</notes>
|
12 |
+
<authors><author><name>Chris Munshaw</name><user>cmunshaw</user><email>cmunshaw@gmail.com</email></author></authors>
|
13 |
+
<date>2014-03-20</date>
|
14 |
+
<time>14:01:03</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Thinkglobal"><dir name="Searchtermfilter"><dir name="Helper"><file name="Data.php" hash="6082cb42086904a41cb9d0a3634161f9"/></dir><dir name="etc"><file name="config.xml" hash="8bc998f48cd8aa913330a5f4cdb2874c"/><file name="system.xml" hash="8b9483a51a9b363558847c605fc12ab2"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Thinkglobal_Searchtermfilter.xml" hash="e70698c8d4dc1a02a25e063846166c84"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|