Easy_Filtering - Version 1.0.0

Version Notes

It is a stable version.

Download this release

Release Info

Developer Synamen
Extension Easy_Filtering
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Synamen/TextFilter/Block/Index.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Synamen_TextFilter_Block_Index extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/local/Synamen/TextFilter/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Synamen_TextFilter_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/local/Synamen/TextFilter/controllers/IndexController.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Synamen_TextFilter_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+ foreach($_POST['alldata'] as $key => $item)
5
+ {
6
+ if(stripos($item, $_POST['query']) !== false)
7
+ {
8
+ $result_labels[$key] = $item;
9
+ }
10
+ }
11
+
12
+ $htmlArray = explode("<li>",$_POST['currenthtml']);
13
+
14
+
15
+ foreach($result_labels as $key => $result_label)
16
+ {
17
+ foreach($htmlArray as $li)
18
+ {
19
+ if(strpos($li, $result_label) !== false)
20
+ {
21
+ $result[] = "<li>".$li;
22
+ }
23
+ }
24
+ }
25
+
26
+ $unique_result = array_unique($result);
27
+
28
+ $resultHtml = implode("", $unique_result);
29
+ echo $resultHtml;
30
+ }
31
+ }
app/code/local/Synamen/TextFilter/etc/config.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Synamen_TextFilter>
5
+ <version>0.1.0</version>
6
+ </Synamen_TextFilter>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <textfilter>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Synamen_TextFilter</module>
14
+ <frontName>textfilter</frontName>
15
+ </args>
16
+ </textfilter>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <textfilter>
21
+ <file>textfilter.xml</file>
22
+ </textfilter>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <textfilter>
29
+ <class>Synamen_TextFilter_Helper</class>
30
+ </textfilter>
31
+ </helpers>
32
+ <blocks>
33
+ <textfilter>
34
+ <class>Synamen_TextFilter_Block</class>
35
+ </textfilter>
36
+ </blocks>
37
+ </global>
38
+ </config>
app/design/frontend/rwd/default/layout/textfilter.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <textfilter_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
6
+ </reference>
7
+ <reference name="content">
8
+ <block type="textfilter/index" name="textfilter_index" template="textfilter/index.phtml"/>
9
+ </reference>
10
+ </textfilter_index_index>
11
+ <catalog_category_layered>
12
+ <reference name="catalog.leftnav">
13
+ <action method="setTemplate">
14
+ <template>textfilter/catalog/layer/view.phtml</template>
15
+ </action>
16
+ </reference>
17
+ </catalog_category_layered>
18
+ <catalogsearch_result_index>
19
+ <reference name="catalogsearch.leftnav">
20
+ <action method="setTemplate">
21
+ <template>textfilter/catalog/layer/view.phtml</template>
22
+ </action>
23
+ </reference>
24
+ </catalogsearch_result_index>
25
+ </layout>
26
+
app/design/frontend/rwd/default/template/textfilter/catalog/layer/filter.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for filter items block
30
+ *
31
+ * @see Mage_Catalog_Block_Layer_Filter
32
+ */
33
+ ?>
34
+ <?php
35
+ foreach ($this->getItems() as $_item):
36
+ $cus_attr_code[] = $_item->getFilter()->getAttributeModel()->getAttributeCode();
37
+ endforeach;
38
+ ?>
39
+ <?php if(count($this->getItems()) >= 6 ) { ?>
40
+ <input type = "text" class = "auto_sug_filter" placeholder = "<?php echo $this->getName() ;?>" name = "auto_sug_filter_<?php echo $cus_attr_code[0] ?>" id = "auto_sug_filter_<?php echo $cus_attr_code[0] ?>"/>
41
+ <?php } ?>
42
+ <ol class = "checkbox-filter-wrapper" id = "<?php echo $cus_attr_code[0] ?>_wrapper">
43
+ <?php foreach ($this->getItems() as $_item): ?>
44
+ <li>
45
+ <?php if ($_item->getCount() > 0): ?>
46
+ <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
47
+ <?php echo $_item->getLabel() ?>
48
+ <?php if ($this->shouldDisplayProductCount()): ?>
49
+ <span class="count">(<?php echo $_item->getCount() ?>)</span>
50
+ <?php endif; ?>
51
+ </a>
52
+ <?php $attr_array[$_item->getValue()] = $_item->getLabel() ; ?>
53
+ <?php else: ?>
54
+ <span>
55
+ <?php echo $_item->getLabel(); ?>
56
+ <?php if ($this->shouldDisplayProductCount()): ?>
57
+ <span class="count">(<?php echo $_item->getCount() ?>)</span>
58
+ <?php endif; ?>
59
+ </span>
60
+ <?php endif; ?>
61
+ </li>
62
+ <?php endforeach ?>
63
+ </ol>
64
+ <style>
65
+ .checkbox-filter-wrapper
66
+ {
67
+ max-height: 120px;
68
+ overflow-y: auto;
69
+ }
70
+ </style>
71
+ <script>
72
+ jQuery(function() {
73
+ var attrArray = <?php echo json_encode($attr_array) ; ?> ;
74
+
75
+ var attr_code = '<?php echo $cus_attr_code[0] ; ?>' ;
76
+
77
+ var current_html = jQuery("#<?php echo $cus_attr_code[0] ?>_wrapper").html();
78
+
79
+ jQuery( "#auto_sug_filter_<?php echo $cus_attr_code[0] ?>" ).keyup(function()
80
+ {
81
+ if(jQuery(this).val())
82
+ {
83
+ var request = jQuery.ajax({
84
+ url: "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ; ?>index.php/textfilter",
85
+ type: "POST",
86
+ data: { query: jQuery(this).val(), alldata: attrArray, attrcode: attr_code, currenthtml: current_html },
87
+ dataType: "json",
88
+ success: function(response) { jQuery("#<?php echo $cus_attr_code[0] ?>_wrapper").html(response);},
89
+ error: function(xhr, ajaxOptions, thrownError) { jQuery("#<?php echo $cus_attr_code[0] ?>_wrapper").html(xhr.responseText);}
90
+ });
91
+ }
92
+ else
93
+ {
94
+ jQuery("#<?php echo $cus_attr_code[0] ?>_wrapper").html(current_html);
95
+ }
96
+ });
97
+ });
98
+ </script>
app/design/frontend/rwd/default/template/textfilter/catalog/layer/view.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Category layered navigation
30
+ *
31
+ * @see Mage_Catalog_Block_Layer_View
32
+ */
33
+ ?>
34
+ <?php if($this->canShowBlock()): ?>
35
+ <div class="block block-layered-nav<?php if (!$this->getLayer()->getState()->getFilters()): ?> block-layered-nav--no-filters<?php endif; ?>">
36
+ <div class="block-title">
37
+ <strong><span><?php echo $this->__('Shop By') ?></span></strong>
38
+ </div>
39
+ <div class="block-content toggle-content">
40
+ <?php echo $this->getStateHtml() ?>
41
+ <?php if ($this->getLayer()->getState()->getFilters()): ?>
42
+ <div class="actions"><a href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
43
+ <?php endif; ?>
44
+ <?php if($this->canShowOptions()): ?>
45
+ <p class="block-subtitle block-subtitle--filter"><?php echo $this->__('Filter') ?></p>
46
+ <dl id="narrow-by-list">
47
+ <?php $_filters = $this->getFilters() ?>
48
+ <?php foreach ($_filters as $_filter): ?>
49
+ <?php if($_filter->getItemsCount()): ?>
50
+ <dt><?php echo $this->__($_filter->getName()) ?></dt>
51
+ <?php $_filter->setTemplate('textfilter/catalog/layer/filter.phtml'); ?>
52
+ <dd><?php echo $_filter->getHtml() ?></dd>
53
+ <?php endif; ?>
54
+ <?php endforeach; ?>
55
+ </dl>
56
+ <script type="text/javascript">decorateDataList('narrow-by-list')</script>
57
+ <?php endif; ?>
58
+ </div>
59
+ </div>
60
+ <?php endif; ?>
app/design/frontend/rwd/default/template/textfilter/index.phtml ADDED
@@ -0,0 +1 @@
 
1
+ TextFilter
app/etc/modules/Synamen_TextFilter.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Synamen_TextFilter>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Synamen_TextFilter>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Easy_Filtering</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Easy Filtering reduce the category filters height and produce a filter box to choose the desired option from the list of filter options.</summary>
10
+ <description>Easy Filtering reduce the category filters height and produce a filter box to choose the desired option from the list of filter options.&#xD;
11
+ &#xD;
12
+ Example if a category has an attribute which has 20 to 30 options the navigation filter area will be too long for customer to choose. Our extension will show only 4 or 5 options and hide remaining options. The hidden options can be searched from the filter box produced by the extension.</description>
13
+ <notes>It is a stable version.</notes>
14
+ <authors><author><name>Synamen</name><user>synamen</user><email>info@synamen.com</email></author></authors>
15
+ <date>2015-10-27</date>
16
+ <time>10:02:13</time>
17
+ <contents><target name="magelocal"><dir name="Synamen"><dir name="TextFilter"><dir name="Block"><file name="Index.php" hash="982b4a362157ddabe4ebae8c68c55c71"/></dir><dir name="Helper"><file name="Data.php" hash="4d831f6a1c8ac2b64d2a3fa70a14e46d"/></dir><dir name="controllers"><file name="IndexController.php" hash="994153c4b21bdc780121ec6ea1065424"/></dir><dir name="etc"><file name="config.xml" hash="91da3ef995829b0721a05994cd60dc1b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="textfilter.xml" hash="b964814ca3e3c2b8d15c514f362e9094"/></dir><dir name="template"><dir name="textfilter"><dir name="catalog"><dir name="layer"><file name="filter.phtml" hash="ab6670b304d72ca4710f3582ffada301"/><file name="view.phtml" hash="d45593181b5dbd37f4ab6164f697ee2f"/></dir></dir><file name="index.phtml" hash="c1eba074fd97b0b3e622f830e8d84a1d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Synamen_TextFilter.xml" hash="cdb5046d7a3d3094e4652421b20d085c"/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.0.0</min><max>5.6.0</max></php></required></dependencies>
20
+ </package>