Skip to content

Commit a91de23

Browse files
author
maxiloc
committed
Merge pull request #332 from algolia/develop
1.5.4 release
2 parents 6d8a2b9 + c16b535 commit a91de23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+100
-74
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Algolia_Algoliasearch.xml

100755100644
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.3</version>
7+
<version>1.5.4</version>
88
</Algolia_Algoliasearch>
99
</modules>
1010
</config>

CHANGELOG.md

Lines changed: 7 additions & 0 deletions

LICENSE.txt

100755100644
File mode changed.

README.md

Lines changed: 1 addition & 1 deletion

code/Helper/Data.php

100755100644
Lines changed: 1 addition & 1 deletion
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.3)";
28+
\AlgoliaSearch\Version::$custom_value = " Magento (1.5.4)";
2929

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

code/Helper/Entity/Helper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ protected function castProductObject(&$productData)
4444
{
4545
foreach ($productData as $key => &$data)
4646
{
47+
if ($key === 'sku') {
48+
continue;
49+
}
4750
$data = $this->try_cast($data);
4851

4952
if (is_array($data) === false)

code/Helper/Entity/Producthelper.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -224,35 +224,31 @@ public function setSettings($storeId)
224224

225225
foreach ($sorting_indices as $values)
226226
{
227-
if ($this->config->isCustomerGroupsEnabled($storeId))
227+
if ($this->config->isCustomerGroupsEnabled($storeId) && strpos($values['attribute'], 'price') !== false)
228228
{
229-
if (strpos($values['attribute'], 'price') !== false)
229+
foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group)
230230
{
231-
foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group)
232-
{
233-
$group_id = (int)$group->getData('customer_group_id');
231+
$group_id = (int)$group->getData('customer_group_id');
234232

235-
$suffix_index_name = 'group_' . $group_id;
233+
$suffix_index_name = 'group_' . $group_id;
236234

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

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

241-
$this->algolia_helper->setSettings($this->getIndexName($storeId).'_'.$values['attribute'].'_'. $suffix_index_name .'_'.$values['sort'], $mergeSettings);
242-
}
239+
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_' . $suffix_index_name . '_' . $values['sort'], $mergeSettings);
243240
}
244241
}
245242
else
246243
{
247-
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'].'.'.$currencies[0].'.'.'default' : $values['attribute'];
244+
$sort_attribute = strpos($values['attribute'], 'price') !== false ? $values['attribute'] . '.' . $currencies[0] . '.' . 'default' : $values['attribute'];
248245

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

251248
if ($values['attribute'] === 'price')
252-
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' .$values['attribute']. '_default_' . $values['sort'], $mergeSettings);
249+
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_default_' . $values['sort'], $mergeSettings);
253250
else
254-
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' .$values['attribute']. '_' . $values['sort'], $mergeSettings);
255-
251+
$this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_' . $values['sort'], $mergeSettings);
256252
}
257253
}
258254
}
@@ -355,6 +351,8 @@ protected function handlePrice(&$product, $sub_products, &$customData)
355351

356352
if ($special_price && $special_price < $customData[$field][$currency_code]['group_' . $group_id])
357353
{
354+
$customData[$field][$currency_code]['group_' . $group_id . '_original_formated'] = $customData[$field][$currency_code]['default_formated'];
355+
358356
$customData[$field][$currency_code]['group_' . $group_id] = $special_price;
359357
$customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $this->formatPrice($special_price, false, $currency_code);
360358
}
@@ -381,6 +379,8 @@ protected function handlePrice(&$product, $sub_products, &$customData)
381379
$_priceModel = $product->getPriceModel();
382380

383381
list($min, $max) = $_priceModel->getTotalPrices($product, null, $with_tax, true);
382+
$min = (double) $min;
383+
$max = (double) $max;
384384
}
385385

386386
if ($type == 'grouped')
@@ -429,13 +429,17 @@ protected function handlePrice(&$product, $sub_products, &$customData)
429429
if ($min != $max && $min <= $customData[$field][$currency_code]['group_' . $group_id])
430430
{
431431
$customData[$field][$currency_code]['group_' . $group_id] = 0;
432-
$customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $dashed_format;
433432
}
433+
else
434+
{
435+
$customData[$field][$currency_code]['group_' . $group_id] = $customData[$field][$currency_code]['default'];
436+
}
437+
438+
$customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $dashed_format;
434439
}
435440
}
436441
}
437442

438-
439443
if ($customData[$field][$currency_code]['default'] == 0)
440444
{
441445
$customData[$field][$currency_code]['default'] = $min;

code/Model/Observer.php

100755100644
File mode changed.

code/etc/config.xml

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<config>
33
<modules>
44
<Algolia_Algoliasearch>
5-
<version>1.5.3</version>
5+
<version>1.5.4</version>
66
</Algolia_Algoliasearch>
77
</modules>
88
<frontend>

0 commit comments

Comments
 (0)