Searchautocomplete - Version 0.0.9

Version Notes

Searchautocomplete

Download this release

Release Info

Developer Magento Core Team
Extension Searchautocomplete
Version 0.0.9
Comparing to
See all releases


Code changes from version 0.0.8 to 0.0.9

app/code/local/Kanavan/Searchautocomplete/Block/Suggest.php CHANGED
@@ -30,11 +30,7 @@ class Kanavan_Searchautocomplete_Block_Suggest extends Mage_Core_Block_Template
30
  Mage::helper('catalogsearch')->checkNotes();
31
 
32
 
33
- $versions = Mage::getVersion();
34
- if (version_compare($versions, '1.6.0.0', '<'))
35
  $results=$query->getResultCollection();//->setPageSize(5);
36
- else
37
- $results=$query->getSearchCollection();//->setPageSize(5);
38
 
39
 
40
 
@@ -51,6 +47,8 @@ else
51
  {
52
  $results->setPageSize(5);
53
  }
 
 
54
  return $results;
55
  }
56
  public function enabledSuggest()
30
  Mage::helper('catalogsearch')->checkNotes();
31
 
32
 
 
 
33
  $results=$query->getResultCollection();//->setPageSize(5);
 
 
34
 
35
 
36
 
47
  {
48
  $results->setPageSize(5);
49
  }
50
+ $results->addAttributeToSelect('description');
51
+ $results->addAttributeToSelect('name');
52
  return $results;
53
  }
54
  public function enabledSuggest()
app/code/local/Kanavan/Searchautocomplete/Helper/Data.php CHANGED
@@ -9,4 +9,21 @@ class Kanavan_Searchautocomplete_Helper_Data extends Mage_Core_Helper_Abstract
9
  '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()
10
  ));
11
  }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()
10
  ));
11
  }
12
+
13
+ public function getStyle()
14
+ {
15
+ //$style='';
16
+ $style='
17
+ <style>
18
+ .ajaxsearch{border:solid '.Mage::getStoreConfig('searchautocomplete/settings/border_color').' ' .Mage::getStoreConfig('searchautocomplete/settings/border_width').'px}
19
+ .ajaxsearch .suggest{background:'.Mage::getStoreConfig('searchautocomplete/suggest/background').'; color:'.Mage::getStoreConfig('searchautocomplete/suggest/suggest_color').'}
20
+ .ajaxsearch .suggest .amount{color:'.Mage::getStoreConfig('searchautocomplete/suggest/count_color').'}
21
+ .ajaxsearch .preview {background:'.Mage::getStoreConfig('searchautocomplete/preview/background').'}
22
+ .ajaxsearch .preview a {color:'.Mage::getStoreConfig('searchautocomplete/preview/pro_title_color').'}
23
+ .ajaxsearch .preview .description {color:'.Mage::getStoreConfig('searchautocomplete/preview/pro_description_color').'}
24
+ .ajaxsearch .preview img {border:solid '.Mage::getStoreConfig('searchautocomplete/preview/image_border_width').'px '.Mage::getStoreConfig('searchautocomplete/preview/image_border_color').' }
25
+ .header .form-search .ajaxsearch li.selected {background-color:'.Mage::getStoreConfig('searchautocomplete/settings/hover_background').'}
26
+ </style>';
27
+ return $style;
28
+ }
29
+ }
app/code/local/Kanavan/Searchautocomplete/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  <config>
11
  <modules>
12
  <Kanavan_Searchautocomplete>
13
- <version>0.0.8</version>
14
  </Kanavan_Searchautocomplete>
15
  </modules>
16
  <frontend>
@@ -31,17 +31,6 @@
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>
10
  <config>
11
  <modules>
12
  <Kanavan_Searchautocomplete>
13
+ <version>0.0.9</version>
14
  </Kanavan_Searchautocomplete>
15
  </modules>
16
  <frontend>
31
  </updates>
32
  </layout>
33
  </frontend>
 
 
 
 
 
 
 
 
 
 
 
34
  <adminhtml>
35
 
36
  <acl>
app/design/frontend/default/default/layout/searchautocomplete.xml DELETED
@@ -1,18 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- <?php echo $this->getChildHtml('content') ?>
 
app/design/frontend/default/default/template/searchautocomplete/suggest.phtml DELETED
@@ -1,45 +0,0 @@
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
-
13
- if($results->count()&&$this->enabledPreview())
14
- foreach($results as $_pro)
15
- {
16
- $pro=Mage::getModel('catalog/product')->load($_pro->getId());
17
- echo "<li class=\"preview\" ><a href=\"{$pro->getProductUrl()}\">";
18
- if($this->isShowImage())
19
- {
20
- echo "<img src=\"{$this->helper('catalog/image')->init($pro, 'small_image')->resize($this->getImageWidth(),$this->getImageHeight())}\" />";
21
- }
22
- if($this->isShowName()) echo "{$pro->getName()} ";
23
-
24
-
25
- if($this->isShowDescription())
26
- {
27
- $description=substr($pro->getDescription(),0,$this->getNumDescriptionChar());
28
- $description=strip_tags(substr($description,0,strrpos($description,' ')));
29
- echo "<div class=\"description\">$description...</div>";
30
- }
31
- echo "</a></li>";
32
- }
33
-
34
- ?>
35
- </ul>
36
- <style>
37
- .ajaxsearch{border:solid <?php echo $this->getBorderColor().' '.$this->getBorderWidth().'px';?>}
38
- .ajaxsearch .suggest{background:<?php echo $this->getSuggestBackground();?>; color:<?php echo $this->getSuggestColor();?>}
39
- .ajaxsearch .suggest .amount{color:<?php echo $this->getSuggestCountColor();?>}
40
- .ajaxsearch .preview {background:<?php echo $this->getPreviewBackground();?>}
41
- .ajaxsearch .preview a {color:<?php echo $this->getProductNameColor();?>}
42
- .ajaxsearch .preview .description {color:<?php echo $this->getProductDescriptionColor();?>}
43
- .ajaxsearch .preview img {border:solid <?php echo $this->getImageBorderWidth().'px '.$this->getImageBorderColor();?> }
44
- .header .form-search .ajaxsearch li.selected {background-color:<?php echo $this->getHoverBackground();?>}
45
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/searchautocomplete/topsearch.phtml DELETED
@@ -1,23 +0,0 @@
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
- <!--
8
- <script type="text/javascript">
9
- //<![CDATA[
10
- var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...') ?>');
11
- searchForm.initAutocomplete('<?php echo $this->helper('searchautocomplete')->getSuggestUrl() ?>', 'search_autocomplete');
12
- //]]>
13
- </script>
14
- -->
15
- <script type="text/javascript">
16
- //<![CDATA[
17
- var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...') ?>');
18
- searchForm.initAutocomplete('<?php echo $this->helper('searchautocomplete')->getSuggestUrl() ?>', 'search_autocomplete');
19
- //]]>
20
- </script>
21
-
22
- </div>
23
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Searchautocomplete</name>
4
- <version>0.0.8</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>
@@ -10,9 +10,9 @@
10
  <description>Search auto complete support resuft preview. Change result style on backend.</description>
11
  <notes>Searchautocomplete</notes>
12
  <authors><author><name>Kanavan</name><user>auto-converted</user><email>sang@kanavan.net</email></author></authors>
13
- <date>2012-05-03</date>
14
- <time>03:08:04</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="45f2964ddb9a7bfd778bf2f4497a7326"/></dir><dir name="Helper"><file name="Data.php" hash="e1a72f5f0a5b2b50418861215e93315e"/></dir><dir name="Model"><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="Ajaxsearch.php" hash="476d278e22ca5d42c4eb564afff09b54"/><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="6bb0c3e06818a55e4890d83d7931a91e"/><file name="system.xml" hash="56bd22feb456e5acede1c01c728203cb"/></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="b116991dfbb889a4950a24056758dce3"/><file name="topsearch.phtml" hash="cf7af2fafc49c79cb32f03be0b86ca60"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Searchautocomplete</name><channel>community</channel><min>0.0.1</min><max>5.0.0</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Searchautocomplete</name>
4
+ <version>0.0.9</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>
10
  <description>Search auto complete support resuft preview. Change result style on backend.</description>
11
  <notes>Searchautocomplete</notes>
12
  <authors><author><name>Kanavan</name><user>auto-converted</user><email>sang@kanavan.net</email></author></authors>
13
+ <date>2012-07-08</date>
14
+ <time>14:56: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="1b5b58b122a0ccaea60a13d8c8d6f5ff"/></dir><dir name="Helper"><file name="Data.php" hash="7a29247ae677ae7e3406a3c57937b2ba"/></dir><dir name="Model"><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="Ajaxsearch.php" hash="476d278e22ca5d42c4eb564afff09b54"/><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="b8315dc2d3ccfe741db52146cbe59555"/><file name="system.xml" hash="56bd22feb456e5acede1c01c728203cb"/></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=""/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Searchautocomplete</name><channel>community</channel><min>0.0.1</min><max>5.0.0</max></package></required></dependencies>
18
  </package>