Searchautocomplete - Version 0.0.1

Version Notes

Searchautocomplete

Download this release

Release Info

Developer Kanavan
Extension Searchautocomplete
Version 0.0.1
Comparing to
See all releases


Version 0.0.1

app/code/local/Kanavan/Searchautocomplete/Block/Ajaxsearch.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kanavan_Searchautocomplete_Block_Searchautocomplete extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getSearchautocomplete()
10
+ {
11
+ if (!$this->hasData('searchautocomplete')) {
12
+ $this->setData('searchautocomplete', Mage::registry('searchautocomplete'));
13
+ }
14
+ return $this->getData('searchautocomplete');
15
+
16
+ }
17
+ }
app/code/local/Kanavan/Searchautocomplete/Block/Suggest.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kanavan_Searchautocomplete_Block_Suggest extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getSearchautocomplete()
10
+ {
11
+ if (!$this->hasData('searchautocomplete')) {
12
+ $this->setData('searchautocomplete', Mage::registry('searchautocomplete'));
13
+ }
14
+ return $this->getData('searchautocomplete');
15
+ }
16
+
17
+ public function getSuggestProducts()
18
+ {
19
+ $results=Mage::getResourceModel('catalogsearch/search_collection')->addSearchFilter(Mage::app()->getRequest()->getParam('q'))->addAttributeToFilter('visibility', array('neq' => 1));
20
+
21
+
22
+ if(Mage::getStoreConfig('searchautocomplete/preview/number_product'))
23
+ {
24
+ $results->setPageSize(Mage::getStoreConfig('searchautocomplete/preview/number_product'));
25
+ }
26
+ else
27
+ {
28
+ $results->setPageSize(5);
29
+ }
30
+ return $results;
31
+ }
32
+ public function enabledSuggest()
33
+ {
34
+ return Mage::getStoreConfig('searchautocomplete/suggest/enable');
35
+ }
36
+
37
+ public function enabledPreview()
38
+ {
39
+ return Mage::getStoreConfig('searchautocomplete/preview/enable');
40
+ }
41
+
42
+ public function getImageWidth()
43
+ {
44
+ return Mage::getStoreConfig('searchautocomplete/preview/image_width');
45
+ }
46
+
47
+ public function getImageHeight()
48
+ {
49
+ return Mage::getStoreConfig('searchautocomplete/preview/image_height');
50
+ }
51
+ public function getEffect()
52
+ {
53
+ return Mage::getStoreConfig('searchautocomplete/settings/effect');
54
+ }
55
+
56
+ public function getPreviewBackground()
57
+ {
58
+ return Mage::getStoreConfig('searchautocomplete/preview/background');
59
+ }
60
+
61
+ public function getSuggestBackground()
62
+ {
63
+ return Mage::getStoreConfig('searchautocomplete/suggest/background');
64
+ }
65
+
66
+ public function getSuggestColor()
67
+ {
68
+ return Mage::getStoreConfig('searchautocomplete/suggest/suggest_color');
69
+ }
70
+
71
+ public function getSuggestCountColor()
72
+ {
73
+ return Mage::getStoreConfig('searchautocomplete/suggest/count_color');
74
+ }
75
+
76
+ public function getBorderColor()
77
+ {
78
+ return Mage::getStoreConfig('searchautocomplete/settings/border_color');
79
+ }
80
+
81
+ public function getBorderWidth()
82
+ {
83
+ return Mage::getStoreConfig('searchautocomplete/settings/border_width');
84
+ }
85
+
86
+ public function isShowImage()
87
+ {
88
+ return Mage::getStoreConfig('searchautocomplete/preview/show_image');
89
+ }
90
+
91
+ public function isShowName()
92
+ {
93
+ return Mage::getStoreConfig('searchautocomplete/preview/show_name');
94
+ }
95
+ public function getProductNameColor()
96
+ {
97
+ return Mage::getStoreConfig('searchautocomplete/preview/pro_title_color');
98
+ }
99
+
100
+ public function getProductDescriptionColor()
101
+ {
102
+ return Mage::getStoreConfig('searchautocomplete/preview/pro_description_color');
103
+ }
104
+
105
+
106
+ public function isShowDescription()
107
+ {
108
+ return Mage::getStoreConfig('searchautocomplete/preview/show_description');
109
+ }
110
+
111
+ public function getNumDescriptionChar()
112
+ {
113
+ return Mage::getStoreConfig('searchautocomplete/preview/num_char_description');
114
+ }
115
+
116
+
117
+ public function getImageBorderWidth()
118
+ {
119
+ return Mage::getStoreConfig('searchautocomplete/preview/image_border_width');
120
+ }
121
+ public function getImageBorderColor()
122
+ {
123
+ return Mage::getStoreConfig('searchautocomplete/preview/image_border_color');
124
+ }
125
+
126
+ public function getHoverBackground()
127
+ {
128
+ return Mage::getStoreConfig('searchautocomplete/settings/hover_background');
129
+ }
130
+
131
+ }
app/code/local/Kanavan/Searchautocomplete/Helper/Data.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kanavan_Searchautocomplete_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function getSuggestUrl()
7
+ {
8
+ return $this->_getUrl('searchautocomplete/suggest/result', array(
9
+ '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()
10
+ ));
11
+ }
12
+ }
app/code/local/Kanavan/Searchautocomplete/Model/Ajaxsearch.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kanavan_Searchautocomplete_Model_Searchautocomplete extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('aearchautocomplete/aearchautocomplete');
9
+ }
10
+ }
app/code/local/Kanavan/Searchautocomplete/Model/Mysql4/Ajaxsearch.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kanavan_Searchautocomplete_Model_Mysql4_Searchautocomplete extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the searchautocomplete_id refers to the key field in your database table.
8
+ $this->_init('searchautocomplete/searchautocomplete', 'searchautocomplete_id');
9
+ }
10
+ }
app/code/local/Kanavan/Searchautocomplete/Model/Mysql4/Ajaxsearch/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kanavan_Searchautocomplete_Model_Mysql4_Searchautocomplete_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('searchautocomplete/searchautocomplete');
9
+ }
10
+ }
app/code/local/Kanavan/Searchautocomplete/Model/Source/Effect.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ NextWidgets **NOTICE OF LICENSE**
4
+ This source file is subject to the EULA that is bundled with this package in the file LICENSE.pdf. It is also available through the world-wide-web at this URL:
5
+ http://nextwidgets.com/magento_extension_license.pdf
6
+ =================================================================
7
+ MAGENTO COMMUNITY EDITION USAGE NOTICE
8
+ =================================================================
9
+ This package is designed for the Magento COMMUNITY edition
10
+ This extension may not work on any other Magento edition except Magento COMMUNITY edition. NextWidgets does not provide extension support in case of incorrect edition usage.
11
+ =================================================================
12
+ Copyright (c) 2011 NextWidgets – ALENSA AG (http://www.nextwidgets.com)
13
+ License http://nextwidgets.com/magento_extension_license.pdf
14
+ */
15
+ ?>
16
+ <?php
17
+ /**
18
+ * Magento
19
+ *
20
+ * NOTICE OF LICENSE
21
+ *
22
+ * This source file is subject to the Open Software License (OSL 3.0)
23
+ * that is bundled with this package in the file LICENSE.txt.
24
+ * It is also available through the world-wide-web at this URL:
25
+ * http://opensource.org/licenses/osl-3.0.php
26
+ * If you did not receive a copy of the license and are unable to
27
+ * obtain it through the world-wide-web, please send an email
28
+ * to license@magentocommerce.com so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
33
+ * versions in the future. If you wish to customize Magento for your
34
+ * needs please refer to http://www.magentocommerce.com for more information.
35
+ *
36
+ * @category Mage
37
+ * @package Mage_Adminhtml
38
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
39
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
40
+ */
41
+
42
+ /**
43
+ * Used in creating options for Yes|No config value selection
44
+ *
45
+ */
46
+ class Kanavan_Searchautocomplete_Model_Source_Effect extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
47
+ {
48
+
49
+ /**
50
+ * Options getter
51
+ *
52
+ * @return array
53
+ */
54
+ public function getAllOptions()
55
+ {
56
+ $this->toOptionArray();
57
+
58
+ }
59
+ public function toOptionArray()
60
+ {
61
+ return array(
62
+ array('value' => '', 'label'=>Mage::helper('adminhtml')->__('Chose effect...')),
63
+ array('value' => 'toogle', 'label'=>Mage::helper('adminhtml')->__('Toogle')),
64
+ array('value' => 'show_hide', 'label'=>Mage::helper('adminhtml')->__('Show/Hide')),
65
+ array('value' => 'face', 'label'=>Mage::helper('adminhtml')->__('Face')),
66
+
67
+ );
68
+
69
+ }
70
+
71
+ }
app/code/local/Kanavan/Searchautocomplete/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kanavan_Searchautocomplete_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('aearchautocomplete')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('aearchautocomplete')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Kanavan/Searchautocomplete/controllers/SuggestController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Kanavan_Searchautocomplete_SuggestController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function resultAction()
5
+ {
6
+
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+
10
+ }
11
+ }
app/code/local/Kanavan/Searchautocomplete/etc/config.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Kanavan
5
+ * @package Kanavan_Searchautocomplete
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Kanavan_Searchautocomplete>
13
+ <version>0.1.0</version>
14
+ </Kanavan_Searchautocomplete>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <searchautocomplete>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Kanavan_Searchautocomplete</module>
22
+ <frontName>searchautocomplete</frontName>
23
+ </args>
24
+ </searchautocomplete>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <searchautocomplete>
29
+ <file>searchautocomplete.xml</file>
30
+ </searchautocomplete>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <admin>
35
+ <routers>
36
+ <searchautocomplete>
37
+ <use>admin</use>
38
+ <args>
39
+ <module>Kanavan_Searchautocomplete</module>
40
+ <frontName>searchautocomplete</frontName>
41
+ </args>
42
+ </searchautocomplete>
43
+ </routers>
44
+ </admin>
45
+ <adminhtml>
46
+
47
+ <acl>
48
+ <resources>
49
+ <all>
50
+ <title>Allow Everything</title>
51
+ </all>
52
+ <admin>
53
+ <children>
54
+ <Kanavan_Searchautocomplete>
55
+ <title>Searchautocomplete Module</title>
56
+ <sort_order>10</sort_order>
57
+ </Kanavan_Searchautocomplete>
58
+ <system>
59
+ <children>
60
+ <config>
61
+ <children>
62
+ <searchautocomplete translate="title" module="searchautocomplete">
63
+ <title>Searchautocomplete</title>
64
+ <sort_order>100</sort_order>
65
+ </searchautocomplete>
66
+
67
+ </children>
68
+ </config>
69
+ </children>
70
+ </system>
71
+
72
+ </children>
73
+ </admin>
74
+ </resources>
75
+ </acl>
76
+ <layout>
77
+ <updates>
78
+ <searchautocomplete>
79
+ <file>searchautocomplete.xml</file>
80
+ </searchautocomplete>
81
+ </updates>
82
+ </layout>
83
+ </adminhtml>
84
+ <global>
85
+ <models>
86
+ <searchautocomplete>
87
+ <class>Kanavan_Searchautocomplete_Model</class>
88
+ <resourceModel>searchautocomplete_mysql4</resourceModel>
89
+ </searchautocomplete>
90
+
91
+ </models>
92
+
93
+ <blocks>
94
+ <searchautocomplete>
95
+ <class>Kanavan_Searchautocomplete_Block</class>
96
+ </searchautocomplete>
97
+ </blocks>
98
+ <helpers>
99
+ <searchautocomplete>
100
+ <class>Kanavan_Searchautocomplete_Helper</class>
101
+ </searchautocomplete>
102
+ </helpers>
103
+ </global>
104
+
105
+ <default>
106
+ <searchautocomplete>
107
+ <settings>
108
+ <border_color>#CCCCCC</border_color>
109
+ <border_width>1</border_width>
110
+ <hover_background>#7FC1F8</hover_background>
111
+ </settings>
112
+ <suggest>
113
+ <enable>1</enable>
114
+ <suggest_color>#FFF</suggest_color>
115
+ <background>#0A263D</background>
116
+ <count_color>#FF0000</count_color>
117
+ </suggest>
118
+ <preview>
119
+ <enable>1</enable>
120
+ <number_product>5</number_product>
121
+ <show_image>1</show_image>
122
+ <show_name>1</show_name>
123
+ <show_description>1</show_description>
124
+ <num_char_description>100</num_char_description>
125
+ <pro_description_color>#0A263D</pro_description_color>
126
+ <background>#ffffff</background>
127
+ <pro_title_color>#E26703</pro_title_color>
128
+ <image_width>50</image_width>
129
+ <image_height>50</image_height>
130
+ <image_border_width>1</image_border_width>
131
+ <image_border_color>#CCC</image_border_color>
132
+ </preview>
133
+ </searchautocomplete>
134
+
135
+ </default>
136
+ </config>
app/code/local/Kanavan/Searchautocomplete/etc/system.xml ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <searchautocomplete translate="label" module="searchautocomplete">
5
+ <label>Ajax Search</label>
6
+ <sort_order>200</sort_order>
7
+ </searchautocomplete>
8
+ </tabs>
9
+ <sections>
10
+ <searchautocomplete translate="label" module="searchautocomplete">
11
+ <label>Ajax search</label>
12
+ <tab>searchautocomplete</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
+ <settings translate="label">
20
+ <label>Setting</label>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <!--
27
+ <effect translate="">
28
+ <label>Effect</label>
29
+ <frontend_type>select</frontend_type>
30
+ <sort_order>4</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <source_model>searchautocomplete/source_effect</source_model>
34
+ </effect>
35
+
36
+ <max_char translate="">
37
+ <label>Max char</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>4</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ </max_char>
43
+ -->
44
+ <border_color translate="">
45
+ <label>Border Color</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>4</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ </border_color>
51
+
52
+ <border_width translate="">
53
+ <label>Border Width (px)</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>4</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ </border_width>
59
+ <hover_background translate="">
60
+ <label>Hover Background</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>5</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ </hover_background>
66
+ </fields>
67
+ </settings>
68
+ <suggest translate="label">
69
+ <label>Suggest</label>
70
+ <frontend_type>text</frontend_type>
71
+
72
+ <sort_order>2</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <fields>
77
+
78
+ <enable translate="">
79
+ <label>Enable</label>
80
+ <frontend_type>select</frontend_type>
81
+ <sort_order>1</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ </enable>
86
+
87
+ <background translate="">
88
+ <label>Background</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>2</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ </background>
94
+
95
+ <suggest_color translate="">
96
+ <label>Suggest Color</label>
97
+ <frontend_type>text</frontend_type>
98
+ <sort_order>3</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ </suggest_color>
102
+
103
+ <count_color translate="">
104
+ <label>Count Color</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>4</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ </count_color>
110
+
111
+ </fields>
112
+ </suggest>
113
+
114
+ <preview translate="label">
115
+ <label>Product Preview</label>
116
+ <sort_order>3</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <fields>
121
+ <enable translate="">
122
+ <label>Enable</label>
123
+ <frontend_type>select</frontend_type>
124
+ <sort_order>1</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ </enable>
129
+ <number_product translate="">
130
+ <label>Number Product Show</label>
131
+ <frontend_type>text</frontend_type>
132
+ <sort_order>2</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ </number_product>
136
+
137
+ <show_image translate="">
138
+ <label>Show Product Image</label>
139
+ <frontend_type>select</frontend_type>
140
+ <sort_order>3</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <source_model>adminhtml/system_config_source_yesno</source_model>
144
+ </show_image>
145
+ <show_name translate="">
146
+ <label>Show Product Name</label>
147
+ <frontend_type>select</frontend_type>
148
+ <sort_order>4</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ </show_name>
153
+
154
+ <show_description translate="">
155
+ <label>Show Product Descrition</label>
156
+ <frontend_type>select</frontend_type>
157
+ <sort_order>5</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <source_model>adminhtml/system_config_source_yesno</source_model>
161
+ </show_description>
162
+
163
+ <num_char_description translate="">
164
+ <label>Number character of Product Descrition</label>
165
+ <frontend_type>text</frontend_type>
166
+ <sort_order>6</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ </num_char_description>
170
+
171
+ <background translate="">
172
+ <label>Background</label>
173
+ <frontend_type>text</frontend_type>
174
+ <sort_order>7</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ </background>
178
+
179
+
180
+
181
+ <pro_title_color translate="">
182
+ <label>Product Name Color</label>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>9</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ </pro_title_color>
188
+
189
+ <pro_description_color translate="">
190
+ <label>Product Description Color</label>
191
+ <frontend_type>text</frontend_type>
192
+ <sort_order>10</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ </pro_description_color>
196
+
197
+
198
+
199
+ <image_width translate="">
200
+ <label>Thumnail width (px)</label>
201
+ <frontend_type>text</frontend_type>
202
+ <sort_order>11</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ </image_width>
206
+ <image_height translate="">
207
+ <label>Thumnail height (px)</label>
208
+ <frontend_type>text</frontend_type>
209
+ <sort_order>12</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>1</show_in_website>
212
+ </image_height>
213
+
214
+ <image_border_width translate="">
215
+ <label>Image border width (px)</label>
216
+ <frontend_type>text</frontend_type>
217
+ <sort_order>13</sort_order>
218
+ <show_in_default>1</show_in_default>
219
+ <show_in_website>1</show_in_website>
220
+ </image_border_width>
221
+ <image_border_color translate="">
222
+ <label>Image border color</label>
223
+ <frontend_type>text</frontend_type>
224
+ <sort_order>14</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ </image_border_color>
228
+ </fields>
229
+ </preview>
230
+ </groups>
231
+ </searchautocomplete>
232
+
233
+
234
+ </sections>
235
+ </config>
app/design/frontend/default/default/layout/searchautocomplete.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="top.search">
5
+ <action method="setTemplate" ><template>searchautocomplete/topsearch.phtml</template></action>
6
+ </reference>
7
+
8
+ </default>
9
+ <searchautocomplete_suggest_result>
10
+
11
+ <reference name="root">
12
+ <action method="setTemplate"><template>searchautocomplete/blank.phtml</template></action>
13
+ </reference>
14
+ <reference name="content">
15
+ <block type="searchautocomplete/suggest" name="searchautocomplete" template="searchautocomplete/suggest.phtml" />
16
+ </reference>
17
+ </searchautocomplete_suggest_result>
18
+ </layout>
app/design/frontend/default/default/template/searchautocomplete/blank.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getChildHtml('content') ?>
app/design/frontend/default/default/template/searchautocomplete/suggest.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $results=$this->getSuggestProducts();
3
+ $suggests=Mage::helper('catalogsearch')->getSuggestCollection();
4
+ ?>
5
+ <ul class="ajaxsearch" ><li style="display:none"></li>
6
+ <?php
7
+ if($this->enabledSuggest())
8
+ foreach($suggests as $_suggest)
9
+ {
10
+ echo "<li class=\"suggest\" >{$_suggest->getQueryText()} <span class=\"amount\">{$_suggest->getNumResults()}</span></li>";
11
+ }
12
+ if($results->count()&&$this->enabledPreview())
13
+ foreach($results as $_pro)
14
+ {
15
+ $pro=Mage::getModel('catalog/product')->load($_pro->getId());
16
+ echo "<li class=\"preview\" ><a href=\"{$pro->getProductUrl()}\">";
17
+ if($this->isShowImage())
18
+ {
19
+ echo "<img src=\"{$this->helper('catalog/image')->init($pro, 'small_image')->resize($this->getImageWidth(),$this->getImageHeight())}\" />";
20
+ }
21
+ if($this->isShowName()) echo "{$pro->getName()} ";
22
+
23
+
24
+ if($this->isShowDescription())
25
+ {
26
+ $description=substr($pro->getDescription(),0,$this->getNumDescriptionChar());
27
+ $description=strip_tags(substr($description,0,strrpos($description,' ')));
28
+ echo "<div class=\"description\">$description...</div>";
29
+ }
30
+ echo "</a></li>";
31
+ }
32
+
33
+ ?>
34
+ </ul>
35
+ <style>
36
+ .ajaxsearch{border:solid <?php echo $this->getBorderColor().' '.$this->getBorderWidth().'px';?>}
37
+ .ajaxsearch .suggest{background:<?php echo $this->getSuggestBackground();?>; color:<?php echo $this->getSuggestColor();?>}
38
+ .ajaxsearch .suggest .amount{color:<?php echo $this->getSuggestCountColor();?>}
39
+ .ajaxsearch .preview {background:<?php echo $this->getPreviewBackground();?>}
40
+ .ajaxsearch .preview a {color:<?php echo $this->getProductNameColor();?>}
41
+ .ajaxsearch .preview .description {color:<?php echo $this->getProductDescriptionColor();?>}
42
+ .ajaxsearch .preview img {border:solid <?php echo $this->getImageBorderWidth().'px '.$this->getImageBorderColor();?> }
43
+ .header .form-search .ajaxsearch li.selected {background-color:<?php echo $this->getHoverBackground();?>}
44
+ </style>
app/design/frontend/default/default/template/searchautocomplete/topsearch.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="search_mini_form" action="<?php echo $this->helper('catalogsearch')->getResultUrl() ?>" method="get">
2
+ <div class="form-search">
3
+ <label for="search"><?php echo $this->__('Search:') ?></label>
4
+ <input id="search" type="text" name="<?php echo $this->helper('catalogsearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogsearch')->getEscapedQueryText() ?>" class="input-text" />
5
+ <button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
6
+ <div id="search_autocomplete" class="search-autocomplete"></div>
7
+ <script type="text/javascript">
8
+ //<![CDATA[
9
+ var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...') ?>');
10
+ searchForm.initAutocomplete('<?php echo $this->helper('searchautocomplete')->getSuggestUrl() ?>', 'search_autocomplete');
11
+ //]]>
12
+ </script>
13
+ </div>
14
+ </form>
app/etc/modules/Kanavan_Searchautocomplete.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Kanavan
5
+ * @package Kanavan_Searchautocomplete
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Kanavan_Searchautocomplete>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Kanavan_Searchautocomplete>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Searchautocomplete</name>
4
+ <version>0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>Kanavan</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Search auto complete</summary>
10
+ <description>Search auto complete</description>
11
+ <notes>Searchautocomplete</notes>
12
+ <authors><author><name>Kanavan</name><user>sangtm201</user><email>sang@kanavan.net</email></author></authors>
13
+ <date>2011-11-20</date>
14
+ <time>16:25:55</time>
15
+ <contents><target name="magelocal"><dir name="Kanavan"><dir name="Searchautocomplete"><dir name="Block"><file name="Ajaxsearch.php" hash="5047292020c9583014428b67496e28a7"/><file name="Suggest.php" hash="88ce9f47b352fd105560c22274895304"/></dir><dir name="Helper"><file name="Data.php" hash="e1a72f5f0a5b2b50418861215e93315e"/></dir><dir name="Model"><file name="Ajaxsearch.php" hash="476d278e22ca5d42c4eb564afff09b54"/><dir name="Mysql4"><dir name="Ajaxsearch"><file name="Collection.php" hash="1fc0d4a1385e74b28865eff2ca1e3e94"/></dir><file name="Ajaxsearch.php" hash="ea71560960a3ca6aa4f24ffb274de741"/></dir><dir name="Source"><file name="Effect.php" hash="0a9dbd10ed43d47099f9ceb00d20978b"/></dir><file name="Status.php" hash="ff2537ea38d78b9343ba7970cd3c8d3b"/></dir><dir name="controllers"><file name="SuggestController.php" hash="1807b4240cdd403a194d940d1266b763"/></dir><dir name="etc"><file name="config.xml" hash="bac67c185f964ea4f592056b67ecb654"/><file name="system.xml" hash="397b829c6f49b680f672783491bbf263"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kanavan_Searchautocomplete.xml" hash="b307375dc2c1b410fdaad5c845729dd1"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="searchautocomplete.xml" hash="675c8528d4023c0f4752cb11b859fc41"/></dir><dir name="template"><dir name="searchautocomplete"><file name="blank.phtml" hash="7949696b79643341359508a6d6d64921"/><file name="suggest.phtml" hash="3d6a8e0ac895bc03c61cd8ba36669927"/><file name="topsearch.phtml" hash="509a97c41b947eb3db510e315a5c1788"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Searchautocomplete</name><channel>community</channel><min>0.0.1</min><max>5.0.0</max></package></required></dependencies>
18
+ </package>