Version Notes
Search multiple products from one Search Box using comma separated keywords.
Download this release
Release Info
Developer | Silvertouch |
Extension | Sttl_Multisearch |
Version | 0.2.0 |
Comparing to | |
See all releases |
Version 0.2.0
- app/code/local/Sttl/Multisearch/Block/Product/Searchproductlist.php +157 -0
- app/code/local/Sttl/Multisearch/controllers/IndexController.php +31 -0
- app/code/local/Sttl/Multisearch/etc/config.xml +42 -0
- app/design/frontend/default/default/layout/multisearch.xml +43 -0
- app/design/frontend/default/default/template/catalog/product/searchproductlist.phtml +184 -0
- app/design/frontend/default/default/template/searchproduct/form.phtml +42 -0
- app/etc/modules/Sttl_Multisearch.xml +9 -0
- package.xml +22 -0
- silver_docs/SILVER_Multi_Search_User_Guide-Ver_1.0.pdf +0 -0
app/code/local/Sttl/Multisearch/Block/Product/Searchproductlist.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SilverTouch Technologies Limited.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
11 |
+
*
|
12 |
+
* @category Sttl
|
13 |
+
* @package Sttl_Multisearch
|
14 |
+
* @copyright Copyright (c) 2011 SilverTouch Technologies Limited. (http://www.silvertouch.com/MagentoExtensions)
|
15 |
+
* @license http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
16 |
+
*/
|
17 |
+
class Sttl_Multisearch_Block_Product_Searchproductlist extends Mage_Catalog_Block_Product_List
|
18 |
+
{
|
19 |
+
protected function _beforeToHtml()
|
20 |
+
{
|
21 |
+
$toolbar = $this->getToolbarBlock();
|
22 |
+
$layer = Mage::getSingleton('catalog/layer');
|
23 |
+
$layer->getCurrentCategory()->setIsAnchor(1);
|
24 |
+
//$collection = $layer->getProductCollection();
|
25 |
+
//$collection = $this->_getProductCollection();
|
26 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
27 |
+
$collection->addAttributeToSelect('*');
|
28 |
+
$postData = $this->getRequest()->getParam('searchprod');
|
29 |
+
|
30 |
+
$searchprod = $postData;
|
31 |
+
|
32 |
+
|
33 |
+
$findme = ',';
|
34 |
+
$pos = strpos($searchprod, $findme);
|
35 |
+
|
36 |
+
if ($pos === false) {
|
37 |
+
$data = preg_split( "[\r\n]", $searchprod );
|
38 |
+
|
39 |
+
foreach ($data as $key => $value) {
|
40 |
+
if (is_null($value) || $value == "") {
|
41 |
+
unset($data[$key]);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
} else {
|
45 |
+
$data = split( ",", $searchprod );
|
46 |
+
foreach ($data as $key => $value) {
|
47 |
+
if (is_null($value) || $value == "") {
|
48 |
+
unset($data[$key]);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
if(!Mage::getSingleton('core/session')->getAllproducts()) {
|
54 |
+
Mage::getSingleton('core/session')->setAllproducts($data);
|
55 |
+
}
|
56 |
+
$session_data = Mage::getSingleton('core/session')->getAllproducts();
|
57 |
+
if(count($data) > 0) {
|
58 |
+
foreach($data as $key => $value) {
|
59 |
+
if(!empty($value) && trim($value)) {
|
60 |
+
$tmp[] = array('attribute'=>'name','like'=>'%'.$value.'%');
|
61 |
+
}
|
62 |
+
}
|
63 |
+
} else if($session_data) {
|
64 |
+
foreach($session_data as $key => $value) {
|
65 |
+
if(!empty($value) && trim($value)) {
|
66 |
+
$tmp[] = array('attribute'=>'name','like'=>'%'.$value.'%');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
$collection->addFieldToFilter($tmp);
|
71 |
+
|
72 |
+
$this->_productCollection = $collection;
|
73 |
+
|
74 |
+
if ($orders = $this->getAvailableOrders()) {
|
75 |
+
$toolbar->setAvailableOrders($orders);
|
76 |
+
}
|
77 |
+
if ($sort = $this->getSortBy()) {
|
78 |
+
$toolbar->setDefaultOrder($sort);
|
79 |
+
}
|
80 |
+
if ($dir = $this->getDefaultDirection()) {
|
81 |
+
$toolbar->setDefaultDirection($dir);
|
82 |
+
}
|
83 |
+
if ($modes = $this->getModes()) {
|
84 |
+
$toolbar->setModes($modes);
|
85 |
+
}
|
86 |
+
|
87 |
+
// set collection to tollbar and apply sort
|
88 |
+
$toolbar->setCollection($collection);
|
89 |
+
|
90 |
+
$this->setChild('toolbar', $toolbar);
|
91 |
+
Mage::dispatchEvent('catalog_block_product_list_collection', array(
|
92 |
+
'collection' => $this->_getProductCollection()
|
93 |
+
));
|
94 |
+
|
95 |
+
$this->_getProductCollection()->load();
|
96 |
+
Mage::getModel('review/review')->appendSummary($this->_getProductCollection());
|
97 |
+
return parent::_beforeToHtml();
|
98 |
+
}
|
99 |
+
public function getPostData() {
|
100 |
+
$postData = $this->getRequest()->getParam('searchprod');
|
101 |
+
$searchprod = $postData;
|
102 |
+
|
103 |
+
$findme = ',';
|
104 |
+
$pos = strpos($searchprod, $findme);
|
105 |
+
if ($pos === false) {
|
106 |
+
$data = preg_split( "[\r\n]", $searchprod );
|
107 |
+
|
108 |
+
foreach ($data as $key => $value) {
|
109 |
+
if (is_null($value) || $value == "") {
|
110 |
+
unset($data[$key]);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$data = split( ",", $searchprod );
|
115 |
+
foreach ($data as $key => $value) {
|
116 |
+
if (is_null($value) || $value == "") {
|
117 |
+
unset($data[$key]);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
return $data;
|
123 |
+
}
|
124 |
+
|
125 |
+
public function getCountofSearch($value) {
|
126 |
+
$value = trim($value);
|
127 |
+
$count = 0;
|
128 |
+
//$_productCollection1 = Mage::getModel('catalog/product')->getCollection();
|
129 |
+
//->addFieldToFilter(array(array('attribute'=>'name','like'=>'%'.$value.'%')));
|
130 |
+
$layer = Mage::getSingleton('catalog/layer');
|
131 |
+
$layer->getCurrentCategory()->setIsAnchor(1);
|
132 |
+
$_productCollection1 = Mage::getModel('catalog/product')->getCollection();
|
133 |
+
|
134 |
+
$_productCollection1 = $_productCollection1->addFieldToFilter(array(array('attribute'=>'name','like'=>'%'.$value.'%')))->addAttributeToFilter(array(array('attribute'=>'visibility','eq'=>4)));
|
135 |
+
//Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($_productCollection1);
|
136 |
+
//Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($_productCollection1);
|
137 |
+
//$_productCollection1->addAttributeToFilter('status', 1);
|
138 |
+
|
139 |
+
//echo $_productCollection1->getSelect();
|
140 |
+
$data = $_productCollection1->getData();
|
141 |
+
|
142 |
+
//$productIds = Mage::getModel('cataloginventory/stock_item')->getCollection()
|
143 |
+
// ->addFieldToFilter('is_in_stock', 1)->getAllIds();
|
144 |
+
|
145 |
+
//$check_id = $data[0]['entity_id'];
|
146 |
+
//if(in_array($check_id,$productIds)) {
|
147 |
+
// echo "parul"."<br>";
|
148 |
+
$count = count($data);
|
149 |
+
|
150 |
+
//} else {
|
151 |
+
// $count = 0;
|
152 |
+
//}
|
153 |
+
|
154 |
+
return $count;
|
155 |
+
}
|
156 |
+
|
157 |
+
}
|
app/code/local/Sttl/Multisearch/controllers/IndexController.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SilverTouch Technologies Limited.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
11 |
+
*
|
12 |
+
* @category Sttl
|
13 |
+
* @package Sttl_Multisearch
|
14 |
+
* @copyright Copyright (c) 2011 SilverTouch Technologies Limited. (http://www.silvertouch.com/MagentoExtensions)
|
15 |
+
* @license http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
16 |
+
*/
|
17 |
+
class Sttl_Multisearch_IndexController extends Mage_Core_Controller_Front_Action
|
18 |
+
{
|
19 |
+
public function showAction()
|
20 |
+
{
|
21 |
+
$this->loadLayout();
|
22 |
+
$this->renderLayout();
|
23 |
+
}
|
24 |
+
public function indexAction()
|
25 |
+
{
|
26 |
+
$this->loadLayout();
|
27 |
+
$this->renderLayout();
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
?>
|
app/code/local/Sttl/Multisearch/etc/config.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sttl_Multisearch>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Sttl_Multisearch>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<multisearch>
|
11 |
+
<class>Sttl_Multisearch_Block</class>
|
12 |
+
</multisearch>
|
13 |
+
</blocks>
|
14 |
+
</global>
|
15 |
+
<frontend>
|
16 |
+
<translate>
|
17 |
+
<modules>
|
18 |
+
<sttl_multisearch>
|
19 |
+
<files>
|
20 |
+
<default>Sttl_Multisearch.csv</default>
|
21 |
+
</files>
|
22 |
+
</sttl_multisearch>
|
23 |
+
</modules>
|
24 |
+
</translate>
|
25 |
+
<routers>
|
26 |
+
<multisearch>
|
27 |
+
<use>standard</use>
|
28 |
+
<args>
|
29 |
+
<module>Sttl_Multisearch</module>
|
30 |
+
<frontName>multisearch</frontName>
|
31 |
+
</args>
|
32 |
+
</multisearch>
|
33 |
+
</routers>
|
34 |
+
<layout>
|
35 |
+
<updates>
|
36 |
+
<multisearch>
|
37 |
+
<file>multisearch.xml</file>
|
38 |
+
</multisearch>
|
39 |
+
</updates>
|
40 |
+
</layout>
|
41 |
+
</frontend>
|
42 |
+
</config>
|
app/design/frontend/default/default/layout/multisearch.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<multisearch_index_show translate="label">
|
4 |
+
<update handle="MAP_popup" />
|
5 |
+
</multisearch_index_show>
|
6 |
+
<default>
|
7 |
+
<reference name="footer_links">
|
8 |
+
<action method="addLink" module="saerchproduct"><label>Multi Search</label><url>{{baseUrl}}multisearch</url> <title>Express Shop</title></action>
|
9 |
+
</reference>
|
10 |
+
</default>
|
11 |
+
<multisearch_index_index>
|
12 |
+
<reference name="root">
|
13 |
+
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
|
14 |
+
</reference>
|
15 |
+
<label>Catalog Category (Anchor)</label>
|
16 |
+
<reference name="content">
|
17 |
+
<block type="core/template" name="productform" as="productform" template="searchproduct/form.phtml" />
|
18 |
+
</reference>
|
19 |
+
</multisearch_index_index>
|
20 |
+
|
21 |
+
<multisearch_index_show translate="label">
|
22 |
+
<!-- <reference name="left">
|
23 |
+
<block type="catalog/layer_view" name="catalog.leftnav" before="tags_popular" template="catalog/layer/view.phtml"/>
|
24 |
+
</reference> -->
|
25 |
+
<reference name="root">
|
26 |
+
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
|
27 |
+
</reference>
|
28 |
+
<label>Catalog Category (Anchor)</label>
|
29 |
+
<reference name="content">
|
30 |
+
<block type="multisearch/product_searchproductlist" name="product_list" template="catalog/product/searchproductlist.phtml">
|
31 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
32 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
33 |
+
</block>
|
34 |
+
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
|
35 |
+
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
|
36 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
|
37 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
|
38 |
+
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
|
39 |
+
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
|
40 |
+
</block>
|
41 |
+
</reference>
|
42 |
+
</multisearch_index_show>
|
43 |
+
</layout>
|
app/design/frontend/default/default/template/catalog/product/searchproductlist.phtml
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SilverTouch Technologies Limited.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
11 |
+
*
|
12 |
+
* @category Sttl
|
13 |
+
* @package Sttl_Multisearch
|
14 |
+
* @copyright Copyright (c) 2011 SilverTouch Technologies Limited. (http://www.silvertouch.com/MagentoExtensions)
|
15 |
+
* @license http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
16 |
+
*/
|
17 |
+
|
18 |
+
$_productCollection=$this->getLoadedProductCollection();
|
19 |
+
$_helper = $this->helper('catalog/output');
|
20 |
+
$cartHelper = Mage::helper('checkout/cart');
|
21 |
+
$count = count($_productCollection);
|
22 |
+
$session_data = Mage::getSingleton('core/session')->getAllproducts();
|
23 |
+
$items = $cartHelper->getCart()->getItems();
|
24 |
+
$flag = 0;
|
25 |
+
if($items > 0) {
|
26 |
+
foreach ($items as $item) {
|
27 |
+
$ids[] = $item->getProduct_id();
|
28 |
+
$qty[$item->getProduct_id()] = $item->getQty();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
$tmps_data = $this->getPostData();
|
32 |
+
$comma_data = implode(',',$tmps_data);
|
33 |
+
$org_data = implode(',' , $session_data);
|
34 |
+
?>
|
35 |
+
<h2>Multi Search (Advanced Options)</h2>
|
36 |
+
<?php foreach($session_data as $key => $value) { ?>
|
37 |
+
|
38 |
+
<?php $count = $this->getCountofSearch($value); ?>
|
39 |
+
|
40 |
+
<?php if(!$_GET['searchprod']): ?>
|
41 |
+
<INPUT TYPE="CHECKBOX" VALUE="<?php echo $this->getUrl('multisearch/index/show/').'?searchprod='; ?>" ONCLICK="setlocation(this.value,'<?php echo $comma_data ?>', '<?php echo $value ?>', '<?php echo $org_data ?>')" CHECKED="TRUE" ID="<?php echo $value ?>" > <?php echo $value.' ['.$count.']';?> <br/>
|
42 |
+
<?php else: ?>
|
43 |
+
|
44 |
+
<INPUT TYPE="CHECKBOX" VALUE="<?php echo $this->getUrl('multisearch/index/show/').'?searchprod='; ?>" ID="<?php echo $value ?>" ONCLICK="setlocation(this.value,'<?php echo $comma_data ?>', '<?php echo $value ?>', '<?php echo $org_data ?>')" <?php if(strstr($_GET['searchprod'],$value)) echo 'CHECKED="TRUE"'; ?> > <?php echo $value.' ['.$count.']';?> <br/>
|
45 |
+
|
46 |
+
<?php endif; ?>
|
47 |
+
|
48 |
+
<?php } ?>
|
49 |
+
|
50 |
+
<a href="<?php echo $this->getUrl('multisearch/index/show/').'?searchprod='.$org_data; ?>" style="margin-right:20px;" > Check All </a>
|
51 |
+
<a href="<?php echo $this->getUrl('multisearch') ?>" > Go to Multi Search page </a>
|
52 |
+
|
53 |
+
|
54 |
+
<?php
|
55 |
+
|
56 |
+
|
57 |
+
foreach($tmps_data as $key => $value) { //echo $value."dddd";
|
58 |
+
|
59 |
+
$count = $this->getCountofSearch($value);
|
60 |
+
if($count != '0' and !empty($count)) {
|
61 |
+
//echo "<br />You searched for <b>'".$value. "'</b> and we found ".$count." match.<br />";
|
62 |
+
} else if(!empty($value) && trim($value)) {
|
63 |
+
//echo "<br>We did not find any results for '".$value."'";
|
64 |
+
//echo ('<br />');
|
65 |
+
}
|
66 |
+
}
|
67 |
+
?>
|
68 |
+
<br />
|
69 |
+
<?php if($count < 0): ?>
|
70 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
71 |
+
<?php else: ?>
|
72 |
+
<div class="category-products">
|
73 |
+
<?php echo $this->getToolbarHtml() ?>
|
74 |
+
<?php // List mode ?>
|
75 |
+
<?php if($this->getMode()!='grid'): ?>
|
76 |
+
<?php $_iterator = 0; ?>
|
77 |
+
<ol class="products-list" id="products-list">
|
78 |
+
<?php foreach ($_productCollection as $_product): ?>
|
79 |
+
<?php $_productx = Mage::getModel('catalog/product')->load($_product->getId());?>
|
80 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
81 |
+
<?php // Product Image ?>
|
82 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_productx, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
83 |
+
<?php // Product description ?>
|
84 |
+
<div class="product-shop">
|
85 |
+
<div class="f-fix">
|
86 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
87 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
88 |
+
<?php if($_product->getRatingSummary()): ?>
|
89 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
90 |
+
<?php endif; ?>
|
91 |
+
<?php echo $this->getPriceHtml($_productx, true) ?>
|
92 |
+
<?php if($_product->isSaleable()): ?>
|
93 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
94 |
+
<?php else: ?>
|
95 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
96 |
+
<?php endif; ?>
|
97 |
+
<div class="desc std">
|
98 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
99 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
100 |
+
</div>
|
101 |
+
<ul class="add-to-links">
|
102 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
103 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
104 |
+
<?php endif; ?>
|
105 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
106 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
107 |
+
<?php endif; ?>
|
108 |
+
</ul>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
</li>
|
112 |
+
<?php endforeach; ?>
|
113 |
+
</ol>
|
114 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
115 |
+
|
116 |
+
<?php else: ?>
|
117 |
+
|
118 |
+
<?php // Grid Mode ?>
|
119 |
+
|
120 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
121 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
122 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
123 |
+
<?php if ($i++%$_columnCount==0): ?>
|
124 |
+
<ul class="products-grid">
|
125 |
+
<?php endif ?>
|
126 |
+
<?php $_productx = Mage::getModel('catalog/product')->load($_product->getId());?>
|
127 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
128 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_productx, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
129 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
130 |
+
<?php if($_product->getRatingSummary()): ?>
|
131 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
132 |
+
<?php endif; ?>
|
133 |
+
<?php echo $this->getPriceHtml($_productx, true) ?>
|
134 |
+
<div class="actions">
|
135 |
+
<?php if($_product->isSaleable()): ?>
|
136 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
137 |
+
<?php else: ?>
|
138 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
139 |
+
<?php endif; ?>
|
140 |
+
<ul class="add-to-links">
|
141 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
142 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
143 |
+
<?php endif; ?>
|
144 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
145 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
146 |
+
<?php endif; ?>
|
147 |
+
</ul>
|
148 |
+
</div>
|
149 |
+
</li>
|
150 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
151 |
+
</ul>
|
152 |
+
<?php endif ?>
|
153 |
+
<?php endforeach ?>
|
154 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
155 |
+
<?php endif; ?>
|
156 |
+
|
157 |
+
<div class="toolbar-bottom">
|
158 |
+
<?php echo $this->getToolbarHtml() ?>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<?php endif; ?>
|
162 |
+
<script type="text/javascript">
|
163 |
+
//<![CDATA[
|
164 |
+
function setlocation(url,postdata,chk,orgdata) {
|
165 |
+
var post;
|
166 |
+
|
167 |
+
if(document.getElementById(chk).checked == true)
|
168 |
+
{
|
169 |
+
post = postdata + ',' + chk;
|
170 |
+
//url + = post;
|
171 |
+
|
172 |
+
}
|
173 |
+
else
|
174 |
+
{
|
175 |
+
post = postdata.replace(chk , '' );
|
176 |
+
if(post == '')
|
177 |
+
post = orgdata;
|
178 |
+
}
|
179 |
+
|
180 |
+
window.location.href = url + post;
|
181 |
+
}
|
182 |
+
//]]>
|
183 |
+
</script>
|
184 |
+
|
app/design/frontend/default/default/template/searchproduct/form.phtml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SilverTouch Technologies Limited.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the EULA
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
11 |
+
*
|
12 |
+
* @category Sttl
|
13 |
+
* @package Sttl_Multisearch
|
14 |
+
* @copyright Copyright (c) 2011 SilverTouch Technologies Limited. (http://www.silvertouch.com/MagentoExtensions)
|
15 |
+
* @license http://www.silvertouch.com/MagentoExtensions/LICENSE.txt
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<div class="page-title"><h1><?php echo $this->__('Multi Search'); ?></h1></div>
|
20 |
+
<p>Here you can write more than one search criteria.</p>
|
21 |
+
<p><b>NOTE:</b>Please use "Enter" or "Comma" key after each search text. e.g. Nokia 'Press Enter key' Samsung. </p>
|
22 |
+
<form id="searchproduct" method="post" action="<?php echo $this->getUrl('multisearch/index/show'); ?>">
|
23 |
+
<div><textarea name="searchprod" id="searchprod" class="required-entry" cols="127" rows="10" onkeyup="displayKeyCode(event)" ></textarea></div>
|
24 |
+
<div class="button"><span><input type="submit" name="searchbutton" value="<?php echo $this->__('Search products'); ?>" /></span><span><input type="reset" name="reset" value="<?php echo $this->__('Clear list'); ?>" /></span></div>
|
25 |
+
|
26 |
+
</form>
|
27 |
+
<?php $data=''; Mage::getSingleton('core/session')->setAllproducts($data); ?>
|
28 |
+
<script type="text/javascript">
|
29 |
+
//<![CDATA[
|
30 |
+
var searchproduct = new VarienForm('searchproduct', true);
|
31 |
+
//]]>
|
32 |
+
|
33 |
+
function displayKeyCode(evnt)
|
34 |
+
{
|
35 |
+
if(evnt.keyCode==188)
|
36 |
+
{
|
37 |
+
var text = document.getElementById('searchprod').value;
|
38 |
+
text = text.replace(',','');
|
39 |
+
document.getElementById('searchprod').value = text + '\n';
|
40 |
+
}
|
41 |
+
}
|
42 |
+
</script>
|
app/etc/modules/Sttl_Multisearch.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sttl_Multisearch>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Sttl_Multisearch>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Sttl_Multisearch_18</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.silvertouch.com/MagentoExtensions/licence">STTL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Search multiple products from one Search Box using comma separated keywords. </summary>
|
10 |
+
<description>1. Very Simple to use, install and configure.
|
11 |
+
2. Search text area lets user enter multiple search keywords.
|
12 |
+
3. The Search Result is based on all the Comma Separated Keywords entered by user.
|
13 |
+
4. A simple extension improving search feature of Magento.
|
14 |
+
5. User will have the facility to select specific search to reach to the search detail page. </description>
|
15 |
+
<notes>Search multiple products from one Search Box using comma separated keywords. </notes>
|
16 |
+
<authors><author><name>Silvertouch</name><user>silvertouch</user><email>magento@silvertouch.com</email></author></authors>
|
17 |
+
<date>2015-02-20</date>
|
18 |
+
<time>05:49:45</time>
|
19 |
+
<contents><target name="magelocal"><dir name="Sttl"><dir name="Multisearch"><dir name="Block"><dir name="Product"><file name="Searchproductlist.php" hash="296d4b1cbf74680460e486d5e134f890"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="07247298d01036d8eb30e43d1897407d"/></dir><dir name="etc"><file name="config.xml" hash="5eefce23362db29d7a60c886740b2ac2"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="multisearch.xml" hash="757fd3cb9973a47ec68d435d10adfcd0"/></dir><dir name="template"><dir name="catalog"><dir name="product"><file name="searchproductlist.phtml" hash="1b62cbe7510e6c4d9e51b6143e8bd2cb"/></dir></dir><dir name="searchproduct"><file name="form.phtml" hash="e0fc93f92549f0a48e085d1b3d0a03a3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sttl_Multisearch.xml" hash="053256df002d3bb38cbcd07958ae2432"/></dir></target><target name="mage"><dir name="silver_docs"><file name="SILVER_Multi_Search_User_Guide-Ver_1.0.pdf" hash="b9138466adb89fd1942ca600ca8ba7de"/></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|
silver_docs/SILVER_Multi_Search_User_Guide-Ver_1.0.pdf
ADDED
Binary file
|