Version Notes
Fixed an issue with Magento 1.7.x.x. Now works as expected for all supported versions 1.5.x.x, 1.6.x.x, and 1.7.x.x.
Download this release
Release Info
| Developer | Activo Extensions |
| Extension | Catalog_Search_Refinement |
| Version | 1.0.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.3 to 1.0.5
- app/code/community/Activo/CatalogSearch/Model/Mysql4/Fulltext.php +2 -1
- app/code/community/Activo/CatalogSearch/Model/Resource/Fulltext.php +111 -0
- app/code/community/Activo/CatalogSearch/etc/config.xml +5 -0
- app/code/community/Activo/News/Model/Feed.php +0 -47
- app/code/community/Activo/News/etc/config.xml +0 -47
- app/etc/modules/Activo_News.xml +0 -31
- package.xml +7 -6
app/code/community/Activo/CatalogSearch/Model/Mysql4/Fulltext.php
CHANGED
|
@@ -28,9 +28,10 @@
|
|
| 28 |
*
|
| 29 |
* @category CatalogSearch
|
| 30 |
* @package Activo_CatalogSearch
|
| 31 |
-
* @copyright Copyright (c)
|
| 32 |
* @license OSL 3.0
|
| 33 |
*/
|
|
|
|
| 34 |
class Activo_CatalogSearch_Model_Mysql4_Fulltext extends Mage_CatalogSearch_Model_Mysql4_Fulltext
|
| 35 |
{
|
| 36 |
/**
|
| 28 |
*
|
| 29 |
* @category CatalogSearch
|
| 30 |
* @package Activo_CatalogSearch
|
| 31 |
+
* @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
|
| 32 |
* @license OSL 3.0
|
| 33 |
*/
|
| 34 |
+
|
| 35 |
class Activo_CatalogSearch_Model_Mysql4_Fulltext extends Mage_CatalogSearch_Model_Mysql4_Fulltext
|
| 36 |
{
|
| 37 |
/**
|
app/code/community/Activo/CatalogSearch/Model/Resource/Fulltext.php
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Activo
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 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://opensource.org/licenses/osl-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 extensions@activo.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 18 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 19 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 20 |
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
| 21 |
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 22 |
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 23 |
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 24 |
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 25 |
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 26 |
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
| 27 |
+
* THE POSSIBILITY OF SUCH DAMAGE.
|
| 28 |
+
*
|
| 29 |
+
* @category CatalogSearch
|
| 30 |
+
* @package Activo_CatalogSearch
|
| 31 |
+
* @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
|
| 32 |
+
* @license OSL 3.0
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class Activo_CatalogSearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext
|
| 36 |
+
{
|
| 37 |
+
/**
|
| 38 |
+
* Prepare results for query
|
| 39 |
+
*
|
| 40 |
+
* @param Mage_CatalogSearch_Model_Fulltext $object
|
| 41 |
+
* @param string $queryText
|
| 42 |
+
* @param Mage_CatalogSearch_Model_Query $query
|
| 43 |
+
* @return Mage_CatalogSearch_Model_Resource_Fulltext
|
| 44 |
+
*/
|
| 45 |
+
public function prepareResult($object, $queryText, $query)
|
| 46 |
+
{
|
| 47 |
+
$adapter = $this->_getWriteAdapter();
|
| 48 |
+
if (!$query->getIsProcessed()) {
|
| 49 |
+
$searchType = $object->getSearchType($query->getStoreId());
|
| 50 |
+
|
| 51 |
+
$preparedTerms = Mage::getResourceHelper('catalogsearch')
|
| 52 |
+
->prepareTerms($queryText, $query->getMaxQueryWords());
|
| 53 |
+
|
| 54 |
+
$bind = array();
|
| 55 |
+
$like = array();
|
| 56 |
+
$likeCond = '';
|
| 57 |
+
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
|
| 58 |
+
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
| 59 |
+
) {
|
| 60 |
+
$helper = Mage::getResourceHelper('core');
|
| 61 |
+
$words = Mage::helper('core/string')->splitWords($queryText, true, $query->getMaxQueryWords());
|
| 62 |
+
foreach ($words as $word) {
|
| 63 |
+
$like[] = $helper->getCILike('s.data_index', $word, array('position' => 'any'));
|
| 64 |
+
}
|
| 65 |
+
if ($like) {
|
| 66 |
+
$likeCond = '(' . join(' AND ', $like) . ')';
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
$mainTableAlias = 's';
|
| 70 |
+
$fields = array(
|
| 71 |
+
'query_id' => new Zend_Db_Expr($query->getId()),
|
| 72 |
+
'product_id',
|
| 73 |
+
);
|
| 74 |
+
$select = $adapter->select()
|
| 75 |
+
->from(array($mainTableAlias => $this->getMainTable()), $fields)
|
| 76 |
+
->joinInner(array('e' => $this->getTable('catalog/product')),
|
| 77 |
+
'e.entity_id = s.product_id',
|
| 78 |
+
array())
|
| 79 |
+
->where($mainTableAlias.'.store_id = ?', (int)$query->getStoreId());
|
| 80 |
+
|
| 81 |
+
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
|
| 82 |
+
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE
|
| 83 |
+
) {
|
| 84 |
+
$bind[':query'] = implode(' ', $preparedTerms[0]);
|
| 85 |
+
$where = Mage::getResourceHelper('catalogsearch')
|
| 86 |
+
->chooseFulltext($this->getMainTable(), $mainTableAlias, $select);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
if ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
|
| 90 |
+
$where .= ($where ? ' OR ' : '') . $likeCond;
|
| 91 |
+
} elseif ($likeCond != '' && $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE) {
|
| 92 |
+
$select->columns(array('relevance' => new Zend_Db_Expr(0)));
|
| 93 |
+
$where = $likeCond;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
if ($where != '') {
|
| 97 |
+
$select->where($where);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
$sql = $adapter->insertFromSelect($select,
|
| 101 |
+
$this->getTable('catalogsearch/result'),
|
| 102 |
+
array(),
|
| 103 |
+
Varien_Db_Adapter_Interface::INSERT_ON_DUPLICATE);
|
| 104 |
+
$adapter->query($sql, $bind);
|
| 105 |
+
|
| 106 |
+
$query->setIsProcessed(1);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
return $this;
|
| 110 |
+
}
|
| 111 |
+
}
|
app/code/community/Activo/CatalogSearch/etc/config.xml
CHANGED
|
@@ -7,6 +7,11 @@
|
|
| 7 |
<fulltext>Activo_CatalogSearch_Model_Mysql4_Fulltext</fulltext>
|
| 8 |
</rewrite>
|
| 9 |
</catalogsearch_mysql4>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</models>
|
| 11 |
</global>
|
| 12 |
</config>
|
| 7 |
<fulltext>Activo_CatalogSearch_Model_Mysql4_Fulltext</fulltext>
|
| 8 |
</rewrite>
|
| 9 |
</catalogsearch_mysql4>
|
| 10 |
+
<catalogsearch_resource>
|
| 11 |
+
<rewrite>
|
| 12 |
+
<fulltext>Activo_CatalogSearch_Model_Resource_Fulltext</fulltext>
|
| 13 |
+
</rewrite>
|
| 14 |
+
</catalogsearch_resource>
|
| 15 |
</models>
|
| 16 |
</global>
|
| 17 |
</config>
|
app/code/community/Activo/News/Model/Feed.php
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Activo
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Commercial Software License
|
| 8 |
-
* that is available through the world-wide-web at this URL:
|
| 9 |
-
* http://extensions.activo.com/license_professional
|
| 10 |
-
* If you did not receive a copy of the license and are unable to
|
| 11 |
-
* obtain it through the world-wide-web, please send an email
|
| 12 |
-
* to extensions@activo.com so we can send you a copy immediately.
|
| 13 |
-
*
|
| 14 |
-
* @category
|
| 15 |
-
* @package news
|
| 16 |
-
* @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
|
| 17 |
-
* @license Open Source
|
| 18 |
-
*/
|
| 19 |
-
|
| 20 |
-
//http://www.nicksays.co.uk/2009/05/magento-custom-admin-notifications/
|
| 21 |
-
class Activo_News_Model_Feed extends Mage_AdminNotification_Model_Feed
|
| 22 |
-
{
|
| 23 |
-
/**
|
| 24 |
-
* Retrieve feed url
|
| 25 |
-
*
|
| 26 |
-
* @return string
|
| 27 |
-
*/
|
| 28 |
-
public function getFeedUrl()
|
| 29 |
-
{
|
| 30 |
-
if (is_null($this->_feedUrl)) {
|
| 31 |
-
$this->_feedUrl = 'http://extensions.activo.com/adminrss.php?s='.Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_UNSECURE_URL);
|
| 32 |
-
}
|
| 33 |
-
return $this->_feedUrl;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
public function observe()
|
| 37 |
-
{
|
| 38 |
-
$model = Mage::getModel('news/feed');
|
| 39 |
-
$model->checkUpdate();
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
// public function getFrequency()
|
| 43 |
-
// {
|
| 44 |
-
// return 1;
|
| 45 |
-
// }
|
| 46 |
-
|
| 47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Activo/News/etc/config.xml
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<!--
|
| 3 |
-
/**
|
| 4 |
-
* Activo
|
| 5 |
-
*
|
| 6 |
-
* NOTICE OF LICENSE
|
| 7 |
-
*
|
| 8 |
-
* This source file is subject to the Commercial Software License
|
| 9 |
-
* that is available through the world-wide-web at this URL:
|
| 10 |
-
* http://extensions.activo.com/license_professional
|
| 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 extensions@activo.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* @category
|
| 16 |
-
* @package news
|
| 17 |
-
* @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
|
| 18 |
-
* @license Open Source
|
| 19 |
-
*/
|
| 20 |
-
-->
|
| 21 |
-
<config>
|
| 22 |
-
<modules>
|
| 23 |
-
<Activo_News>
|
| 24 |
-
<version>1.0.0</version>
|
| 25 |
-
</Activo_News>
|
| 26 |
-
</modules>
|
| 27 |
-
<global>
|
| 28 |
-
<models>
|
| 29 |
-
<news>
|
| 30 |
-
<class>Activo_News_Model</class>
|
| 31 |
-
</news>
|
| 32 |
-
</models>
|
| 33 |
-
</global>
|
| 34 |
-
<adminhtml>
|
| 35 |
-
<events>
|
| 36 |
-
<controller_action_predispatch>
|
| 37 |
-
<observers>
|
| 38 |
-
<activo_news>
|
| 39 |
-
<type>singleton</type>
|
| 40 |
-
<class>news/feed</class>
|
| 41 |
-
<method>observe</method>
|
| 42 |
-
</activo_news>
|
| 43 |
-
</observers>
|
| 44 |
-
</controller_action_predispatch>
|
| 45 |
-
</events>
|
| 46 |
-
</adminhtml>
|
| 47 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Activo_News.xml
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<!--
|
| 3 |
-
/**
|
| 4 |
-
* Activo
|
| 5 |
-
*
|
| 6 |
-
* NOTICE OF LICENSE
|
| 7 |
-
*
|
| 8 |
-
* This source file is subject to the Commercial Software License
|
| 9 |
-
* that is available through the world-wide-web at this URL:
|
| 10 |
-
* http://extensions.activo.com/license_professional
|
| 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 extensions@activo.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* @category
|
| 16 |
-
* @package news
|
| 17 |
-
* @copyright Copyright (c) 2012 Activo Inc. (http://www.activo.com)
|
| 18 |
-
* @license Open Source
|
| 19 |
-
*/
|
| 20 |
-
-->
|
| 21 |
-
<config>
|
| 22 |
-
<modules>
|
| 23 |
-
<Activo_News>
|
| 24 |
-
<active>true</active>
|
| 25 |
-
<codePool>community</codePool>
|
| 26 |
-
<depends>
|
| 27 |
-
<Mage_AdminNotification />
|
| 28 |
-
</depends>
|
| 29 |
-
</Activo_News>
|
| 30 |
-
</modules>
|
| 31 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Catalog_Search_Refinement</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Allow your users to refine their search when they add a search term for FREE!</summary>
|
| 10 |
<description>Allow your users to refine their search when they add a search term for FREE! This is a free and open source magento extension that modifies the Magento default search functionality to allow search refinement.</description>
|
| 11 |
-
<notes>Fixed
|
|
|
|
| 12 |
<authors><author><name>Activo Extensions</name><user>activo</user><email>extensions@activo.com</email></author></authors>
|
| 13 |
-
<date>2012-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Activo"><dir name="CatalogSearch"><dir><dir name="Model"><dir name="Mysql4"><file name="Fulltext.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
-
<dependencies><required><php><min>5.2.0</min><max>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Catalog_Search_Refinement</name>
|
| 4 |
+
<version>1.0.5</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Allow your users to refine their search when they add a search term for FREE!</summary>
|
| 10 |
<description>Allow your users to refine their search when they add a search term for FREE! This is a free and open source magento extension that modifies the Magento default search functionality to allow search refinement.</description>
|
| 11 |
+
<notes>Fixed an issue with Magento 1.7.x.x. Now works as expected for all supported versions 1.5.x.x, 1.6.x.x, and 1.7.x.x.
|
| 12 |
+
</notes>
|
| 13 |
<authors><author><name>Activo Extensions</name><user>activo</user><email>extensions@activo.com</email></author></authors>
|
| 14 |
+
<date>2012-12-14</date>
|
| 15 |
+
<time>19:17:41</time>
|
| 16 |
+
<contents><target name="magecommunity"><dir name="Activo"><dir name="CatalogSearch"><dir><dir name="Model"><dir name="Mysql4"><file name="Fulltext.php" hash="02a4bf6cc5090de8605a242612f850ab"/></dir><dir name="Resource"><file name="Fulltext.php" hash="71d88eccccce4fabca70935b7a1763b2"/></dir></dir><dir name="etc"><file name="config.xml" hash="ab892a3b705dc2038b8a085ceb030977"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Activo_CatalogSearch.xml" hash="806d0b66144cbe87baf556b372f4b4e3"/></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
| 19 |
</package>
|
