Version Notes
Search Suggest and Autocomplete extends Magento search and helps it run better for your online store. Customers can easily search products without loading the page. This extension uses Ajax to return match items with search query quickly. Moreover, the module configuration allows you to change the look and feel as well as customize search query to meet your requirements.
Download this release
Release Info
Developer | Magebuzz |
Extension | magebuzz_search_suggest_autocomplete |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- app/code/local/Magebuzz/Searchautocomplete/Block/Searchautocomplete.php +16 -0
- app/code/local/Magebuzz/Searchautocomplete/Helper/Data.php +261 -0
- app/code/local/Magebuzz/Searchautocomplete/Model/Source/Product/Attribute.php +136 -0
- app/code/local/Magebuzz/Searchautocomplete/controllers/IndexController.php +52 -0
- app/code/local/Magebuzz/Searchautocomplete/etc/adminhtml.xml +26 -0
- app/code/local/Magebuzz/Searchautocomplete/etc/config.xml +121 -0
- app/code/local/Magebuzz/Searchautocomplete/etc/system.xml +146 -0
- app/design/frontend/base/default/layout/searchautocomplete.xml +19 -0
- app/design/frontend/base/default/template/searchautocomplete/form.phtml +54 -0
- app/design/frontend/base/default/template/searchautocomplete/product/price.phtml +474 -0
- app/etc/modules/Magebuzz_Searchautocomplete.xml +9 -0
- app/locale/en_US/Magebuzz_Searchautocomplete.csv +14 -0
- js/magebuzz/searchautocomplete/ajaxsearch.js +79 -0
- package.xml +18 -0
- skin/frontend/base/default/css/magebuzz/searchautocomplete.css +92 -0
- skin/frontend/base/default/css/magebuzz/searchautocomplete/images/close-icon.png +0 -0
- skin/frontend/base/default/css/magebuzz/searchautocomplete/images/search-loading.gif +0 -0
- skin/frontend/base/default/css/magebuzz/searchautocomplete/images/search_complete.png +0 -0
app/code/local/Magebuzz/Searchautocomplete/Block/Searchautocomplete.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2014 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Searchautocomplete_Block_Searchautocomplete extends Mage_Core_Block_Template {
|
6 |
+
public function _prepareLayout() {
|
7 |
+
return parent::_prepareLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getSearchautocomplete() {
|
11 |
+
if (!$this->hasData('searchautocomplete')) {
|
12 |
+
$this->setData('searchautocomplete', Mage::registry('searchautocomplete'));
|
13 |
+
}
|
14 |
+
return $this->getData('searchautocomplete');
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Magebuzz/Searchautocomplete/Helper/Data.php
ADDED
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2014 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Searchautocomplete_Helper_Data extends Mage_Core_Helper_Abstract {
|
6 |
+
public function isActive() {
|
7 |
+
if(Mage::getStoreConfig('searchautocomplete/general/is_active')){
|
8 |
+
return true;
|
9 |
+
}
|
10 |
+
return false;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function isShowThumbnailImage() {
|
14 |
+
if(Mage::getStoreConfig('searchautocomplete/display_setting/is_show_thumbnail')){
|
15 |
+
return true;
|
16 |
+
}
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getThumbnailImageSize() {
|
21 |
+
return (int)Mage::getStoreConfig('searchautocomplete/display_setting/thumbnail_product_image_size');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isShowProductDesc(){
|
25 |
+
if(Mage::getStoreConfig('searchautocomplete/display_setting/is_show_description')){
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function setLimitChar($str,$numberChar) {
|
32 |
+
$short_text = substr($str, 0, $numberChar);
|
33 |
+
if(substr($short_text, 0, strrpos($short_text, ' '))!=''){
|
34 |
+
$short_text = substr($short_text, 0, strrpos($short_text, ' '));
|
35 |
+
$short_text = $short_text.'...';
|
36 |
+
}
|
37 |
+
return $short_text;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getLimitCharProductDesc() {
|
41 |
+
return (int)Mage::getStoreConfig('searchautocomplete/display_setting/limit_character_product_desc');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getSearchResultHeading() {
|
45 |
+
return Mage::getStoreConfig('searchautocomplete/display_setting/search_result_heading');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function isSearchByTag() {
|
49 |
+
if(Mage::getStoreConfig('searchautocomplete/general/search_by_tag')){
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getSearchResults($keyword) {
|
56 |
+
$result = array();
|
57 |
+
$products = array();
|
58 |
+
$resource = Mage::getSingleton('core/resource');
|
59 |
+
$db = $resource->getConnection('core_read');
|
60 |
+
$limit = Mage::getStoreConfig('searchautocomplete/display_setting/number_results');
|
61 |
+
/* Search By Attributes */
|
62 |
+
$attributes = Mage::getStoreConfig('searchautocomplete/general/searchable_attributes');
|
63 |
+
$arrAttributes = explode(",", $attributes);
|
64 |
+
foreach($arrAttributes as $index => $_attributeId){
|
65 |
+
$_attribute_code = Mage::getModel('eav/entity_attribute')->load($_attributeId)->getAttributeCode();
|
66 |
+
$products = $this->searchProductByAttribute($keyword,$_attribute_code);
|
67 |
+
$result = array_merge($products, $result);
|
68 |
+
}
|
69 |
+
/* Search By Tags */
|
70 |
+
if($this->isSearchByTag()){
|
71 |
+
$resultByTag = $this->searchProductByTag($keyword);
|
72 |
+
$result = array_merge($resultByTag, $result);
|
73 |
+
}
|
74 |
+
if(!(Mage::getStoreConfig('searchautocomplete/display_setting/show_out_of_stock'))&& !empty($result)){
|
75 |
+
$select = $db->select();
|
76 |
+
|
77 |
+
$select
|
78 |
+
->from($resource->getTableName('cataloginventory/stock_status'), 'product_id')
|
79 |
+
->where('product_id IN ('.implode(',',$result).') AND stock_status = 1');
|
80 |
+
|
81 |
+
$result = $db->fetchCol($select);
|
82 |
+
}
|
83 |
+
$result = array_unique($result);
|
84 |
+
$result = array_slice($result, 0, $limit);
|
85 |
+
return $result;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function searchByAttribute($keyword,$attribute) {
|
89 |
+
$result = array();
|
90 |
+
$storeId = Mage::app()->getStore()->getId();
|
91 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
92 |
+
->addAttributeToSelect('*')
|
93 |
+
->setStoreId($storeId)
|
94 |
+
->addStoreFilter($storeId)
|
95 |
+
->addFieldToFilter("status",1)
|
96 |
+
->addFieldToFilter($attribute,array('like'=>'%'. $keyword.'%'))
|
97 |
+
->setCurPage(1)
|
98 |
+
->setOrder('name','ASC');
|
99 |
+
|
100 |
+
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($products);
|
101 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($products);
|
102 |
+
$products->load();
|
103 |
+
if(count($products))
|
104 |
+
{
|
105 |
+
foreach($products as $product)
|
106 |
+
{
|
107 |
+
$result[] = $product->getId();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
return $result;
|
111 |
+
}
|
112 |
+
|
113 |
+
/*
|
114 |
+
* Get Manufacturer Ids by keyword
|
115 |
+
*/
|
116 |
+
public function getManufacturerIds($keyword) {
|
117 |
+
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','manufacturer');
|
118 |
+
$manufacturerIds = array();
|
119 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
120 |
+
/* Create search query from attribute option table by keyword */
|
121 |
+
/* Normal query
|
122 |
+
$searchQuery = "SELECT DISTINCT eao.option_id";
|
123 |
+
$searchQuery .= " FROM ".Mage::getSingleton('core/resource')->getTableName('eav_attribute_option_value')." AS eaov";
|
124 |
+
$searchQuery .= " JOIN ".Mage::getSingleton('core/resource')->getTableName('eav_attribute_option')." AS eao ON eaov.option_id = eao.option_id";
|
125 |
+
$searchQuery .= " WHERE eaov.value LIKE '%".$keyword."%' AND eao.attribute_id = '".$attributeId."'";
|
126 |
+
*/
|
127 |
+
/* Query with specific character */
|
128 |
+
$searchQuery = $read->quoteInto("SELECT DISTINCT eao.option_id FROM ".Mage::getSingleton('core/resource')->getTableName('eav_attribute_option_value')." AS eaov JOIN ".Mage::getSingleton('core/resource')->getTableName('eav_attribute_option')." AS eao ON eaov.option_id = eao.option_id WHERE eao.attribute_id = '".$attributeId."' AND eaov.value LIKE ?", '%'.$keyword.'%');
|
129 |
+
|
130 |
+
/* Read results */
|
131 |
+
$result = $read->fetchAll($searchQuery);
|
132 |
+
|
133 |
+
foreach($result as $item) {
|
134 |
+
array_push($manufacturerIds, $item['option_id']);
|
135 |
+
}
|
136 |
+
return $manufacturerIds;
|
137 |
+
}
|
138 |
+
|
139 |
+
public function searchProductByManufacturer($keyword) {
|
140 |
+
$attributeId = Mage::getResourceModel('eav/entity_attribute')
|
141 |
+
->getIdByCode('catalog_product','manufacturer');
|
142 |
+
//get manufacturer id by keyword
|
143 |
+
$manufacturerIds = $this->getManufacturerIds($keyword);
|
144 |
+
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
|
145 |
+
$attributeOptions = $attribute ->getSource()->getAllOptions();
|
146 |
+
$result = array();
|
147 |
+
$storeId = Mage::app()->getStore()->getId();
|
148 |
+
|
149 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
150 |
+
->addAttributeToSelect('*')
|
151 |
+
->setStoreId($storeId)
|
152 |
+
->addStoreFilter($storeId)
|
153 |
+
->addFieldToFilter("status", '1')
|
154 |
+
->addFieldToFilter('manufacturer', array('in' => $manufacturerIds))
|
155 |
+
->setCurPage(1)
|
156 |
+
->setOrder('name','ASC');
|
157 |
+
|
158 |
+
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($products);
|
159 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($products);
|
160 |
+
$products->load();
|
161 |
+
|
162 |
+
if(count($products))
|
163 |
+
{
|
164 |
+
foreach($products as $product)
|
165 |
+
{
|
166 |
+
$result[] = $product->getId();
|
167 |
+
}
|
168 |
+
}
|
169 |
+
return $result;
|
170 |
+
}
|
171 |
+
|
172 |
+
public function searchProductByAttribute($keyword,$attributeCode) {
|
173 |
+
$keyword = $this->jschars($keyword);
|
174 |
+
$result = array();
|
175 |
+
$storeId = Mage::app()->getStore()->getId();
|
176 |
+
$manufacturerIds = $this->getManufacturerIds($keyword);
|
177 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()
|
178 |
+
->addAttributeToSelect('*')
|
179 |
+
->setStoreId($storeId)
|
180 |
+
->addStoreFilter($storeId)
|
181 |
+
->addFieldToFilter("status", '1');
|
182 |
+
if($attributeCode == 'manufacturer') {
|
183 |
+
$attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product',$attributeCode);
|
184 |
+
$manufacturerIds = $this->getManufacturerIds($keyword);
|
185 |
+
$manufacturer = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
|
186 |
+
$attributeOptions = $manufacturer ->getSource()->getAllOptions();
|
187 |
+
$productCollection->addFieldToFilter('manufacturer', array('in' => $manufacturerIds));
|
188 |
+
}else{
|
189 |
+
$productCollection->addFieldToFilter($attributeCode,array('like'=>'%'.$keyword.'%'));
|
190 |
+
}
|
191 |
+
$productCollection->setCurPage(1);
|
192 |
+
$productCollection->setOrder('name','ASC');
|
193 |
+
|
194 |
+
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($productCollection);
|
195 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($productCollection);
|
196 |
+
$productCollection->load();
|
197 |
+
if(count($productCollection))
|
198 |
+
{
|
199 |
+
foreach($productCollection as $product)
|
200 |
+
{
|
201 |
+
$result[] = $product->getId();
|
202 |
+
}
|
203 |
+
}
|
204 |
+
return $result;
|
205 |
+
}
|
206 |
+
|
207 |
+
public function jschars($str) {
|
208 |
+
$str = mb_ereg_replace("\\\\", "\\\\", $str);
|
209 |
+
$str = mb_ereg_replace("\"", "\\\"", $str);
|
210 |
+
$str = mb_ereg_replace("'", "\\'", $str);
|
211 |
+
$str = mb_ereg_replace("\r\n", "\\n", $str);
|
212 |
+
$str = mb_ereg_replace("\r", "\\n", $str);
|
213 |
+
$str = mb_ereg_replace("\n", "\\n", $str);
|
214 |
+
$str = mb_ereg_replace("\t", "\\t", $str);
|
215 |
+
$str = mb_ereg_replace("<", "\\x3C", $str);
|
216 |
+
$str = mb_ereg_replace(">", "\\x3E", $str);
|
217 |
+
return $str;
|
218 |
+
}
|
219 |
+
|
220 |
+
public function searchProductByTag($keyword) {
|
221 |
+
$result = array();
|
222 |
+
if(Mage::getStoreConfig('searchautocomplete/general/search_by_tag')) {
|
223 |
+
$model = Mage::getModel('tag/tag');
|
224 |
+
$tag_collections = $model->getResourceCollection()
|
225 |
+
->addPopularity()
|
226 |
+
->addStatusFilter($model->getApprovedStatus())
|
227 |
+
->addFieldToFilter("name",array('like'=>'%'. $keyword.'%'))
|
228 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
229 |
+
->setActiveFilter()
|
230 |
+
->load();
|
231 |
+
if(count($tag_collections)) {
|
232 |
+
foreach($tag_collections as $tag) {
|
233 |
+
$products = $this->getProductListByTagId($tag->getId());
|
234 |
+
if(count($products))
|
235 |
+
{
|
236 |
+
foreach($products as $product)
|
237 |
+
{
|
238 |
+
$result[] = $product->getId();
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
return $result;
|
245 |
+
}
|
246 |
+
|
247 |
+
public function getProductListByTagId($tagId) {
|
248 |
+
$tagModel = Mage::getModel('tag/tag');
|
249 |
+
$collections = $tagModel->getEntityCollection()
|
250 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
251 |
+
->addTagFilter($tagId)
|
252 |
+
->addStoreFilter()
|
253 |
+
->addMinimalPrice()
|
254 |
+
->addUrlRewrite()
|
255 |
+
->setActiveFilter();
|
256 |
+
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collections);
|
257 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collections);
|
258 |
+
|
259 |
+
return $collections;
|
260 |
+
}
|
261 |
+
}
|
app/code/local/Magebuzz/Searchautocomplete/Model/Source/Product/Attribute.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2014 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Searchautocomplete_Model_Source_Product_Attribute {
|
6 |
+
public static $_entityTypeId;
|
7 |
+
public static $_productAttributes;
|
8 |
+
public static $_productAttributeOptions;
|
9 |
+
|
10 |
+
public static function getProductAttributeList() {
|
11 |
+
if(is_array(self::$_productAttributes))
|
12 |
+
return self::$_productAttributes;
|
13 |
+
|
14 |
+
$resource = Mage::getSingleton('core/resource');
|
15 |
+
$db = $resource->getConnection('core_read');
|
16 |
+
|
17 |
+
$select = $db->select()
|
18 |
+
->from($resource->getTableName('eav/entity_type'), 'entity_type_id')
|
19 |
+
->where('entity_type_code=?', 'catalog_product')
|
20 |
+
->limit(1);
|
21 |
+
|
22 |
+
self::$_entityTypeId = $db->fetchOne($select);
|
23 |
+
|
24 |
+
$select = $db->select()
|
25 |
+
->from($resource->getTableName('eav/attribute'), array(
|
26 |
+
'title' => 'frontend_label', // for admin part
|
27 |
+
'id' => 'attribute_id', // for applying filter to collection
|
28 |
+
'code' => 'attribute_code', // as a tip for constructing {attribute_name}
|
29 |
+
'type' => 'backend_type', // for table name
|
30 |
+
))
|
31 |
+
->where('entity_type_id=?', self::$_entityTypeId)
|
32 |
+
->where('frontend_label<>""')
|
33 |
+
->orWhere('attribute_code=?', "manufacturer") //add new attribute in backend
|
34 |
+
->where('find_in_set(backend_type, "text,varchar,static")')
|
35 |
+
->order('frontend_label');
|
36 |
+
foreach($db->fetchAll($select) as $v)
|
37 |
+
self::$_productAttributes[$v['id']] = array(
|
38 |
+
'title' => $v['title'],
|
39 |
+
'code' => $v['code'],
|
40 |
+
'type' => $v['type'],
|
41 |
+
);
|
42 |
+
|
43 |
+
return self::$_productAttributes;
|
44 |
+
}
|
45 |
+
|
46 |
+
public static function getProductIds2($query, $storeId) {
|
47 |
+
$resource = Mage::getSingleton('core/resource');
|
48 |
+
$db = $resource->getConnection('core_read');
|
49 |
+
$select = $db->select();
|
50 |
+
$fullTextTable = $resource->getTableName('catalogsearch/fulltext');
|
51 |
+
$select->from($fullTextTable)
|
52 |
+
->where('store_id = ?',$storeId)
|
53 |
+
->where('data_index LIKE "%'.$query.'%"');
|
54 |
+
$result = $db->fetchCol($select);
|
55 |
+
return $result;
|
56 |
+
}
|
57 |
+
|
58 |
+
public static function getProductIds($attributes, $attrValues, $storeId) {
|
59 |
+
$ids = array();
|
60 |
+
if(empty($attributes)) return $ids;
|
61 |
+
$resource = Mage::getSingleton('core/resource');
|
62 |
+
$db = $resource->getConnection('core_read');
|
63 |
+
|
64 |
+
// list of tables used for selecting
|
65 |
+
$usedTables = array();
|
66 |
+
foreach($attributes as $attrId => $attrType)
|
67 |
+
$usedTables[$attrType] = true;
|
68 |
+
|
69 |
+
foreach(array_keys($usedTables) as $tableName)
|
70 |
+
{
|
71 |
+
if ($tableName != 'static') {
|
72 |
+
$select = $db->select();
|
73 |
+
if ($tableName == 'int') {
|
74 |
+
$eaov = $resource->getTableName('eav/attribute_option_value');
|
75 |
+
$cpei = $resource->getTableName('catalog/product') . '_' . $tableName;
|
76 |
+
//SQL
|
77 |
+
// SELECT cpei.entity_id from catalog_product_entity_int AS cpei
|
78 |
+
// JOIN eav_attribute_option_value AS eaov
|
79 |
+
// ON cpei.`value` = eaov.option_id
|
80 |
+
// WHERE eaov.`value` Like '%str%'
|
81 |
+
$select->from(array('cpei' => $cpei), array('cpei.entity_id'))
|
82 |
+
->join(array('eaov' => $eaov), 'cpei.`value` = eaov.option_id', array())
|
83 |
+
->where('cpei.entity_type_id=?', self::$_entityTypeId)
|
84 |
+
->where('cpei.store_id=0 OR cpei.store_id=?', $storeId)
|
85 |
+
->where('cpei.attribute_id IN (' . implode(',', array_keys($attributes)) . ')');
|
86 |
+
foreach ($attrValues as $value)
|
87 |
+
$select ->where('eaov.`value` LIKE "%' . addslashes($value) . '%"');
|
88 |
+
|
89 |
+
}else{
|
90 |
+
$select->distinct()
|
91 |
+
->from($resource->getTableName('catalog/product') . '_' . $tableName, 'entity_id')
|
92 |
+
->where('entity_type_id=?', self::$_entityTypeId)
|
93 |
+
->where('store_id=0 OR store_id=?', $storeId)
|
94 |
+
->where('attribute_id IN (' . implode(',', array_keys($attributes)) . ')');
|
95 |
+
foreach ($attrValues as $value)
|
96 |
+
$select->where('`value` LIKE "%' . addslashes($value) . '%"');
|
97 |
+
}
|
98 |
+
$ids = array_merge($ids, $db->fetchCol($select));
|
99 |
+
}
|
100 |
+
if ($tableName == 'static') {
|
101 |
+
$select = $db->select();
|
102 |
+
$select->distinct()
|
103 |
+
->from($resource->getTableName('catalog/product'), 'entity_id')
|
104 |
+
->where('entity_type_id=?', self::$_entityTypeId);
|
105 |
+
foreach ($attrValues as $value)
|
106 |
+
$select->where('`sku` LIKE "%' . addslashes($value) . '%"');
|
107 |
+
|
108 |
+
$ids = array_merge($ids, $db->fetchCol($select));
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if(!(Mage::getStoreConfig('searchautocomplete/display_setting/show_out_of_stock'))&& !empty($ids)){
|
112 |
+
$select = $db->select();
|
113 |
+
|
114 |
+
$select
|
115 |
+
->from($resource->getTableName('cataloginventory/stock_status'), 'product_id')
|
116 |
+
->where('product_id IN ('.implode(',',$ids).') AND stock_status = 1');
|
117 |
+
|
118 |
+
$ids = $db->fetchCol($select);
|
119 |
+
}
|
120 |
+
return array_unique($ids);
|
121 |
+
}
|
122 |
+
|
123 |
+
public static function toOptionArray()
|
124 |
+
{
|
125 |
+
if(is_array(self::$_productAttributeOptions)) return self::$_productAttributeOptions;
|
126 |
+
|
127 |
+
self::$_productAttributeOptions = array();
|
128 |
+
|
129 |
+
foreach(self::getProductAttributeList() as $id => $data)
|
130 |
+
self::$_productAttributeOptions[] = array(
|
131 |
+
'value' => $id,
|
132 |
+
'label' => $data['title'].' ('.$data['code'].')'
|
133 |
+
);
|
134 |
+
return self::$_productAttributeOptions;
|
135 |
+
}
|
136 |
+
}
|
app/code/local/Magebuzz/Searchautocomplete/controllers/IndexController.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2014 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Searchautocomplete_IndexController extends Mage_Core_Controller_Front_Action {
|
6 |
+
public function indexAction(){
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function ajaxsearchAction() {
|
12 |
+
$html = "";
|
13 |
+
$keyword = urldecode($this->getRequest()->getParam('keyword'));
|
14 |
+
$_coreHelper = Mage::helper('core');
|
15 |
+
$limitCharDesc = Mage::helper("searchautocomplete")->getLimitCharProductDesc();
|
16 |
+
/* Get all ids */
|
17 |
+
$productIds = Mage::helper("searchautocomplete")->getSearchResults($keyword);
|
18 |
+
if(count($productIds) > 0) {
|
19 |
+
$html .= "<ul class='list-products'>";
|
20 |
+
foreach($productIds as $productId)
|
21 |
+
{
|
22 |
+
$product = Mage::getModel("catalog/product")->load($productId);
|
23 |
+
$html .= "<li class='item product' onclick=\"location.href='".$product->getProductUrl()."'\">";
|
24 |
+
$html .= "<div class='product-info'>";
|
25 |
+
$price = $_coreHelper->currency($product->getPrice(),true,false);
|
26 |
+
$productUrl = $product->getProductUrl();
|
27 |
+
$productName = $product->getName();
|
28 |
+
$productDesc = $product->getShortDescription();
|
29 |
+
if(Mage::helper('searchautocomplete')->isShowThumbnailImage()){
|
30 |
+
$img = Mage::helper('catalog/image')->init($product, 'image')->resize(Mage::helper('searchautocomplete')->getThumbnailImageSize());
|
31 |
+
$img = $img->__toString();
|
32 |
+
$html .= "<a class='product-img' href='".$productUrl."' title='".$productName."' alt='".$productName."' target='_blank'><img src='". $img ."' title='".$productName."'></a>";
|
33 |
+
}
|
34 |
+
$html .= "<div class='product-desc'>";
|
35 |
+
$html .= "<h3 class='product-name'><a href='".$productUrl."' title='".$productName."' target='_blank'>".$productName."</a></h3>";
|
36 |
+
if(Mage::helper('searchautocomplete')->isShowProductDesc()){
|
37 |
+
$html .= "<p class='desc'>".Mage::helper('searchautocomplete')->setLimitChar($productDesc,$limitCharDesc)."</p>";
|
38 |
+
}
|
39 |
+
$productBlock = new Mage_Catalog_Block_Product;
|
40 |
+
$priceHtml = $this->getLayout()->createBlock('core/template')->setTemplate('searchautocomplete/product/price.phtml')->setProduct($product)->toHtml();
|
41 |
+
$html .= "<div class='product-price'>".$priceHtml."</div>";
|
42 |
+
unset($productBlock);
|
43 |
+
$html .= "</div>";
|
44 |
+
$html .= "</div>";
|
45 |
+
$html .= "</li>";
|
46 |
+
}
|
47 |
+
$html .= "</ul>";
|
48 |
+
}
|
49 |
+
$responseHtml = array('html' => $html);
|
50 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseHtml));
|
51 |
+
}
|
52 |
+
}
|
app/code/local/Magebuzz/Searchautocomplete/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<searchautocomplete translate="title">
|
15 |
+
<title>Searchautocomplete Permission Setting</title>
|
16 |
+
<sort_order>50</sort_order>
|
17 |
+
</searchautocomplete>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/local/Magebuzz/Searchautocomplete/etc/config.xml
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Searchautocomplete>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Magebuzz_Searchautocomplete>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<secure_url>
|
10 |
+
<searchautocomplete>/searchautocomplete/</searchautocomplete>
|
11 |
+
</secure_url>
|
12 |
+
<routers>
|
13 |
+
<searchautocomplete>
|
14 |
+
<use>standard</use>
|
15 |
+
<args>
|
16 |
+
<module>Magebuzz_Searchautocomplete</module>
|
17 |
+
<frontName>searchautocomplete</frontName>
|
18 |
+
</args>
|
19 |
+
</searchautocomplete>
|
20 |
+
</routers>
|
21 |
+
<layout>
|
22 |
+
<updates>
|
23 |
+
<searchautocomplete>
|
24 |
+
<file>searchautocomplete.xml</file>
|
25 |
+
</searchautocomplete>
|
26 |
+
</updates>
|
27 |
+
</layout>
|
28 |
+
<translate>
|
29 |
+
<modules>
|
30 |
+
<Magebuzz_Searchautocomplete>
|
31 |
+
<files>
|
32 |
+
<default>Magebuzz_Searchautocomplete.csv</default>
|
33 |
+
</files>
|
34 |
+
</Magebuzz_Searchautocomplete>
|
35 |
+
</modules>
|
36 |
+
</translate>
|
37 |
+
</frontend>
|
38 |
+
<admin>
|
39 |
+
<routers>
|
40 |
+
<searchautocomplete>
|
41 |
+
<use>admin</use>
|
42 |
+
<args>
|
43 |
+
<module>Magebuzz_Searchautocomplete</module>
|
44 |
+
<frontName>searchautocomplete</frontName>
|
45 |
+
</args>
|
46 |
+
</searchautocomplete>
|
47 |
+
</routers>
|
48 |
+
</admin>
|
49 |
+
<adminhtml>
|
50 |
+
<layout>
|
51 |
+
<updates>
|
52 |
+
<searchautocomplete>
|
53 |
+
<file>searchautocomplete.xml</file>
|
54 |
+
</searchautocomplete>
|
55 |
+
</updates>
|
56 |
+
</layout>
|
57 |
+
<translate>
|
58 |
+
<modules>
|
59 |
+
<Magebuzz_Searchautocomplete>
|
60 |
+
<files>
|
61 |
+
<default>Magebuzz_Searchautocomplete.csv</default>
|
62 |
+
</files>
|
63 |
+
</Magebuzz_Searchautocomplete>
|
64 |
+
</modules>
|
65 |
+
</translate>
|
66 |
+
</adminhtml>
|
67 |
+
<global>
|
68 |
+
<models>
|
69 |
+
<searchautocomplete>
|
70 |
+
<class>Magebuzz_Searchautocomplete_Model</class>
|
71 |
+
<resourceModel>searchautocomplete_mysql4</resourceModel>
|
72 |
+
</searchautocomplete>
|
73 |
+
<searchautocomplete_mysql4>
|
74 |
+
<class>Magebuzz_Searchautocomplete_Model_Mysql4</class>
|
75 |
+
<entities>
|
76 |
+
<searchautocomplete>
|
77 |
+
<table>searchautocomplete</table>
|
78 |
+
</searchautocomplete>
|
79 |
+
</entities>
|
80 |
+
</searchautocomplete_mysql4>
|
81 |
+
</models>
|
82 |
+
<blocks>
|
83 |
+
<searchautocomplete>
|
84 |
+
<class>Magebuzz_Searchautocomplete_Block</class>
|
85 |
+
</searchautocomplete>
|
86 |
+
</blocks>
|
87 |
+
<helpers>
|
88 |
+
<searchautocomplete>
|
89 |
+
<class>Magebuzz_Searchautocomplete_Helper</class>
|
90 |
+
</searchautocomplete>
|
91 |
+
</helpers>
|
92 |
+
<template>
|
93 |
+
<email>
|
94 |
+
<searchautocomplete_general_email_template>
|
95 |
+
<label>Title Email</label>
|
96 |
+
<file>searchautocomplete_example.html</file>
|
97 |
+
<type>html</type>
|
98 |
+
</searchautocomplete_general_email_template>
|
99 |
+
</email>
|
100 |
+
</template>
|
101 |
+
</global>
|
102 |
+
<default>
|
103 |
+
<searchautocomplete>
|
104 |
+
<general>
|
105 |
+
<is_active>1</is_active>
|
106 |
+
<min_character>3</min_character>
|
107 |
+
<searchable_attributes>97,96</searchable_attributes>
|
108 |
+
<search_by_tag>1</search_by_tag>
|
109 |
+
</general>
|
110 |
+
<display_setting>
|
111 |
+
<number_results>10</number_results>
|
112 |
+
<show_out_of_stock>0</show_out_of_stock>
|
113 |
+
<search_result_heading><![CDATA[See more results for "<span class="keyword">{{keyword}}</span>"]]></search_result_heading>
|
114 |
+
<is_show_thumbnail>1</is_show_thumbnail>
|
115 |
+
<thumbnail_product_image_size>60</thumbnail_product_image_size>
|
116 |
+
<is_show_description>0</is_show_description>
|
117 |
+
<limit_character_product_desc>120</limit_character_product_desc>
|
118 |
+
</display_setting>
|
119 |
+
</searchautocomplete>
|
120 |
+
</default>
|
121 |
+
</config>
|
app/code/local/Magebuzz/Searchautocomplete/etc/system.xml
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<magebuzz translate="label">
|
5 |
+
<label>Magebuzz Extension</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</magebuzz>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<searchautocomplete translate="label" module="searchautocomplete">
|
11 |
+
<label>Search Autocomplete</label>
|
12 |
+
<tab>magebuzz</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>299</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 |
+
<general translate="label">
|
20 |
+
<label>General Setting</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<is_active translate="label comment">
|
28 |
+
<label>Enable Search Autocomplete</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</is_active>
|
36 |
+
<min_character translate="label comment">
|
37 |
+
<label>Minimum of characters to start search</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>3</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
<comment>Searches after the minimum characters has been entered</comment>
|
44 |
+
</min_character>
|
45 |
+
<searchable_attributes translate="label">
|
46 |
+
<label>Search by attributes</label>
|
47 |
+
<frontend_type>multiselect</frontend_type>
|
48 |
+
<source_model>searchautocomplete/source_product_attribute</source_model>
|
49 |
+
<sort_order>4</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
<can_be_empty>1</can_be_empty>
|
54 |
+
<comment>Select product attribute to search. Default: Description, Name</comment>
|
55 |
+
</searchable_attributes>
|
56 |
+
<search_by_tag translate="label comment">
|
57 |
+
<label>Search by tags</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<sort_order>5</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</search_by_tag>
|
65 |
+
</fields>
|
66 |
+
</general>
|
67 |
+
<display_setting translate="label">
|
68 |
+
<label>Display Setting</label>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>3</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<fields>
|
75 |
+
<number_results translate="label comment">
|
76 |
+
<label>Number of results</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>1</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
<comment>Number of products to display</comment>
|
83 |
+
</number_results>
|
84 |
+
<show_out_of_stock>
|
85 |
+
<label>Show out of stock products</label>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<sort_order>2</sort_order>
|
88 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</show_out_of_stock>
|
94 |
+
<search_result_heading translate="label">
|
95 |
+
<label>Search result heading</label>
|
96 |
+
<frontend_type>textarea</frontend_type>
|
97 |
+
<sort_order>3</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
<comment>{{keyword}} will be replaced by the keyword which is searched by customer</comment>
|
102 |
+
</search_result_heading>
|
103 |
+
<is_show_thumbnail>
|
104 |
+
<label>Show product thumbnail image</label>
|
105 |
+
<frontend_type>select</frontend_type>
|
106 |
+
<sort_order>4</sort_order>
|
107 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</is_show_thumbnail>
|
113 |
+
<thumbnail_product_image_size translate="label">
|
114 |
+
<label>Width of thumbnail image</label>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<sort_order>5</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 |
+
<depends><is_show_thumbnail>1</is_show_thumbnail></depends>
|
121 |
+
</thumbnail_product_image_size>
|
122 |
+
<is_show_description translate="label comment">
|
123 |
+
<label>Show product description</label>
|
124 |
+
<frontend_type>select</frontend_type>
|
125 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
126 |
+
<sort_order>6</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>1</show_in_store>
|
130 |
+
</is_show_description>
|
131 |
+
<limit_character_product_desc translate="label">
|
132 |
+
<label>Limit characters in product description</label>
|
133 |
+
<frontend_type>text</frontend_type>
|
134 |
+
<sort_order>7</sort_order>
|
135 |
+
<show_in_default>1</show_in_default>
|
136 |
+
<show_in_website>1</show_in_website>
|
137 |
+
<show_in_store>1</show_in_store>
|
138 |
+
<depends><is_show_description>1</is_show_description></depends>
|
139 |
+
<comment></comment>
|
140 |
+
</limit_character_product_desc>
|
141 |
+
</fields>
|
142 |
+
</display_setting>
|
143 |
+
</groups>
|
144 |
+
</searchautocomplete>
|
145 |
+
</sections>
|
146 |
+
</config>
|
app/design/frontend/base/default/layout/searchautocomplete.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs"><script>magebuzz/searchautocomplete/ajaxsearch.js</script></action>
|
6 |
+
<action method="addCss"><stylesheet>css/magebuzz/searchautocomplete.css</stylesheet></action>
|
7 |
+
</reference>
|
8 |
+
<reference name="top.search">
|
9 |
+
<action method="setTemplate" ifconfig="searchautocomplete/general/is_active">
|
10 |
+
<template>searchautocomplete/form.phtml</template>
|
11 |
+
</action>
|
12 |
+
</reference>
|
13 |
+
</default>
|
14 |
+
<searchautocomplete_index_index>
|
15 |
+
<reference name="content">
|
16 |
+
<block type="searchautocomplete/searchautocomplete" name="searchautocomplete" template="searchautocomplete/searchautocomplete.phtml" />
|
17 |
+
</reference>
|
18 |
+
</searchautocomplete_index_index>
|
19 |
+
</layout>
|
app/design/frontend/base/default/template/searchautocomplete/form.phtml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2014 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<?php
|
7 |
+
$_helper = Mage::helper('searchautocomplete');
|
8 |
+
$catalogSearchHelper = $this->helper('catalogsearch');
|
9 |
+
?>
|
10 |
+
<form id="searchautocomplete_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
|
11 |
+
<div class="form-search">
|
12 |
+
<label for="search"><?php echo $this->__('Search:') ?></label>
|
13 |
+
<input id="search_input" type="text" name="keyword" value="" class="input-text" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" />
|
14 |
+
<input id="search" type="hidden" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="" class="input-text" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" />
|
15 |
+
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
|
16 |
+
<div id="search_autocomplete" class="search-autocomplete"></div>
|
17 |
+
<script type="text/javascript">
|
18 |
+
//<![CDATA[
|
19 |
+
var searchForm = new Varien.searchForm('searchautocomplete_form', 'search_input', '<?php echo $this->__('Search entire store here...') ?>');
|
20 |
+
//]]>
|
21 |
+
</script>
|
22 |
+
</div>
|
23 |
+
</form>
|
24 |
+
<?php if($_helper->isActive()):?>
|
25 |
+
<div id="boxResults" style="display:none;">
|
26 |
+
<a class="close-dropdown" href="javascript://" onclick="closeSearchResultBox()" title="<?php echo $this->__('Close')?>" alt="<?php echo $this->__('Close')?>">X</a>
|
27 |
+
<div id="listResults" style="display:none;">
|
28 |
+
</div>
|
29 |
+
<div id="resultNotice">
|
30 |
+
<label id="resultLabel">Search result</label>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<script type="text/javascript">
|
34 |
+
var ajaxsearch = new SearchAutocomplete(
|
35 |
+
'<?php echo $this->getUrl('searchautocomplete/index/ajaxsearch') ?>',
|
36 |
+
'<?php echo $catalogSearchHelper->getResultUrl() ?>',
|
37 |
+
'<?php echo Mage::helper('searchautocomplete')->getSearchResultHeading()?>',
|
38 |
+
'search_input',
|
39 |
+
'<?php echo Mage::helper('searchautocomplete')->__('No results for')?>'
|
40 |
+
);
|
41 |
+
var min_character = <?php echo Mage::getStoreConfig('searchautocomplete/general/min_character')?>;
|
42 |
+
Event.observe('search_input', 'keyup', function(event){
|
43 |
+
var searchBox = $('search_input');
|
44 |
+
if(searchBox.value.length >= min_character){
|
45 |
+
ajaxsearch.search();
|
46 |
+
}
|
47 |
+
$('search').value = searchBox.value;
|
48 |
+
});
|
49 |
+
function closeSearchResultBox() {
|
50 |
+
var boxResults = $('boxResults');
|
51 |
+
boxResults.style.display = "none";
|
52 |
+
}
|
53 |
+
</script>
|
54 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/searchautocomplete/product/price.phtml
ADDED
@@ -0,0 +1,474 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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@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 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<?php
|
29 |
+
/**
|
30 |
+
* Template for displaying product price in different places (products grid, product view page etc)
|
31 |
+
*
|
32 |
+
* @see Mage_Catalog_Block_Product_Abstract
|
33 |
+
*/
|
34 |
+
?>
|
35 |
+
<?php
|
36 |
+
$_coreHelper = $this->helper('core');
|
37 |
+
$_weeeHelper = $this->helper('weee');
|
38 |
+
$_taxHelper = $this->helper('tax');
|
39 |
+
/* @var $_coreHelper Mage_Core_Helper_Data */
|
40 |
+
/* @var $_weeeHelper Mage_Weee_Helper_Data */
|
41 |
+
/* @var $_taxHelper Mage_Tax_Helper_Data */
|
42 |
+
|
43 |
+
$_product = $this->getProduct();
|
44 |
+
$_storeId = $_product->getStoreId();
|
45 |
+
$_store = $_product->getStore();
|
46 |
+
$_id = $_product->getId();
|
47 |
+
$_weeeSeparator = '';
|
48 |
+
$_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
|
49 |
+
$_minimalPriceValue = $_product->getMinimalPrice();
|
50 |
+
$_minimalPriceValue = $_store->roundPrice($_store->convertPrice($_minimalPriceValue));
|
51 |
+
$_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax);
|
52 |
+
$_convertedFinalPrice = $_store->roundPrice($_store->convertPrice($_product->getFinalPrice()));
|
53 |
+
$_specialPriceStoreLabel = '';
|
54 |
+
if ($this->getProductAttribute('special_price')) {
|
55 |
+
$_specialPriceStoreLabel = $this->getProductAttribute('special_price')->getStoreLabel();
|
56 |
+
}
|
57 |
+
?>
|
58 |
+
|
59 |
+
<?php if (!$_product->isGrouped()): ?>
|
60 |
+
<?php $_weeeTaxAmount = $_weeeHelper->getAmountForDisplay($_product); ?>
|
61 |
+
<?php $_weeeTaxAttributes = $_weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, null, true); ?>
|
62 |
+
<?php $_weeeTaxAmountInclTaxes = $_weeeTaxAmount; ?>
|
63 |
+
<?php if ($_weeeHelper->isTaxable()): ?>
|
64 |
+
<?php $_weeeTaxAmountInclTaxes = $_weeeHelper->getAmountInclTaxes($_weeeTaxAttributes); ?>
|
65 |
+
<?php endif; ?>
|
66 |
+
<?php $_weeeTaxAmount = $_store->roundPrice($_store->convertPrice($_weeeTaxAmount)); ?>
|
67 |
+
<?php $_weeeTaxAmountInclTaxes = $_store->roundPrice($_store->convertPrice($_weeeTaxAmountInclTaxes)); ?>
|
68 |
+
|
69 |
+
<div class="price-box">
|
70 |
+
<?php $_convertedPrice = $_store->roundPrice($_store->convertPrice($_product->getPrice())); ?>
|
71 |
+
<?php $_price = $_taxHelper->getPrice($_product, $_convertedPrice); ?>
|
72 |
+
<?php $_regularPrice = $_taxHelper->getPrice($_product, $_convertedPrice, $_simplePricesTax); ?>
|
73 |
+
<?php $_finalPrice = $_taxHelper->getPrice($_product, $_convertedFinalPrice) ?>
|
74 |
+
<?php $_finalPriceInclTax = $_taxHelper->getPrice($_product, $_convertedFinalPrice, true) ?>
|
75 |
+
<?php $_weeeDisplayType = $_weeeHelper->getPriceDisplayType(); ?>
|
76 |
+
<?php if ($_finalPrice >= $_price): ?>
|
77 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
78 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
|
79 |
+
<span class="price-excluding-tax">
|
80 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
81 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
82 |
+
<?php echo $_coreHelper->formatPrice($_price + $_weeeTaxAmount, false) ?>
|
83 |
+
</span>
|
84 |
+
</span>
|
85 |
+
<span class="price-including-tax">
|
86 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
87 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
88 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
89 |
+
</span>
|
90 |
+
</span>
|
91 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
|
92 |
+
<span class="price-excluding-tax">
|
93 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
94 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
95 |
+
<?php echo $_coreHelper->formatPrice($_price + $_weeeTaxAmount, false) ?>
|
96 |
+
</span>
|
97 |
+
</span>
|
98 |
+
<span class="weee">(
|
99 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
100 |
+
<?php echo $_weeeSeparator; ?>
|
101 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
102 |
+
<?php $_weeeSeparator = ' + '; ?>
|
103 |
+
<?php endforeach; ?>
|
104 |
+
)</span>
|
105 |
+
<span class="price-including-tax">
|
106 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
107 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
108 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
109 |
+
</span>
|
110 |
+
</span>
|
111 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
112 |
+
<span class="price-excluding-tax">
|
113 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
114 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
115 |
+
<?php echo $_coreHelper->formatPrice($_price + $_weeeTaxAmount, false) ?>
|
116 |
+
</span>
|
117 |
+
</span>
|
118 |
+
<span class="price-including-tax">
|
119 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
120 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
121 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
122 |
+
</span>
|
123 |
+
<span class="weee">(
|
124 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
125 |
+
<?php echo $_weeeSeparator; ?>
|
126 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
127 |
+
<?php $_weeeSeparator = ' + '; ?>
|
128 |
+
<?php endforeach; ?>
|
129 |
+
)</span>
|
130 |
+
</span>
|
131 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
132 |
+
<span class="price-excluding-tax">
|
133 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
134 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
135 |
+
<?php echo $_coreHelper->formatPrice($_price, false) ?>
|
136 |
+
</span>
|
137 |
+
</span>
|
138 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
139 |
+
<span class="weee">
|
140 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
141 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
142 |
+
</span>
|
143 |
+
<?php endforeach; ?>
|
144 |
+
<span class="price-including-tax">
|
145 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
146 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
147 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
148 |
+
</span>
|
149 |
+
</span>
|
150 |
+
<?php else: ?>
|
151 |
+
<span class="price-excluding-tax">
|
152 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
153 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
154 |
+
<?php if ($_finalPrice == $_price): ?>
|
155 |
+
<?php echo $_coreHelper->formatPrice($_price, false) ?>
|
156 |
+
<?php else: ?>
|
157 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice, false) ?>
|
158 |
+
<?php endif; ?>
|
159 |
+
</span>
|
160 |
+
</span>
|
161 |
+
<span class="price-including-tax">
|
162 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
163 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
164 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax, false) ?>
|
165 |
+
</span>
|
166 |
+
</span>
|
167 |
+
<?php endif; ?>
|
168 |
+
<?php else: ?>
|
169 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1))): // including ?>
|
170 |
+
<?php $weeeAmountToDisplay = $_taxHelper->displayPriceIncludingTax() ? $_weeeTaxAmountInclTaxes : $_weeeTaxAmount ?>
|
171 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
172 |
+
<?php echo $_coreHelper->currency($_price + $weeeAmountToDisplay, true, true) ?>
|
173 |
+
</span>
|
174 |
+
|
175 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // show description ?>
|
176 |
+
<span class="weee">(
|
177 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
178 |
+
<?php echo $_weeeSeparator; ?>
|
179 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
180 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + ($_taxHelper->displayPriceIncludingTax() ? $_weeeTaxAttribute->getTaxAmount() : 0), true, true); ?>
|
181 |
+
<?php $_weeeSeparator = ' + '; ?>
|
182 |
+
<?php endforeach; ?>
|
183 |
+
)</span>
|
184 |
+
<?php endif; ?>
|
185 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
186 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
187 |
+
<?php echo $_coreHelper->formatPrice($_price + $_weeeTaxAmount, true) ?>
|
188 |
+
</span>
|
189 |
+
<span class="weee">(
|
190 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
191 |
+
<?php echo $_weeeSeparator; ?>
|
192 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
193 |
+
<?php $_weeeSeparator = ' + '; ?>
|
194 |
+
<?php endforeach; ?>
|
195 |
+
)</span>
|
196 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
197 |
+
<span class="regular-price"><?php echo $_coreHelper->formatPrice($_price, true) ?></span><br/>
|
198 |
+
<?php $weeeAmountToDisplay = $_taxHelper->displayPriceIncludingTax() ? $_weeeTaxAmountInclTaxes : $_weeeTaxAmount ?>
|
199 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
200 |
+
<span class="weee">
|
201 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
202 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + ($_taxHelper->displayPriceIncludingTax() ? $_weeeTaxAttribute->getTaxAmount() : 0), true, true); ?>
|
203 |
+
</span>
|
204 |
+
<?php endforeach; ?>
|
205 |
+
<span class="regular-price"
|
206 |
+
id="product-price-weee-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
207 |
+
<?php echo $_coreHelper->currency($_price + $weeeAmountToDisplay, true, true) ?>
|
208 |
+
</span>
|
209 |
+
<?php else: ?>
|
210 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
211 |
+
<?php if ($_finalPrice == $_price): ?>
|
212 |
+
<?php echo $_coreHelper->formatPrice($_price, true) ?>
|
213 |
+
<?php else: ?>
|
214 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
|
215 |
+
<?php endif; ?>
|
216 |
+
</span>
|
217 |
+
<?php endif; ?>
|
218 |
+
<?php endif; ?>
|
219 |
+
<?php else: /* if ($_finalPrice == $_price): */ ?>
|
220 |
+
<?php $_originalWeeeTaxAmount = $_weeeHelper->getOriginalAmount($_product); ?>
|
221 |
+
<?php $_originalWeeeTaxAmount = $_store->roundPrice($_store->convertPrice($_originalWeeeTaxAmount)) ?>
|
222 |
+
|
223 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
|
224 |
+
<p class="old-price">
|
225 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
226 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
227 |
+
<?php echo $_coreHelper->formatPrice($_regularPrice + $_originalWeeeTaxAmount, false) ?>
|
228 |
+
</span>
|
229 |
+
</p>
|
230 |
+
|
231 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
232 |
+
<p class="special-price">
|
233 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
234 |
+
<span class="price-excluding-tax">
|
235 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
236 |
+
<span class="price"
|
237 |
+
id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
238 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice + $_weeeTaxAmount, false) ?>
|
239 |
+
</span>
|
240 |
+
</span>
|
241 |
+
<span class="price-including-tax">
|
242 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
243 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
244 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
245 |
+
</span>
|
246 |
+
</span>
|
247 |
+
</p>
|
248 |
+
<?php else: ?>
|
249 |
+
<p class="special-price">
|
250 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
251 |
+
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
252 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice + $_weeeTaxAmountInclTaxes, false) ?>
|
253 |
+
</span>
|
254 |
+
</p>
|
255 |
+
<?php endif; ?>
|
256 |
+
|
257 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
|
258 |
+
<p class="old-price">
|
259 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
260 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
261 |
+
<?php echo $_coreHelper->formatPrice($_regularPrice + $_originalWeeeTaxAmount, false) ?>
|
262 |
+
</span>
|
263 |
+
</p>
|
264 |
+
|
265 |
+
<p class="special-price">
|
266 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
267 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
268 |
+
<span class="price-excluding-tax">
|
269 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
270 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
271 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice + $_weeeTaxAmount, false) ?>
|
272 |
+
</span>
|
273 |
+
</span>
|
274 |
+
<span class="weee">(
|
275 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
276 |
+
<?php echo $_weeeSeparator; ?>
|
277 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
278 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
279 |
+
<?php $_weeeSeparator = ' + '; ?>
|
280 |
+
<?php endforeach; ?>
|
281 |
+
)</span>
|
282 |
+
<span class="price-including-tax">
|
283 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
284 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
285 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
286 |
+
</span>
|
287 |
+
</span>
|
288 |
+
<?php else: ?>
|
289 |
+
<p class="special-price">
|
290 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
291 |
+
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
292 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice + $_weeeTaxAmountInclTaxes, false) ?>
|
293 |
+
</span>
|
294 |
+
</p>
|
295 |
+
<span class="weee">(
|
296 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
297 |
+
<?php echo $_weeeSeparator; ?>
|
298 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
299 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
300 |
+
<?php $_weeeSeparator = ' + '; ?>
|
301 |
+
<?php endforeach; ?>
|
302 |
+
)</span>
|
303 |
+
<?php endif; ?>
|
304 |
+
</p>
|
305 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
306 |
+
<p class="old-price">
|
307 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
308 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
309 |
+
<?php echo $_coreHelper->formatPrice($_regularPrice + $_originalWeeeTaxAmount, false) ?>
|
310 |
+
</span>
|
311 |
+
</p>
|
312 |
+
|
313 |
+
<p class="special-price">
|
314 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
315 |
+
<span class="price-excluding-tax">
|
316 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
317 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
318 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice + $_weeeTaxAmount, false) ?>
|
319 |
+
</span>
|
320 |
+
</span>
|
321 |
+
<span class="weee">(
|
322 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
323 |
+
<?php echo $_weeeSeparator; ?>
|
324 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
325 |
+
<?php $_weeeSeparator = ' + '; ?>
|
326 |
+
<?php endforeach; ?>
|
327 |
+
)</span>
|
328 |
+
<span class="price-including-tax">
|
329 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
330 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
331 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
332 |
+
</span>
|
333 |
+
</span>
|
334 |
+
</p>
|
335 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
336 |
+
<p class="old-price">
|
337 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
338 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
339 |
+
<?php echo $_coreHelper->formatPrice($_regularPrice, false) ?>
|
340 |
+
</span>
|
341 |
+
</p>
|
342 |
+
|
343 |
+
<p class="special-price">
|
344 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
345 |
+
<span class="price-excluding-tax">
|
346 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
347 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
348 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice, false) ?>
|
349 |
+
</span>
|
350 |
+
</span>
|
351 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
352 |
+
<span class="weee">
|
353 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>
|
354 |
+
: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
355 |
+
</span>
|
356 |
+
<?php endforeach; ?>
|
357 |
+
<span class="price-including-tax">
|
358 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
359 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
360 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, false) ?>
|
361 |
+
</span>
|
362 |
+
</span>
|
363 |
+
</p>
|
364 |
+
<?php else: // excl. ?>
|
365 |
+
<p class="old-price">
|
366 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
367 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
368 |
+
<?php echo $_coreHelper->formatPrice($_regularPrice, false) ?>
|
369 |
+
</span>
|
370 |
+
</p>
|
371 |
+
|
372 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
373 |
+
<p class="special-price">
|
374 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
375 |
+
<span class="price-excluding-tax">
|
376 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
377 |
+
<span class="price"
|
378 |
+
id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
379 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice, false) ?>
|
380 |
+
</span>
|
381 |
+
</span>
|
382 |
+
<span class="price-including-tax">
|
383 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
384 |
+
<span class="price"
|
385 |
+
id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
386 |
+
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax, false) ?>
|
387 |
+
</span>
|
388 |
+
</span>
|
389 |
+
</p>
|
390 |
+
<?php else: ?>
|
391 |
+
<p class="special-price">
|
392 |
+
<span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
|
393 |
+
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
394 |
+
<?php echo $_coreHelper->formatPrice($_finalPrice, false) ?>
|
395 |
+
</span>
|
396 |
+
</p>
|
397 |
+
<?php endif; ?>
|
398 |
+
<?php endif; ?>
|
399 |
+
|
400 |
+
<?php endif; /* if ($_finalPrice == $_price): */ ?>
|
401 |
+
|
402 |
+
<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_convertedFinalPrice): ?>
|
403 |
+
|
404 |
+
<?php $_minimalPriceDisplayValue = $_minimalPrice; ?>
|
405 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?>
|
406 |
+
<?php $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount; ?>
|
407 |
+
<?php endif; ?>
|
408 |
+
|
409 |
+
<?php if ($this->getUseLinkForAsLowAs()): ?>
|
410 |
+
<a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link">
|
411 |
+
<?php else: ?>
|
412 |
+
<span class="minimal-price-link">
|
413 |
+
<?php endif ?>
|
414 |
+
<span class="label"><?php echo $this->__('As low as:') ?></span>
|
415 |
+
<span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
416 |
+
<?php echo $_coreHelper->formatPrice($_minimalPriceDisplayValue, false) ?>
|
417 |
+
</span>
|
418 |
+
<?php if ($this->getUseLinkForAsLowAs()): ?>
|
419 |
+
</a>
|
420 |
+
<?php else: ?>
|
421 |
+
</span>
|
422 |
+
<?php endif ?>
|
423 |
+
<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?>
|
424 |
+
</div>
|
425 |
+
|
426 |
+
<?php else: /* if (!$_product->isGrouped()): */ ?>
|
427 |
+
<?php
|
428 |
+
$showMinPrice = $this->getDisplayMinimalPrice();
|
429 |
+
if ($showMinPrice && $_minimalPriceValue) {
|
430 |
+
$_exclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue);
|
431 |
+
$_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, true);
|
432 |
+
$price = $showMinPrice ? $_minimalPriceValue : 0;
|
433 |
+
} else {
|
434 |
+
$price = $_convertedFinalPrice;
|
435 |
+
$_exclTax = $_taxHelper->getPrice($_product, $price);
|
436 |
+
$_inclTax = $_taxHelper->getPrice($_product, $price, true);
|
437 |
+
}
|
438 |
+
?>
|
439 |
+
<?php if ($price): ?>
|
440 |
+
<div class="price-box">
|
441 |
+
<p<?php if ($showMinPrice): ?> class="minimal-price"<?php endif ?>>
|
442 |
+
<?php if ($showMinPrice): ?>
|
443 |
+
<span class="price-label"><?php echo $this->__('Starting at:') ?></span>
|
444 |
+
<?php endif ?>
|
445 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
446 |
+
<span class="price-excluding-tax">
|
447 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
448 |
+
<span class="price"
|
449 |
+
id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
450 |
+
<?php echo $_coreHelper->formatPrice($_exclTax, false) ?>
|
451 |
+
</span>
|
452 |
+
</span>
|
453 |
+
<span class="price-including-tax">
|
454 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
455 |
+
<span class="price"
|
456 |
+
id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
457 |
+
<?php echo $_coreHelper->formatPrice($_inclTax, false) ?>
|
458 |
+
</span>
|
459 |
+
</span>
|
460 |
+
<?php else: ?>
|
461 |
+
<?php
|
462 |
+
$_showPrice = $_inclTax;
|
463 |
+
if (!$_taxHelper->displayPriceIncludingTax()) {
|
464 |
+
$_showPrice = $_exclTax;
|
465 |
+
}
|
466 |
+
?>
|
467 |
+
<span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
468 |
+
<?php echo $_coreHelper->formatPrice($_showPrice, false) ?>
|
469 |
+
</span>
|
470 |
+
<?php endif; ?>
|
471 |
+
</p>
|
472 |
+
</div>
|
473 |
+
<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice): */ ?>
|
474 |
+
<?php endif; /* if (!$_product->isGrouped()): */ ?>
|
app/etc/modules/Magebuzz_Searchautocomplete.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Searchautocomplete>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Magebuzz_Searchautocomplete>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Magebuzz_Searchautocomplete.csv
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Search Autocomplete","Search Autocomplete"
|
2 |
+
"Minimum of characters to start search","Minimum of characters to start search"
|
3 |
+
"Search by attributes","Search by attributes"
|
4 |
+
"Search by tags","Search by tags"
|
5 |
+
"Number of results","Number of results"
|
6 |
+
"Show out of stock products","Show out of stock products"
|
7 |
+
"Search result heading","Search result heading"
|
8 |
+
"Show product thumbnail image","Show product thumbnail image"
|
9 |
+
"Width of thumbnail image","Width of thumbnail image"
|
10 |
+
"Show product description","Show product description"
|
11 |
+
"Limit characters in product description","Limit characters in product description"
|
12 |
+
"Searches after the minimum characters has been entered","Searches after the minimum characters has been entered"
|
13 |
+
"{{keyword}} will be replaced by the keyword which is searched by customer","{{keyword}} will be replaced by the keyword which is searched by customer"
|
14 |
+
"No results for","No results for"
|
js/magebuzz/searchautocomplete/ajaxsearch.js
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Copyright (c) 2014 www.magebuzz.com
|
3 |
+
*/
|
4 |
+
var SearchAutocomplete = Class.create();
|
5 |
+
var searchInput = '';
|
6 |
+
SearchAutocomplete.prototype = {
|
7 |
+
initialize: function(searchUrl,coreSearchUrl, heading,searchInput,noResultText='No results for'){
|
8 |
+
this.searchInput = searchInput;
|
9 |
+
this.searchUrl = searchUrl;
|
10 |
+
this.coreSearchUrl = coreSearchUrl;
|
11 |
+
this.onSuccess = this.onSuccess.bindAsEventListener(this);
|
12 |
+
this.onFailure = this.onFailure.bindAsEventListener(this);
|
13 |
+
this.currentSearch = '';
|
14 |
+
this.heading = heading;
|
15 |
+
this.noResultText = noResultText;
|
16 |
+
},
|
17 |
+
search: function(){
|
18 |
+
var searchBox = $(this.searchInput);
|
19 |
+
|
20 |
+
if(searchBox.value=='')
|
21 |
+
{
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
if ((this.currentSearch!="") &&(searchBox.value == this.currentSearch)) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
this.currentSearch = searchBox.value;
|
29 |
+
|
30 |
+
searchBox.className = 'loading-result input-text';
|
31 |
+
var keyword = searchBox.value;
|
32 |
+
|
33 |
+
var parameters = {keyword:keyword};
|
34 |
+
url = this.searchUrl;//+"keyword/" + escape(keyword);
|
35 |
+
|
36 |
+
new Ajax.Request(url, {
|
37 |
+
method: 'get',
|
38 |
+
frequency: 500,
|
39 |
+
parameters: parameters,
|
40 |
+
onSuccess: this.onSuccess,
|
41 |
+
onFailure: this.onFailure
|
42 |
+
});
|
43 |
+
},
|
44 |
+
onFailure: function(transport){
|
45 |
+
$(this.searchInput).className ="input-text";
|
46 |
+
},
|
47 |
+
onSuccess: function(transport)
|
48 |
+
{
|
49 |
+
var showResults = $('boxResults');
|
50 |
+
showResults.style.display = "block";
|
51 |
+
var listResults = $('listResults');
|
52 |
+
listResults.style.display = "block";
|
53 |
+
var searchBox = $(this.searchInput);
|
54 |
+
if (transport && transport.responseText) {
|
55 |
+
try{
|
56 |
+
response = eval('(' + transport.responseText + ')');
|
57 |
+
}catch (e) {
|
58 |
+
response = {};
|
59 |
+
}
|
60 |
+
if (response.html != "") {
|
61 |
+
this.currentSearch = searchBox.value;
|
62 |
+
listResults.update(response.html);
|
63 |
+
var heading = '<a href='+this.coreSearchUrl+"?q="+this.currentSearch+'>'+this.heading+'</a>';
|
64 |
+
var strHeading = heading.replace("{{keyword}}",this.currentSearch);
|
65 |
+
this.updateResultLabel(strHeading);
|
66 |
+
searchBox.className = 'search-complete input-text';
|
67 |
+
}
|
68 |
+
else{
|
69 |
+
listResults.update(response.html);
|
70 |
+
this.updateResultLabel(this.noResultText +' "<span class="keyword">'+this.currentSearch+'</span>"');
|
71 |
+
searchBox.className ="search-complete input-text";
|
72 |
+
}
|
73 |
+
}
|
74 |
+
},
|
75 |
+
updateResultLabel: function(message)
|
76 |
+
{
|
77 |
+
$("resultLabel").update(message);
|
78 |
+
}
|
79 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>magebuzz_search_suggest_autocomplete</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Search Suggest and Autocomplete - free extension for Magento 1</summary>
|
10 |
+
<description>Search Suggest and Autocomplete is an extension which gives your customers more flexibility while searching any product in a fast, easy and effective way. </description>
|
11 |
+
<notes>Search Suggest and Autocomplete extends Magento search and helps it run better for your online store. Customers can easily search products without loading the page. This extension uses Ajax to return match items with search query quickly. Moreover, the module configuration allows you to change the look and feel as well as customize search query to meet your requirements.</notes>
|
12 |
+
<authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
|
13 |
+
<date>2016-02-05</date>
|
14 |
+
<time>08:38:32</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Magebuzz"><dir name="Searchautocomplete"><dir name="Block"><file name="Searchautocomplete.php" hash="3dae1f220c0443e788c210ac94a7ca9e"/></dir><dir name="Helper"><file name="Data.php" hash="332263841f6e21930f710e13652386c0"/></dir><dir name="Model"><dir name="Source"><dir name="Product"><file name="Attribute.php" hash="ba139c78c9f8c152be68470969173d08"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="8c76360c4e68b0a5e95941cdfef16d8c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="07887045b8772974440d46feef5eb6c9"/><file name="config.xml" hash="3be2aeda9e6b1d239b8c3c2589bac78b"/><file name="system.xml" hash="fb208b6ede5ad59483301595c4fd3379"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="searchautocomplete.xml" hash="aa1a55ec4ef756d6e5e1989b77d3898a"/></dir><dir name="template"><dir name="searchautocomplete"><file name="form.phtml" hash="bbebd1cb30dc956ad38061a350f78f00"/><dir name="product"><file name="price.phtml" hash="2590adbc425c27596236d23898429418"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Magebuzz_Searchautocomplete.csv" hash="e5aef8157b4a413114b75de8ab66adb5"/></dir></target><target name="mageweb"><dir name="js"><dir name="magebuzz"><dir name="searchautocomplete"><file name="ajaxsearch.js" hash="e9d8d166b797482b6b89a82f56f54d20"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="magebuzz"><dir name="searchautocomplete"><dir name="images"><file name="close-icon.png" hash="b94da2d715c62e91c9de77ae8cdf4e6f"/><file name="search-loading.gif" hash="73e57937304d89f251e7e540a24b095a"/><file name="search_complete.png" hash="2ef859aff87a9aa313316a47a59de268"/></dir></dir><file name="searchautocomplete.css" hash="ee866f99e7e5ac10c931fffe644e7bc3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Searchautocomplete.xml" hash="0b201896d3d0e36b724aa94d6c1f2b93"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/css/magebuzz/searchautocomplete.css
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Copyright (c) 2014 www.magebuzz.com
|
3 |
+
*/
|
4 |
+
#boxResults{
|
5 |
+
position:absolute;
|
6 |
+
right:33px;
|
7 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
8 |
+
border: 1px solid #E1E1E1;
|
9 |
+
width:350px;
|
10 |
+
top:30px;
|
11 |
+
z-index:999;
|
12 |
+
text-align:left;
|
13 |
+
border-radius:5px;
|
14 |
+
}
|
15 |
+
#searchautocomplete_form .form-search input.input-text{}
|
16 |
+
#searchautocomplete_form .form-search input.loading-result{background:#FFFFFF url(searchautocomplete/images/search-loading.gif) 95% center no-repeat;}
|
17 |
+
#searchautocomplete_form .form-search input.search-complete{background:#FFFFFF url(searchautocomplete/images/search_complete.png) 95% center no-repeat;}
|
18 |
+
#boxResults #resultNotice{
|
19 |
+
float: left;
|
20 |
+
width:100%;
|
21 |
+
text-align:center;
|
22 |
+
padding:5px 0;
|
23 |
+
}
|
24 |
+
#boxResults .close-dropdown{background:url(searchautocomplete/images/close-icon.png) top left no-repeat; float:right; width:16px; height:16px; text-indent:-999em; margin:10px;}
|
25 |
+
#boxResults #resultNotice span.keyword{
|
26 |
+
font-weight:bold;
|
27 |
+
color:#ff0000;
|
28 |
+
padding:2px;
|
29 |
+
}
|
30 |
+
#boxResults #resultLabel{
|
31 |
+
font-style:italic;
|
32 |
+
font-size:12px;
|
33 |
+
color:#999;
|
34 |
+
}
|
35 |
+
#boxResults #resultLabel a{
|
36 |
+
font-style:italic;
|
37 |
+
font-size:12px;
|
38 |
+
color:#2f2f2f;
|
39 |
+
text-decoration:none;
|
40 |
+
font-weight: bold;
|
41 |
+
}
|
42 |
+
#boxResults #listResults{
|
43 |
+
float:left;
|
44 |
+
width:100%;
|
45 |
+
}
|
46 |
+
#listResults .result-title{
|
47 |
+
background: none repeat scroll 0 0 #CCCCCC;
|
48 |
+
float: left;
|
49 |
+
padding: 2px 0;
|
50 |
+
text-align: center;
|
51 |
+
width: 100%;
|
52 |
+
color: #444444;
|
53 |
+
}
|
54 |
+
#listResults .list-products{
|
55 |
+
float:left;
|
56 |
+
width:100%;
|
57 |
+
margin: 0 0 5px;
|
58 |
+
}
|
59 |
+
#listResults .list-products li.item{
|
60 |
+
border-bottom: 1px dashed #CCCCCC;
|
61 |
+
float: left;
|
62 |
+
padding:0;
|
63 |
+
width: 100%;
|
64 |
+
}
|
65 |
+
#listResults .list-products li .product-info{
|
66 |
+
padding:10px;
|
67 |
+
background:#FFFFFF;
|
68 |
+
overflow:hidden;
|
69 |
+
}
|
70 |
+
#listResults .list-products li:hover{cursor:pointer; color:#FFFFFF;}
|
71 |
+
#listResults .list-products li:hover .product-info{
|
72 |
+
padding:10px;
|
73 |
+
background:#3b5998;
|
74 |
+
}
|
75 |
+
#listResults .list-products .product-img{float:left; background:#FFFFFF; border:1px solid #E1E1E1; width:20%; text-align:center;}
|
76 |
+
#listResults .list-products .product-desc{
|
77 |
+
float: right;
|
78 |
+
width: 77%;
|
79 |
+
}
|
80 |
+
#listResults .list-products .product-name{}
|
81 |
+
#listResults .list-products p.desc{color:#000; margin:0 0 3px;}
|
82 |
+
#listResults .list-products li:hover p.desc{color:#FFFFFF;}
|
83 |
+
#listResults .list-products .product-price h5{color:#FF0000; font-size:15px; font-weight:bold;}
|
84 |
+
#listResults .list-products .product-name a{
|
85 |
+
color: #617ff0;
|
86 |
+
font-weight: bold;
|
87 |
+
font-size:12px;
|
88 |
+
text-decoration: none;
|
89 |
+
}
|
90 |
+
#listResults .list-products li:hover .product-name a{
|
91 |
+
color: #FFFFFF;
|
92 |
+
}
|
skin/frontend/base/default/css/magebuzz/searchautocomplete/images/close-icon.png
ADDED
Binary file
|
skin/frontend/base/default/css/magebuzz/searchautocomplete/images/search-loading.gif
ADDED
Binary file
|
skin/frontend/base/default/css/magebuzz/searchautocomplete/images/search_complete.png
ADDED
Binary file
|