Skip to content

Commit 593d4b4

Browse files
author
Jan Petr
authored
Merge pull request #1011 from algolia/fix/customer_group
Display default price when customer group is 0
2 parents 5520055 + 73abd4a commit 593d4b4

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

app/design/frontend/base/default/template/algoliasearch/autocomplete/product.phtml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ $config = Mage::helper('algoliasearch/config');
55

66
/** @var Mage_Customer_Model_Session $session */
77
$session = Mage::getSingleton('customer/session');
8-
$group_id = $session->getCustomerGroupId();
8+
$customerGroupId = $session->getCustomerGroupId();
99

10-
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
11-
$price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
10+
$storeId = Mage::app()->getStore()->getStoreId();
11+
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
12+
13+
$priceKey = '.'.$currencyCode.'.default';
14+
if ($config->isCustomerGroupsEnabled($storeId) && $customerGroupId !== 0) {
15+
$priceKey = '.'.$currencyCode.'.group_'.$customerGroupId;
16+
}
1217

1318
?>
1419

@@ -38,15 +43,15 @@ $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreI
3843
</div>
3944

4045
<div class="algoliasearch-autocomplete-price">
41-
<span class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
42-
{{price<?php echo $price_key; ?>_formated}}
46+
<span class="after_special {{#price<?php echo $priceKey; ?>_original_formated}}promotion{{/price<?php echo $priceKey; ?>_original_formated}}">
47+
{{price<?php echo $priceKey; ?>_formated}}
4348
</span>
4449

45-
{{#price<?php echo $price_key; ?>_original_formated}}
50+
{{#price<?php echo $priceKey; ?>_original_formated}}
4651
<span class="before_special">
47-
{{price<?php echo $price_key; ?>_original_formated}}
52+
{{price<?php echo $priceKey; ?>_original_formated}}
4853
</span>
49-
{{/price<?php echo $price_key; ?>_original_formated}}
54+
{{/price<?php echo $priceKey; ?>_original_formated}}
5055
</div>
5156
</div>
5257
</a>

app/design/frontend/base/default/template/algoliasearch/instantsearch/hit-item.phtml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ $config = Mage::helper('algoliasearch/config');
55

66
/** @var Mage_Customer_Model_Session $session */
77
$session = Mage::getSingleton('customer/session');
8-
$group_id = $session->getCustomerGroupId();
8+
$customerGroupId = $session->getCustomerGroupId();
99

10-
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
11-
$price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
10+
$storeId = Mage::app()->getStore()->getStoreId();
11+
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
12+
13+
$priceKey = '.'.$currencyCode.'.default';
14+
if ($config->isCustomerGroupsEnabled($storeId) && $customerGroupId !== 0) {
15+
$priceKey = '.'.$currencyCode.'.group_'.$customerGroupId;
16+
}
1217

1318
?>
1419

@@ -35,15 +40,15 @@ $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreI
3540
<div class="price-wrapper">
3641
<div>
3742
<span
38-
class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
39-
{{price<?php echo $price_key; ?>_formated}}
43+
class="after_special {{#price<?php echo $priceKey; ?>_original_formated}}promotion{{/price<?php echo $priceKey; ?>_original_formated}}">
44+
{{price<?php echo $priceKey; ?>_formated}}
4045
</span>
4146

42-
{{#price<?php echo $price_key; ?>_original_formated}}
47+
{{#price<?php echo $priceKey; ?>_original_formated}}
4348
<span class="before_special">
44-
{{price<?php echo $price_key; ?>_original_formated}}
49+
{{price<?php echo $priceKey; ?>_original_formated}}
4550
</span>
46-
{{/price<?php echo $price_key; ?>_original_formated}}
51+
{{/price<?php echo $priceKey; ?>_original_formated}}
4752
</div>
4853
</div>
4954
</div>

app/design/frontend/base/default/template/algoliasearch/internals/configuration.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ $currencySymbol = $app->getLocale()->currency($currencyCode)->getSymbol();
3434
$session = Mage::getSingleton('customer/session');
3535
$customerGroupId = $session->getCustomerGroupId();
3636

37-
$priceKey = $config->isCustomerGroupsEnabled($storeId) ? '.'.$currencyCode.'.group_'.$customerGroupId : '.'.$currencyCode.'.default';
37+
$priceKey = '.'.$currencyCode.'.default';
38+
if ($config->isCustomerGroupsEnabled($storeId) && $customerGroupId !== 0) {
39+
$priceKey = '.'.$currencyCode.'.group_'.$customerGroupId;
40+
}
3841

3942
$query = '';
4043
$refinementKey = '';

0 commit comments

Comments
 (0)