Version Notes
The extension is for 1.5+ version.
Download this release
Release Info
Developer | Prokriti Chattopadhyay |
Extension | SearchSku_Serachsku |
Version | 1.6.0 |
Comparing to | |
See all releases |
Version 1.6.0
app/code/local/SearchSku/Searchsku/controllers/IndexController.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
include("Mage/CatalogSearch/controllers/ResultController.php");
|
3 |
+
class SearchSku_Searchsku_IndexController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
|
8 |
+
$_params = $this->getRequest()->getParams();
|
9 |
+
$_sku = $_params['q'];
|
10 |
+
$storeidhide = $_params['storeid'];
|
11 |
+
//$_SESSION['name'] = $_sku;
|
12 |
+
$_model = Mage::getModel('catalog/product');
|
13 |
+
$_productId = $_model->getIdBySku($_sku);
|
14 |
+
//echo $_sku;
|
15 |
+
|
16 |
+
//$_product=Mage::getModel('catalog/product')->loadByAttribute('sku',$_sku);
|
17 |
+
|
18 |
+
// $pid = $_product->getId();
|
19 |
+
// $_pro = Mage::getModel('catalog/product')->load($pid);
|
20 |
+
//echo "<pre>";
|
21 |
+
//print_r($_pro); die();
|
22 |
+
//if($_productId && ($storeidreal==$storeidhide)){
|
23 |
+
if($_productId){
|
24 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
25 |
+
$select_sql = "SELECT * FROM `catalog_product_website` where `product_id`=".$_productId."";
|
26 |
+
//echo $select_sql;
|
27 |
+
//die();
|
28 |
+
$fetch = $read->fetchAll($select_sql);
|
29 |
+
|
30 |
+
foreach ($fetch as $collection):
|
31 |
+
$website=$collection['website_id'];
|
32 |
+
//echo $website;
|
33 |
+
//die();
|
34 |
+
endforeach;
|
35 |
+
}
|
36 |
+
if($storeidhide==$website){
|
37 |
+
|
38 |
+
$_product = $_model->load($_productId);
|
39 |
+
//$storeidreal= $_product->getStoreId();
|
40 |
+
|
41 |
+
$url=$_product->getProductUrl();
|
42 |
+
|
43 |
+
Mage::app()->getFrontController()
|
44 |
+
->getResponse()
|
45 |
+
->setRedirect($url);
|
46 |
+
|
47 |
+
} else {
|
48 |
+
|
49 |
+
$query = Mage::helper('catalogsearch')->getQuery();
|
50 |
+
/* @var $query Mage_CatalogSearch_Model_Query */
|
51 |
+
|
52 |
+
|
53 |
+
$query->setStoreId(Mage::app()->getStore()->getId());
|
54 |
+
|
55 |
+
if ($query->getQueryText()) {
|
56 |
+
if (Mage::helper('catalogsearch')->isMinQueryLength()) {
|
57 |
+
$query->setId(0)
|
58 |
+
->setIsActive(1)
|
59 |
+
->setIsProcessed(1);
|
60 |
+
}
|
61 |
+
else {
|
62 |
+
if ($query->getId()) {
|
63 |
+
$query->setPopularity($query->getPopularity()+1);
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
$query->setPopularity(1);
|
67 |
+
}
|
68 |
+
|
69 |
+
if ($query->getRedirect()){
|
70 |
+
$query->save();
|
71 |
+
$this->getResponse()->setRedirect($query->getRedirect());
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
else {
|
75 |
+
$query->prepare();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
Mage::helper('catalogsearch')->checkNotes();
|
80 |
+
|
81 |
+
$this->loadLayout();
|
82 |
+
$this->_initLayoutMessages('catalog/session');
|
83 |
+
$this->_initLayoutMessages('checkout/session');
|
84 |
+
$this->renderLayout();
|
85 |
+
|
86 |
+
if (!Mage::helper('catalogsearch')->isMinQueryLength()) {
|
87 |
+
$query->save();
|
88 |
+
}
|
89 |
+
}
|
90 |
+
else {
|
91 |
+
$this->_redirectReferer();
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
app/code/local/SearchSku/Searchsku/etc/config.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SearchSku_Searchsku>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</SearchSku_Searchsku>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<searchsku>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>SearchSku_Searchsku</module>
|
14 |
+
<frontName>searchsku</frontName>
|
15 |
+
</args>
|
16 |
+
</searchsku>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<searchsku>
|
21 |
+
<file>searchsku.xml</file>
|
22 |
+
</searchsku>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
|
27 |
+
|
28 |
+
<global>
|
29 |
+
<rewrite>
|
30 |
+
<catalogsearch_result>
|
31 |
+
<from><![CDATA[#^/catalogsearch/result/#]]></from>
|
32 |
+
<to>/searchsku/index/</to>
|
33 |
+
</catalogsearch_result>
|
34 |
+
</rewrite>
|
35 |
+
<models>
|
36 |
+
<searchsku>
|
37 |
+
<class>SearchSku_Searchsku_Model</class>
|
38 |
+
<resourceModel>searchsku_mysql4</resourceModel>
|
39 |
+
</searchsku>
|
40 |
+
<searchsku_mysql4>
|
41 |
+
<class>SearchSku_Searchsku_Model_Mysql4</class>
|
42 |
+
<entities>
|
43 |
+
<searchsku>
|
44 |
+
<table>searchsku</table>
|
45 |
+
</searchsku>
|
46 |
+
</entities>
|
47 |
+
</searchsku_mysql4>
|
48 |
+
</models>
|
49 |
+
<resources>
|
50 |
+
<searchsku_setup>
|
51 |
+
<setup>
|
52 |
+
<module>SearchSku_Searchsku</module>
|
53 |
+
</setup>
|
54 |
+
<connection>
|
55 |
+
<use>core_setup</use>
|
56 |
+
</connection>
|
57 |
+
</searchsku_setup>
|
58 |
+
<searchsku_write>
|
59 |
+
<connection>
|
60 |
+
<use>core_write</use>
|
61 |
+
</connection>
|
62 |
+
</searchsku_write>
|
63 |
+
<searchsku_read>
|
64 |
+
<connection>
|
65 |
+
<use>core_read</use>
|
66 |
+
</connection>
|
67 |
+
</searchsku_read>
|
68 |
+
</resources>
|
69 |
+
<blocks>
|
70 |
+
<searchsku>
|
71 |
+
<class>SearchSku_Searchsku_Block</class>
|
72 |
+
</searchsku>
|
73 |
+
</blocks>
|
74 |
+
<helpers>
|
75 |
+
<searchsku>
|
76 |
+
<class>SearchSku_Searchsku_Helper</class>
|
77 |
+
</searchsku>
|
78 |
+
</helpers>
|
79 |
+
</global>
|
80 |
+
</config>
|
app/code/local/SearchSku/Searchsku/etc/config_mod.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SearchSku_Searchsku>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</SearchSku_Searchsku>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
|
11 |
+
<rewrite>
|
12 |
+
<catalogsearch_result>
|
13 |
+
<from><![CDATA[#^/catalogsearch/result/#]]></from>
|
14 |
+
<to>/searchsku/index/</to>
|
15 |
+
</catalogsearch_result>
|
16 |
+
</rewrite>
|
17 |
+
|
18 |
+
<resources>
|
19 |
+
<searchsku_setup>
|
20 |
+
<setup>
|
21 |
+
<module>SearchSku_Searchsku</module>
|
22 |
+
</setup>
|
23 |
+
<connection>
|
24 |
+
<use>core_setup</use>
|
25 |
+
</connection>
|
26 |
+
</searchsku_setup>
|
27 |
+
<searchsku_write>
|
28 |
+
<connection>
|
29 |
+
<use>core_write</use>
|
30 |
+
</connection>
|
31 |
+
</searchsku_write>
|
32 |
+
<searchsku_read>
|
33 |
+
<connection>
|
34 |
+
<use>core_read</use>
|
35 |
+
</connection>
|
36 |
+
</searchsku_read>
|
37 |
+
</resources>
|
38 |
+
|
39 |
+
</global>
|
40 |
+
</config>
|
app/etc/modules/SearchSku_Searchsku.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SearchSku_Searchsku>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</SearchSku_Searchsku>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>SearchSku_Serachsku</name>
|
4 |
+
<version>1.6.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension is use for searching. The search key will be SKU. By this extension the search will be store specific for different website also.</summary>
|
10 |
+
<description>The extension is use for searching. The search key will be SKU. By this extension the search will be store specific for different website also.</description>
|
11 |
+
<notes>The extension is for 1.5+ version.</notes>
|
12 |
+
<authors><author><name>Prokriti Chattopadhyay</name><user>prokritiindus</user><email>prokriti.chattopadhyay@indusnet.co.in</email></author></authors>
|
13 |
+
<date>2012-07-10</date>
|
14 |
+
<time>12:39:59</time>
|
15 |
+
<contents><target name="magelocal"><dir name="SearchSku"><dir name="Searchsku"><dir name="controllers"><file name="IndexController.php" hash="880087c0cb18664ad390c93c41ff48a3"/></dir><dir name="etc"><file name="config.xml" hash="2b7237a3b97e5509dffe708f2212b96c"/><file name="config_mod.xml" hash="053fe1eed6d48c942b3aacb4bb161578"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SearchSku_Searchsku.xml" hash="04d70f4cfb424edc4abd0ac61576fb2a"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|