Skip to content

Commit d6317fc

Browse files
author
maxiloc
committed
Merge pull request #314 from algolia/develop
1.5.3 release
2 parents 522de94 + dd3a282 commit d6317fc

35 files changed

+437
-235
lines changed

Algolia_Algoliasearch.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Algolia_Algoliasearch>
55
<active>true</active>
66
<codePool>community</codePool>
7-
<version>1.5.2</version>
7+
<version>1.5.3</version>
88
</Algolia_Algoliasearch>
99
</modules>
1010
</config>

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
## Change Log
22

3+
### 1.5.3
4+
5+
- UPDATED: added a config to disable logging
6+
- UPDATED: better instant search UI
7+
- FIX: various design improvements
8+
- FIX: take into account "Include in Navigation" for categories
9+
- FIX: sorting in instant search page
10+
- FIX: wrong price for configurable products
11+
- FIX: mass action delete
12+
313
### 1.5.2
414

515
==== BREAKING CHANGES ====

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This extension replaces the default search of Magento with a typo-tolerant, fast
77

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

10-
![Latest version](https://img.shields.io/badge/latest-1.5.2-green.svg)
10+
![Latest version](https://img.shields.io/badge/latest-1.5.3-green.svg)
1111
![Magento 1.6.2](https://img.shields.io/badge/magento-1.6.2-blue.svg)
1212
![Magento 1.7.1](https://img.shields.io/badge/magento-1.7.1-blue.svg)
1313
![Magento 1.8.1](https://img.shields.io/badge/magento-1.8.1-blue.svg)

code/Helper/Algoliahelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstract
1313
{
1414
protected $client;
15-
private $config;
15+
protected $config;
1616

1717
public function __construct()
1818
{

code/Helper/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
5656
const AUTOCOMPLETE_SELECTOR = 'algoliasearch/advanced/autocomplete_selector';
5757

5858
const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
59-
const LOGGING_ENABLED = 'dev/log/active';
59+
const LOGGING_ENABLED = 'algoliasearch/credentials/debug';
6060

6161
protected $_productTypeMap = array();
6262

code/Helper/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
2525

2626
public function __construct()
2727
{
28-
\AlgoliaSearch\Version::$custom_value = " Magento (1.5.2)";
28+
\AlgoliaSearch\Version::$custom_value = " Magento (1.5.3)";
2929

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

@@ -427,7 +427,7 @@ public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $pag
427427
$this->stopEmulation($emulationInfoPage);
428428
}
429429

430-
private function getProductsRecords($storeId, $collection)
430+
protected function getProductsRecords($storeId, $collection)
431431
{
432432
$indexData = array();
433433

code/Helper/Entity/Categoryhelper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public function getCategoryCollectionQuery($storeId, $categoryIds = null)
5757
{
5858
$storeRootCategoryPath = sprintf('%d/%d', $this->getRootCategoryId(), Mage::app()->getStore($storeId)->getRootCategoryId());
5959

60-
$index_name = $this->getIndexName($storeId);
61-
6260
$categories = Mage::getResourceModel('catalog/category_collection'); /** @var $categories Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
6361

6462
$unserializedCategorysAttrs = $this->config->getCategoryAdditionalAttributes($storeId);
@@ -74,6 +72,7 @@ public function getCategoryCollectionQuery($storeId, $categoryIds = null)
7472
->addUrlRewriteToResult()
7573
->addIsActiveFilter()
7674
->setStoreId($storeId)
75+
->addAttributeToFilter('include_in_menu', '1')
7776
->addAttributeToSelect(array_merge(array('name'), $additionalAttr))
7877
->addFieldToFilter('level', array('gt' => 1));
7978

code/Helper/Entity/Producthelper.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function setSettings($storeId)
234234

235235
$suffix_index_name = 'group_' . $group_id;
236236

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

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

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

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

@@ -258,7 +258,7 @@ public function setSettings($storeId)
258258
}
259259
}
260260

261-
private function getFields($store)
261+
protected function getFields($store)
262262
{
263263
$tax_helper = Mage::helper('tax');
264264

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

274-
private function formatPrice($price, $includeContainer, $currency_code)
274+
protected function formatPrice($price, $includeContainer, $currency_code)
275275
{
276276
if (!isset(static::$_currencies[$currency_code]))
277277
{
@@ -286,7 +286,7 @@ private function formatPrice($price, $includeContainer, $currency_code)
286286
return $price;
287287
}
288288

289-
private function handlePrice(&$product, $sub_products, &$customData)
289+
protected function handlePrice(&$product, $sub_products, &$customData)
290290
{
291291
$fields = $this->getFields($product->getStore());
292292
$customer_groups_enabled = $this->config->isCustomerGroupsEnabled($product->getStoreId());
@@ -371,7 +371,7 @@ private function handlePrice(&$product, $sub_products, &$customData)
371371
}
372372
}
373373

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

386-
if ($type == 'grouped' || $type == 'configurable')
386+
if ($type == 'grouped')
387387
{
388388
if (count($sub_products) > 0)
389389
{
@@ -508,6 +508,7 @@ public function getObject(Mage_Catalog_Model_Product $product)
508508
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
509509
->addAttributeToSelect('name')
510510
->addAttributeToFilter('entity_id', $_categoryIds)
511+
->addAttributeToFilter('include_in_menu', '1')
511512
->addFieldToFilter('level', array('gt' => 1))
512513
->addIsActiveFilter();
513514

code/Helper/Logger.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
44
{
5-
private $enabled;
6-
private $config;
7-
private $timers = array();
8-
private $stores = array();
5+
protected $enabled;
6+
protected $config;
7+
protected $timers = array();
8+
protected $stores = array();
99

1010
public function __construct()
1111
{
@@ -53,11 +53,13 @@ public function stop($action)
5353

5454
public function log($message)
5555
{
56-
Mage::log($message, null, 'algolia.log');
56+
if ($this->config->isLoggingEnabled()) {
57+
Mage::log($message, null, 'algolia.log');
58+
}
5759
}
5860

59-
private function formatTime($begin, $end)
61+
protected function formatTime($begin, $end)
6062
{
6163
return ($end - $begin).'sec';
6264
}
63-
}
65+
}

code/Model/Indexer/Algolia.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
55
const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
66

77
/** @var Algolia_Algoliasearch_Model_Resource_Engine */
8-
private $engine;
9-
private $config;
8+
protected $engine;
9+
protected $config;
1010

1111
public static $product_categories = array();
12-
private static $credential_error = false;
12+
protected static $credential_error = false;
1313

1414
/** @var Algolia_Algoliasearch_Helper_Logger */
15-
private $logger;
15+
protected $logger;
1616

1717
public function __construct()
1818
{
@@ -196,7 +196,15 @@ protected function _registerCatalogProductEvent(Mage_Index_Model_Event $event)
196196
}
197197

198198
$reindexData['catalogsearch_force_reindex'] = TRUE;
199-
$reindexData['catalogsearch_product_ids'] = $actionObject->getProductIds();
199+
200+
if ($actionObject->getIsDeleted())
201+
{
202+
$reindexData['catalogsearch_delete_product_id'] = $actionObject->getProductIds();
203+
}
204+
else
205+
{
206+
$reindexData['catalogsearch_product_ids'] = $actionObject->getProductIds();
207+
}
200208

201209
foreach ($reindexData as $k => $v)
202210
{

0 commit comments

Comments
 (0)