Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
49dc7f0
Use protected instead of private for methods and fields
lazyguru Jan 8, 2016
b3905f0
Merge pull request #289 from lazyguru/protected-not-private
Jan 8, 2016
c53a5e0
UI enhancements
kokliKo Jan 14, 2016
c4bacff
Add config setting to control logging
lazyguru Jan 15, 2016
bbba3ed
Merge pull request #292 from algolia/doc-ui
Jan 15, 2016
e8c59f9
Change to use config helper
lazyguru Jan 15, 2016
515168d
Merge pull request #294 from lazyguru/add-logging-switch
Jan 15, 2016
17a352e
improve double search bar ui
maxiloc Jan 19, 2016
7db9c2e
erge branch 'develop' of github.com:algolia/algoliasearch-magento int…
maxiloc Jan 19, 2016
2822a3a
cosmetic
maxiloc Jan 20, 2016
fcfd62a
Fix massAction delete not working. Fixes #296
maxiloc Jan 20, 2016
d7c01b7
Use Include in Navigation Menu to say if we index a category or not
maxiloc Jan 28, 2016
4df8046
changed wording in system.xml
sammarcus Jan 30, 2016
70d245b
Merge pull request #305 from sammarcus/patch-2
Feb 1, 2016
62ffd6c
fix sorting on instantsearch
maxiloc Feb 8, 2016
865861c
Merge branch 'develop' of github.com:algolia/algoliasearch-magento in…
maxiloc Feb 8, 2016
92ee37e
improve dockerfile
maxiloc Feb 8, 2016
c71c15c
Fix typos in topsearch.phtml
thaiphan Feb 8, 2016
73d8564
Fixed wrong price for configurable product
maxiloc Feb 9, 2016
66a3aef
Disable instant search by default
maxiloc Feb 10, 2016
3fba70f
Merge pull request #310 from thaiphan/patch-1
Feb 10, 2016
7b4fd63
small cosmetic improvements
maxiloc Feb 10, 2016
c86092c
Merge branch 'develop' of github.com:algolia/algoliasearch-magento in…
maxiloc Feb 10, 2016
4693cef
bump to 1.5.3
maxiloc Feb 10, 2016
dd3a282
add 1.5.3 release
maxiloc Feb 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Algolia_Algoliasearch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Algolia_Algoliasearch>
<active>true</active>
<codePool>community</codePool>
<version>1.5.2</version>
<version>1.5.3</version>
</Algolia_Algoliasearch>
</modules>
</config>
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Change Log

### 1.5.3

- UPDATED: added a config to disable logging
- UPDATED: better instant search UI
- FIX: various design improvements
- FIX: take into account "Include in Navigation" for categories
- FIX: sorting in instant search page
- FIX: wrong price for configurable products
- FIX: mass action delete

### 1.5.2

==== BREAKING CHANGES ====
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This extension replaces the default search of Magento with a typo-tolerant, fast

See features and benefits of [Algolia Search Extension for Magento](https://community.algolia.com/magento).

![Latest version](https://img.shields.io/badge/latest-1.5.2-green.svg)
![Latest version](https://img.shields.io/badge/latest-1.5.3-green.svg)
![Magento 1.6.2](https://img.shields.io/badge/magento-1.6.2-blue.svg)
![Magento 1.7.1](https://img.shields.io/badge/magento-1.7.1-blue.svg)
![Magento 1.8.1](https://img.shields.io/badge/magento-1.8.1-blue.svg)
Expand Down
2 changes: 1 addition & 1 deletion code/Helper/Algoliahelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstract
{
protected $client;
private $config;
protected $config;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion code/Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
const AUTOCOMPLETE_SELECTOR = 'algoliasearch/advanced/autocomplete_selector';

const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
const LOGGING_ENABLED = 'dev/log/active';
const LOGGING_ENABLED = 'algoliasearch/credentials/debug';

protected $_productTypeMap = array();

Expand Down
4 changes: 2 additions & 2 deletions code/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract

public function __construct()
{
\AlgoliaSearch\Version::$custom_value = " Magento (1.5.2)";
\AlgoliaSearch\Version::$custom_value = " Magento (1.5.3)";

$this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');

Expand Down Expand Up @@ -427,7 +427,7 @@ public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $pag
$this->stopEmulation($emulationInfoPage);
}

private function getProductsRecords($storeId, $collection)
protected function getProductsRecords($storeId, $collection)
{
$indexData = array();

Expand Down
3 changes: 1 addition & 2 deletions code/Helper/Entity/Categoryhelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public function getCategoryCollectionQuery($storeId, $categoryIds = null)
{
$storeRootCategoryPath = sprintf('%d/%d', $this->getRootCategoryId(), Mage::app()->getStore($storeId)->getRootCategoryId());

$index_name = $this->getIndexName($storeId);

$categories = Mage::getResourceModel('catalog/category_collection'); /** @var $categories Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */

$unserializedCategorysAttrs = $this->config->getCategoryAdditionalAttributes($storeId);
Expand All @@ -74,6 +72,7 @@ public function getCategoryCollectionQuery($storeId, $categoryIds = null)
->addUrlRewriteToResult()
->addIsActiveFilter()
->setStoreId($storeId)
->addAttributeToFilter('include_in_menu', '1')
->addAttributeToSelect(array_merge(array('name'), $additionalAttr))
->addFieldToFilter('level', array('gt' => 1));

Expand Down
15 changes: 8 additions & 7 deletions code/Helper/Entity/Producthelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function setSettings($storeId)

$suffix_index_name = 'group_' . $group_id;

$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.$suffix_index_name : $values['attribute'];
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.$currencies[0].'.'.$suffix_index_name : $values['attribute'];

$mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');

Expand All @@ -244,7 +244,7 @@ public function setSettings($storeId)
}
else
{
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.'default' : $values['attribute'];
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.$currencies[0].'.'.'default' : $values['attribute'];

$mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');

Expand All @@ -258,7 +258,7 @@ public function setSettings($storeId)
}
}

private function getFields($store)
protected function getFields($store)
{
$tax_helper = Mage::helper('tax');

Expand All @@ -271,7 +271,7 @@ private function getFields($store)
return array('price' => false, 'price_with_tax' => true);
}

private function formatPrice($price, $includeContainer, $currency_code)
protected function formatPrice($price, $includeContainer, $currency_code)
{
if (!isset(static::$_currencies[$currency_code]))
{
Expand All @@ -286,7 +286,7 @@ private function formatPrice($price, $includeContainer, $currency_code)
return $price;
}

private function handlePrice(&$product, $sub_products, &$customData)
protected function handlePrice(&$product, $sub_products, &$customData)
{
$fields = $this->getFields($product->getStore());
$customer_groups_enabled = $this->config->isCustomerGroupsEnabled($product->getStoreId());
Expand Down Expand Up @@ -371,7 +371,7 @@ private function handlePrice(&$product, $sub_products, &$customData)
}
}

if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
if ($type == 'grouped' || $type == 'bundle')
{
$min = PHP_INT_MAX;
$max = 0;
Expand All @@ -383,7 +383,7 @@ private function handlePrice(&$product, $sub_products, &$customData)
list($min, $max) = $_priceModel->getTotalPrices($product, null, $with_tax, true);
}

if ($type == 'grouped' || $type == 'configurable')
if ($type == 'grouped')
{
if (count($sub_products) > 0)
{
Expand Down Expand Up @@ -508,6 +508,7 @@ public function getObject(Mage_Catalog_Model_Product $product)
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToFilter('entity_id', $_categoryIds)
->addAttributeToFilter('include_in_menu', '1')
->addFieldToFilter('level', array('gt' => 1))
->addIsActiveFilter();

Expand Down
16 changes: 9 additions & 7 deletions code/Helper/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
{
private $enabled;
private $config;
private $timers = array();
private $stores = array();
protected $enabled;
protected $config;
protected $timers = array();
protected $stores = array();

public function __construct()
{
Expand Down Expand Up @@ -53,11 +53,13 @@ public function stop($action)

public function log($message)
{
Mage::log($message, null, 'algolia.log');
if ($this->config->isLoggingEnabled()) {
Mage::log($message, null, 'algolia.log');
}
}

private function formatTime($begin, $end)
protected function formatTime($begin, $end)
{
return ($end - $begin).'sec';
}
}
}
18 changes: 13 additions & 5 deletions code/Model/Indexer/Algolia.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';

/** @var Algolia_Algoliasearch_Model_Resource_Engine */
private $engine;
private $config;
protected $engine;
protected $config;

public static $product_categories = array();
private static $credential_error = false;
protected static $credential_error = false;

/** @var Algolia_Algoliasearch_Helper_Logger */
private $logger;
protected $logger;

public function __construct()
{
Expand Down Expand Up @@ -196,7 +196,15 @@ protected function _registerCatalogProductEvent(Mage_Index_Model_Event $event)
}

$reindexData['catalogsearch_force_reindex'] = TRUE;
$reindexData['catalogsearch_product_ids'] = $actionObject->getProductIds();

if ($actionObject->getIsDeleted())
{
$reindexData['catalogsearch_delete_product_id'] = $actionObject->getProductIds();
}
else
{
$reindexData['catalogsearch_product_ids'] = $actionObject->getProductIds();
}

foreach ($reindexData as $k => $v)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Model/Indexer/Algoliaadditionalsections.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Mage
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';

/** @var Algolia_Algoliasearch_Model_Resource_Engine */
private $engine;
private $config;
protected $engine;
protected $config;

public function __construct()
{
Expand Down
9 changes: 4 additions & 5 deletions code/Model/Indexer/Algoliacategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';

/** @var Algolia_Algoliasearch_Model_Resource_Engine */
private $engine;
private $config;
protected $engine;
protected $config;

private static $credential_error = false;
protected static $credential_error = false;

public function __construct()
{
Expand Down Expand Up @@ -70,15 +70,14 @@ protected function _registerCatalogCategoryEvent(Mage_Index_Model_Event $event)
$category = $event->getDataObject();
$productIds = $category->getAffectedProductIds();

if (! $category->getData('is_active'))
if (! $category->getData('is_active') || ! $category->getData('include_in_menu'))
{
$event->addNewData('catalogsearch_delete_category_id', array_merge(array($category->getId()), $category->getAllChildren(TRUE)));

if ($productIds)
{
$event->addNewData('catalogsearch_update_product_id', $productIds);
}

}
elseif ($productIds)
{
Expand Down
4 changes: 2 additions & 2 deletions code/Model/Indexer/Algoliapages.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Mage_Index_Model_
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';

/** @var Algolia_Algoliasearch_Model_Resource_Engine */
private $engine;
private $config;
protected $engine;
protected $config;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions code/Model/Indexer/Algoliaqueuerunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
class Algolia_Algoliasearch_Model_Indexer_Algoliaqueuerunner extends Mage_Index_Model_Indexer_Abstract
{
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
private $config;
protected $config;
/** @var Algolia_Algoliasearch_Model_Queue */
private $queue;
protected $queue;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions code/Model/Indexer/Algoliasuggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Mage_Index_
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';

/** @var Algolia_Algoliasearch_Model_Resource_Engine */
private $engine;
private $config;
protected $engine;
protected $config;

public function __construct()
{
Expand Down
6 changes: 3 additions & 3 deletions code/Model/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Algolia_Algoliasearch_Model_Queue
/** @var Algolia_Algoliasearch_Helper_Logger */
protected $logger;

private $by_page;
protected $by_page;

public function __construct()
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public function runCron()
$this->run($nbJobs);
}

private function mergeable($j1, $j2)
protected function mergeable($j1, $j2)
{
if ($j1['class'] !== $j2['class'])
return false;
Expand Down Expand Up @@ -79,7 +79,7 @@ private function mergeable($j1, $j2)
return true;
}

private function sortAndMergeJob($old_jobs)
protected function sortAndMergeJob($old_jobs)
{
usort($old_jobs, function ($a, $b) {
if (strcmp($a['class'], $b['class']) !== 0)
Expand Down
22 changes: 11 additions & 11 deletions code/Model/Resource/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
{
const ONE_TIME_AMOUNT = 100;
/** @var Algolia_Algoliasearch_Helper_Logger */
private $logger;
private $queue;
private $config;
private $product_helper;
private $category_helper;
private $suggestion_helper;
protected $logger;
protected $queue;
protected $config;
protected $product_helper;
protected $category_helper;
protected $suggestion_helper;

public function _construct()
{
Expand All @@ -37,11 +37,11 @@ public function removeProducts($storeId = null, $product_ids = null)
{
$ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);

if (is_array($product_ids) == false)
$product_ids = array($product_ids);

foreach ($ids as $id)
{
if (is_array($product_ids) == false)
$product_ids = array($product_ids);

$by_page = $this->config->getNumberOfElementByPage();

if (is_array($product_ids) && count($product_ids) > $by_page)
Expand Down Expand Up @@ -236,7 +236,7 @@ public function rebuildProductIndex($storeId = null, $productIds = null)
return $this;
}

private function _rebuildCategoryIndex($storeId, $categoryIds = null)
protected function _rebuildCategoryIndex($storeId, $categoryIds = null)
{
if ($categoryIds == null || count($categoryIds) == 0)
{
Expand All @@ -257,7 +257,7 @@ private function _rebuildCategoryIndex($storeId, $categoryIds = null)
return $this;
}

private function _rebuildProductIndex($storeId, $productIds = null)
protected function _rebuildProductIndex($storeId, $productIds = null)
{
if ($productIds == null || count($productIds) == 0)
{
Expand Down
6 changes: 3 additions & 3 deletions code/Model/Resource/Fulltext.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M

/** Empty because we need it to do nothing (no mysql stuff), Indexing is handled by Model/Indexer/Algolia */

private $engine;
private $config;
protected $engine;
protected $config;

/** @var Algolia_Algoliasearch_Helper_Logger */
private $logger;
protected $logger;

public function __construct()
{
Expand Down
Loading