Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit a37a78d

Browse files
committed
Repo update ...
- added LICENSE - updated README.md - changed composer name for packagist.org - added some PHPMD supress statements
1 parent f12ae59 commit a37a78d

File tree

6 files changed

+229
-14
lines changed

6 files changed

+229
-14
lines changed

LICENSE

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
Open Software License ("OSL") v. 3.0
2+
This Open Software License (the "License") applies to any original work of authorship
3+
(the "Original Work") whose owner (the "Licensor") has placed the following licensing
4+
notice adjacent to the copyright notice for the Original Work:
5+
Licensed under the Open Software License version 3.0
6+
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free,
7+
non-exclusive, sublicensable license, for the duration of the copyright, to do the
8+
following:
9+
a. to reproduce the Original Work in copies, either alone or as part of a
10+
collective work;
11+
b. to translate, adapt, alter, transform, modify, or arrange the Original Work,
12+
thereby creating derivative works ("Derivative Works") based upon the
13+
Original Work;
14+
c. to distribute or communicate copies of the Original Work and Derivative
15+
Works to the public, with the proviso that copies of Original Work or
16+
Derivative Works that You distribute or communicate shall be licensed
17+
under this Open Software License;
18+
d. to perform the Original Work publicly; and
19+
e. to display the Original Work publicly.
20+
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-
21+
exclusive, sublicensable license, under patent claims owned or controlled by the
22+
Licensor that are embodied in the Original Work as furnished by the Licensor, for
23+
the duration of the patents, to make, use, sell, offer for sale, have made, and
24+
import the Original Work and Derivative Works.
25+
3. Grant of Source Code License. The term "Source Code" means the preferred
26+
form of the Original Work for making modifications to it and all available
27+
documentation describing how to modify the Original Work. Licensor agrees to
28+
provide a machine-readable copy of the Source Code of the Original Work along
29+
with each copy of the Original Work that Licensor distributes. Licensor reserves
30+
the right to satisfy this obligation by placing a machine-readable copy of the
31+
Source Code in an information repository reasonably calculated to permit
32+
inexpensive and convenient access by You for as long as Licensor continues to
33+
distribute the Original Work.
34+
4. Exclusions From License Grant. Neither the names of Licensor, nor the names
35+
of any contributors to the Original Work, nor any of their trademarks or service
36+
marks, may be used to endorse or promote products derived from this Original
37+
Work without express prior permission of the Licensor. Except as expressly stated
38+
herein, nothing in this License grants any license to Licensor's trademarks,
39+
copyrights, patents, trade secrets or any other intellectual property. No patent
40+
license is granted to make, use, sell, offer for sale, have made, or import
41+
embodiments of any patent claims other than the licensed claims defined in
42+
Section 2. No license is granted to the trademarks of Licensor even if such marks
43+
are included in the Original Work. Nothing in this License shall be interpreted to
44+
prohibit Licensor from licensing under terms different from this License any
45+
Original Work that Licensor otherwise would have a right to license.
46+
5. External Deployment. The term "External Deployment" means the use,
47+
distribution, or communication of the Original Work or Derivative Works in any
48+
way such that the Original Work or Derivative Works may be used by anyone
49+
other than You, whether those works are distributed or communicated to those
50+
persons or made available as an application intended for use over a network. As
51+
an express condition for the grants of license hereunder, You must treat any
52+
External Deployment by You of the Original Work or a Derivative Work as a
53+
distribution under section 1(c).
54+
6. Attribution Rights. You must retain, in the Source Code of any Derivative
55+
Works that You create, all copyright, patent, or trademark notices from the Source
56+
Code of the Original Work, as well as any notices of licensing and any descriptive
57+
text identified therein as an "Attribution Notice." You must cause the Source
58+
Code for any Derivative Works that You create to carry a prominent Attribution
59+
Notice reasonably calculated to inform recipients that You have modified the
60+
Original Work.
61+
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
62+
the copyright in and to the Original Work and the patent rights granted herein by
63+
Licensor are owned by the Licensor or are sublicensed to You under the terms of
64+
this License with the permission of the contributor(s) of those copyrights and
65+
patent rights. Except as expressly stated in the immediately preceding sentence,
66+
the Original Work is provided under this License on an "AS IS" BASIS and
67+
WITHOUT WARRANTY, either express or implied, including, without
68+
limitation, the warranties of non-infringement, merchantability or fitness for a
69+
particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE
70+
ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY
71+
constitutes an essential part of this License. No license to the Original Work is
72+
granted by this License except under this disclaimer.
73+
8. Limitation of Liability. Under no circumstances and under no legal theory,
74+
whether in tort (including negligence), contract, or otherwise, shall the Licensor
75+
be liable to anyone for any indirect, special, incidental, or consequential damages
76+
of any character arising as a result of this License or the use of the Original Work
77+
including, without limitation, damages for loss of goodwill, work stoppage,
78+
computer failure or malfunction, or any and all other commercial damages or
79+
losses. This limitation of liability shall not apply to the extent applicable law
80+
prohibits such limitation.
81+
9. Acceptance and Termination. If, at any time, You expressly assented to this
82+
License, that assent indicates your clear and irrevocable acceptance of this
83+
License and all of its terms and conditions. If You distribute or communicate
84+
copies of the Original Work or a Derivative Work, You must make a reasonable
85+
effort under the circumstances to obtain the express assent of recipients to the
86+
terms of this License. This License conditions your rights to undertake the
87+
activities listed in Section 1, including your right to create Derivative Works
88+
based upon the Original Work, and doing so without honoring these terms and
89+
conditions is prohibited by copyright law and international treaty. Nothing in this
90+
License is intended to affect copyright exceptions and limitations (including 'fair
91+
use' or 'fair dealing'). This License shall terminate immediately and You may no
92+
longer exercise any of the rights granted to You by this License upon your failure
93+
to honor the conditions in Section 1(c).
94+
10. Termination for Patent Action. This License shall terminate automatically and
95+
You may no longer exercise any of the rights granted to You by this License as of
96+
the date You commence an action, including a cross-claim or counterclaim,
97+
against Licensor or any licensee alleging that the Original Work infringes a
98+
patent. This termination provision shall not apply for an action alleging patent
99+
infringement by combinations of the Original Work with other software or
100+
hardware.
101+
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this
102+
License may be brought only in the courts of a jurisdiction wherein the Licensor
103+
resides or in which Licensor conducts its primary business, and under the laws of
104+
that jurisdiction excluding its conflict-of-law provisions. The application of the
105+
United Nations Convention on Contracts for the International Sale of Goods is
106+
expressly excluded. Any use of the Original Work outside the scope of this
107+
License or after its termination shall be subject to the requirements and penalties
108+
of copyright or patent law in the appropriate jurisdiction. This section shall
109+
survive the termination of this License.
110+
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking
111+
damages relating thereto, the prevailing party shall be entitled to recover its costs
112+
and expenses, including, without limitation, reasonable attorneys' fees and costs
113+
incurred in connection with such action, including any appeal of such action. This
114+
section shall survive the termination of this License.
115+
13. Miscellaneous. If any provision of this License is held to be unenforceable, such
116+
provision shall be reformed only to the extent necessary to make it enforceable.
117+
14. Definition of "You" in This License. "You" throughout this License, whether in
118+
upper or lower case, means an individual or a legal entity exercising rights under,
119+
and complying with all of the terms of, this License. For legal entities, "You"
120+
includes any entity that controls, is controlled by, or is under common control
121+
with you. For purposes of this definition, "control" means (i) the power, direct or
122+
indirect, to cause the direction or management of such entity, whether by contract
123+
or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding
124+
shares, or (iii) beneficial ownership of such entity.
125+
15. Right to Use. You may use the Original Work in all ways not otherwise restricted
126+
or conditioned by this License or by law, and Licensor promises not to interfere
127+
with or be responsible for such uses by You.
128+
16. Modification of This License. This License is Copyright � 2005 Lawrence
129+
Rosen. Permission is granted to copy, distribute, or communicate this License
130+
without modification. Nothing in this License permits You to modify this License
131+
as applied to the Original Work or to Derivative Works. However, You may
132+
modify the text of this License and copy, distribute or communicate your
133+
modified version (the "Modified License") and apply it to other original works of
134+
authorship subject to the following conditions: (i) You may not indicate in any
135+
way that your Modified License is the "Open Software License" or "OSL" and
136+
you may not use those names in the name of your Modified License; (ii) You
137+
must replace the notice specified in the first paragraph above with the notice
138+
"Licensed under <insert your license name here>" or with a notice of your own
139+
that is not confusingly similar to the notice in this License; and (iii) You may not
140+
claim that your original works are open source software unless your Modified
141+
License has been approved by Open Source Initiative (OSI) and You comply with
142+
its license review and certification process.
143+

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,57 @@
1-
StackExchange_DisableAdvancedSearch Magento Module
2-
===
1+
# DisableAdvancedSearch Magento 1 Extension
32

4-
**Q:** How to disable Advanced Search?
3+
This extension adds availability to disable search by SKU, even when SKU is globally set to searchable.
4+
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/00cbeb80e2684a15ab47da813ccfff0b)](https://www.codacy.com/app/sreichel/magento-StackExchange_DisableAdvancedSearch?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=sreichel/magento-StackExchange_DisableAdvancedSearch&amp;utm_campaign=Badge_Grade)
6+
[![Maintainability](https://api.codeclimate.com/v1/badges/4e6a23b1b3806c12ec76/maintainability)](https://codeclimate.com/github/sreichel/magento-StackExchange_DisableAdvancedSearch/maintainability)
7+
[![Test Coverage](https://api.codeclimate.com/v1/badges/4e6a23b1b3806c12ec76/test_coverage)](https://codeclimate.com/github/sreichel/magento-StackExchange_DisableAdvancedSearch/test_coverage)
8+
9+
## Facts
10+
- version: 1.0.0
11+
- extension key: StackExchange_DisableAdvancedSearch
12+
- [extension on GitHub](https://github.com/sreichel/magento-StackExchange_DisableAdvancedSearch)
13+
14+
### Description
15+
[How to disable Advanced Search?](https://magento.stackexchange.com/questions/36088/how-to-disable-advanced-search)
516

617
> How can I disable advanced search feature in Magento?
718
>
819
> Even you remove the links from frontend using layouts, if someone who knows Magento URL's accesses **/catalogsearch/advanced** will get the Advanced Search page.
920
10-
**Source:** https://magento.stackexchange.com/questions/36088/how-to-disable-advanced-search
21+
### Requirements
22+
- PHP >= 5.4.0
23+
24+
### Compatibility
25+
- Magento >= 1.5
26+
27+
#### Installation Instructions
28+
- via modman
29+
```
30+
modman clone https://github.com/sreichel/magento-StackExchange_DisableAdvancedSearch.git
31+
```
32+
- via composer
33+
```
34+
composer require mse-sv3n/disable-advanced-search
35+
```
36+
37+
#### Uninstallation
38+
- via modman
39+
```
40+
modman remove magento-stackexchange-disableadvancesdsearch
41+
```
42+
- via composer
43+
```
44+
composer remove mse-sv3n/disable-advanced-search
45+
```
46+
47+
### Usage
48+
1. get to config section and enable/disable function
49+
50+
### Support
51+
If you have any issues with this extension, open an issue on [GitHub](https://github.com/sreichel/magento-StackExchange_DisableAdvancedSearch/issues).
52+
53+
### Contribution
54+
Any contribution is highly appreciated. The best way to contribute code is to open a [pull request on GitHub](https://help.github.com/articles/using-pull-requests).
55+
56+
### License
57+
[OSL - Open Software Licence 3.0](http://opensource.org/licenses/osl-3.0.php)

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
2-
"name": "stackexchange/stackexchange-disable-advancedsearch",
2+
"name": "mse-sv3n/disable-advanced-search",
33
"type": "magento-module",
4+
"license": "OSL-3.0",
45
"description": "Disable advanced search on storeview scope",
56
"homepage": "https://github.com/sreichel/magento-StackExchange_DisableAdvancedSearch",
6-
"require": {
7-
"magento-hackathon/magento-composer-installer": "*"
8-
},
97
"authors": [
108
{
119
"name": "Sven Reichel",
10+
"homepage":"https://magento.stackexchange.com/users/46249/sv3n",
1211
"email": "github-sr@hotmail.com",
1312
"role": "Author/Maintainer"
1413
}
15-
]
14+
],
15+
"require": {
16+
"magento-hackathon/magento-composer-installer": "*"
17+
}
1618
}

src/app/code/community/StackExchange/DisableAdvancedSearch/Helper/Data.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,29 @@
99

1010
/**
1111
* Data helper
12+
* @SuppressWarnings(PHPMD.CamelCaseClassName)
13+
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
1214
*/
1315
class StackExchange_DisableAdvancedSearch_Helper_Data extends Mage_Core_Helper_Abstract
1416
{
1517
/** @var string $_moduleName Module name */
16-
protected $_moduleName = 'StackExchange_DisableAdvancedSearch';
18+
protected $_moduleName = 'StackExchange_DisableAdvancedSearch'; // phpcs:ignore
19+
20+
/**
21+
* @return bool
22+
* @SuppressWarnings(PHPMD.StaticAccess)
23+
*/
24+
public function isNotEnabled()
25+
{
26+
return !Mage::getStoreConfigFlag('catalog/search/enable_advanced_search');
27+
}
28+
29+
/**
30+
* @return string
31+
* @SuppressWarnings(PHPMD.StaticAccess)
32+
*/
33+
public function getNoRoutePath()
34+
{
35+
return $this->_getUrl(Mage::getStoreConfig('web/default/cms_no_route'));
36+
}
1737
}

src/app/code/community/StackExchange/DisableAdvancedSearch/Model/Observer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Observer Model
12+
* @SuppressWarnings(PHPMD.CamelCaseClassName)
1213
*/
1314
class StackExchange_DisableAdvancedSearch_Model_Observer
1415
{
@@ -17,12 +18,14 @@ class StackExchange_DisableAdvancedSearch_Model_Observer
1718
*
1819
* @param Varien_Event_Observer $observer
1920
* @return void
21+
* @SuppressWarnings(PHPMD.StaticAccess)
2022
*/
2123
public function disableAdvancedSearch(Varien_Event_Observer $observer)
2224
{
23-
if (!Mage::getStoreConfigFlag('catalog/search/enable_advanced_search')) {
24-
$path = Mage::getStoreConfig('web/default/cms_no_route');
25-
$observer->getControllerAction()->getResponse()->setRedirect(Mage::getUrl($path));
25+
/** @var StackExchange_DisableAdvancedSearch_Helper_Data $helper */
26+
$helper = Mage::helper('stackexchange_disable_advancedsearch');
27+
if ($helper->isNotEnabled()) {
28+
$observer->getControllerAction()->getResponse()->setRedirect($helper->getNoRoutePath());
2629
}
2730
}
2831
}

src/app/code/community/StackExchange/DisableAdvancedSearch/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<config>
33
<modules>
44
<StackExchange_DisableAdvancedSearch>
5-
<version>0.0.2</version>
5+
<version>1.0.0</version>
66
</StackExchange_DisableAdvancedSearch>
77
</modules>
88
<global>

0 commit comments

Comments
 (0)