Skip to content

Commit f4e8905

Browse files
authored
Merge branch 'develop' into bugfix/referenceContainer
2 parents 2c0ed67 + 7326355 commit f4e8905

25 files changed

+647
-552
lines changed

Block/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public function getConfiguration()
309309
'relevance' => __('Relevance'),
310310
'categories' => __('Categories'),
311311
'products' => __('Products'),
312+
'suggestions' => __('Suggestions'),
312313
'searchBy' => __('Search by'),
313314
'searchForFacetValuesPlaceholder' => __('Search for other ...'),
314315
'showMore' => __('Show more products'),

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# CHANGE LOG
22

3+
## 3.10.2
4+
5+
### UPDATES
6+
- Ensured compatibility of the extension with Magento 2.4.6
7+
- Updated the code to allow for convenient customization of object serialization
8+
- Enhanced comments for non-castable attributes in system configuration
9+
- Updated the code to ensure that accurate prices are indexed for bundle products when the dynamic price attribute is turned off
10+
- Updated autocomplete to include userToken and enablePersonalization tag in search requests
11+
12+
13+
14+
### Bug Fixes
15+
- Fixed issue with section.label in autocomplete
16+
- Resolved issue with nbOfQuerySuggestions in autocomplete
17+
- Fixed routing error related to disabling searchBox for instant search page
18+
- Resolved deployment issue with prefixed Magento database tables
19+
- Fixed spacing issue with pagination on instant search page
20+
21+
22+
## 3.10.1
23+
24+
### UPDATES
25+
- Added recommended js version in readme file.
26+
27+
### Bug Fixes
28+
- Add caching on category name lookup (scoped by store) to fix slowness in indexing.
29+
- Prevent loss of synonyms while copying from tmp index during Indexing in Algolia Dashboard.
30+
- Fixed the translation issue of labels in Algolia autocomplete dropdown
31+
- Ensured compatibility of the extension with PHP 7.4
32+
- Resolved the deployment issue related to prefixing Magento database tables
33+
334

435
## 3.10.0
536

Helper/Entity/CategoryHelper.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class CategoryHelper
5050
protected $categoryRepository;
5151

5252
protected $isCategoryVisibleInMenuCache;
53+
protected $coreCategories;
5354
protected $idColumn;
5455
protected $categoryAttributes;
5556
protected $rootCategoryId = -1;
@@ -548,7 +549,12 @@ public function isCategoryVisibleInMenu($categoryId, $storeId)
548549
*/
549550
public function getCoreCategories($filterNotIncludedCategories = true, $storeId = null)
550551
{
551-
$key = $filterNotIncludedCategories ? 'filtered' : 'non_filtered';
552+
// Cache category look up by store scope
553+
$key = ($filterNotIncludedCategories ? 'filtered' : 'non_filtered') . "-$storeId";
554+
555+
if (isset($this->coreCategories[$key])) {
556+
return $this->coreCategories[$key];
557+
}
552558

553559
$collection = $this->categoryCollectionFactory->create()
554560
->distinct(true)
@@ -562,14 +568,14 @@ public function getCoreCategories($filterNotIncludedCategories = true, $storeId
562568
$collection->addAttributeToFilter('include_in_menu', '1');
563569
}
564570

565-
$coreCategories[$key] = [];
571+
$this->coreCategories[$key] = [];
566572

567573
/** @var \Magento\Catalog\Model\Category $category */
568574
foreach ($collection as $category) {
569-
$coreCategories[$key][$category->getId()] = $category;
575+
$this->coreCategories[$key][$category->getId()] = $category;
570576
}
571577

572-
return $coreCategories[$key];
578+
return $this->coreCategories[$key];
573579
}
574580

575581
/**

Helper/Entity/Product/PriceManager/Bundle.php

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ class Bundle extends ProductWithChildren
1919
*/
2020
protected function addAdditionalData($product, $withTax, $subProducts, $currencyCode, $field) {
2121
$data = $this->getMinMaxPrices($product, $withTax, $subProducts, $currencyCode);
22-
$dashedFormat = $this->getDashedPriceFormat($data['min_price'], $data['max'], $currencyCode);
23-
if ($data['min_price'] !== $data['max']) {
24-
$this->handleBundleNonEqualMinMaxPrices($field, $currencyCode, $data['min_price'], $data['max'], $dashedFormat);
22+
$dashedFormat = $this->getDashedPriceFormat($data['min_price'], $data['max_price'], $currencyCode);
23+
if ($data['min_price'] !== $data['max_price']) {
24+
$this->handleBundleNonEqualMinMaxPrices($field, $currencyCode, $data['min_price'], $data['max_price'], $dashedFormat);
2525
}
26-
$this->handleOriginalPrice($field, $currencyCode, $data['min_price'], $data['max'], $data['min_original'], $data['max_original']);
26+
27+
$this->handleOriginalPrice($field, $currencyCode, $data['min_price'], $data['max_price'], $data['min_original'], $data['max_original']);
2728
if (!$this->customData[$field][$currencyCode]['default']) {
28-
$this->handleZeroDefaultPrice($field, $currencyCode, $data['min_price'], $data['max']);
29+
$this->handleZeroDefaultPrice($field, $currencyCode, $data['min_price'], $data['max_price']);
2930
}
3031
if ($this->areCustomersGroupsEnabled) {
3132
$groupedDashedFormat = $this->getBundleDashedPriceFormat($data['min'], $data['max'], $currencyCode);
@@ -42,25 +43,29 @@ protected function addAdditionalData($product, $withTax, $subProducts, $currency
4243
*/
4344
protected function getMinMaxPrices(Product $product, $withTax, $subProducts, $currencyCode)
4445
{
45-
$regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
46+
$product->setData('website_id', $product->getStore()->getWebsiteId());
4647
$minPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
4748
$minOriginalPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
4849
$maxOriginalPrice = $product->getPriceInfo()->getPrice('regular_price')->getMaximalPrice()->getValue();
4950
$max = $product->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
5051
$minArray = [];
52+
$maxArray = [];
5153
foreach ($this->groups as $group) {
5254
$groupId = (int) $group->getData('customer_group_id');
53-
foreach ($subProducts as $subProduct) {
54-
$subProduct->setData('customer_group_id', $groupId);
55-
$subProductFinalPrice = $this->getTaxPrice($product, $subProduct->getPriceModel()->getFinalPrice(1, $subProduct), $withTax);
56-
$priceDiff = $subProduct->getPrice() - $subProductFinalPrice;
57-
$minArray[$groupId][] = $regularPrice - $priceDiff;
58-
}
55+
$product->setData('customer_group_id', $groupId);
56+
$minPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
57+
$minArray[$groupId] = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
58+
$maxArray[$groupId] = $product->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
59+
$product->setData('customer_group_id', null);
5960
}
6061

6162
$minPriceArray = [];
6263
foreach ($minArray as $groupId => $min) {
63-
$minPriceArray[$groupId] = min($min);
64+
$minPriceArray[$groupId] = $min;
65+
}
66+
$maxPriceArray = [];
67+
foreach ($maxArray as $groupId => $max) {
68+
$maxPriceArray[$groupId] = $max;
6469
}
6570

6671
if ($currencyCode !== $this->baseCurrencyCode) {
@@ -70,15 +75,15 @@ protected function getMinMaxPrices(Product $product, $withTax, $subProducts, $cu
7075
foreach ($minPriceArray as $groupId => $price) {
7176
$minPriceArray[$groupId] = $this->convertPrice($price, $currencyCode);
7277
}
73-
if ($min !== $max) {
78+
if ($minPrice !== $max) {
7479
$max = $this->convertPrice($max, $currencyCode);
7580
}
7681
}
77-
7882
return [
7983
'min' => $minPriceArray,
80-
'max' => $max,
84+
'max' => $maxPriceArray,
8185
'min_price' => $minPrice,
86+
'max_price' => $max,
8287
'min_original' => $minOriginalPrice,
8388
'max_original' => $maxOriginalPrice
8489
];
@@ -117,10 +122,10 @@ protected function handleBundleNonEqualMinMaxPrices($field, $currencyCode, $min,
117122
protected function getBundleDashedPriceFormat($minPrices, $max, $currencyCode) {
118123
$dashedFormatPrice = [];
119124
foreach ($minPrices as $groupId => $min) {
120-
if ($min === $max) {
125+
if ($min === $max[$groupId]) {
121126
$dashedFormatPrice [$groupId] = '';
122127
}
123-
$dashedFormatPrice[$groupId] = $this->formatPrice($min, $currencyCode) . ' - ' . $this->formatPrice($max, $currencyCode);
128+
$dashedFormatPrice[$groupId] = $this->formatPrice($min, $currencyCode) . ' - ' . $this->formatPrice($max[$groupId], $currencyCode);
124129
}
125130
return $dashedFormatPrice;
126131
}
@@ -139,12 +144,12 @@ protected function setFinalGroupPricesBundle($field, $currencyCode, $min, $max,
139144
foreach ($this->groups as $group) {
140145
$groupId = (int) $group->getData('customer_group_id');
141146
$this->customData[$field][$currencyCode]['group_' . $groupId] = $min[$groupId];
142-
if ($min === $max) {
147+
if ($min[$groupId] === $max[$groupId]) {
143148
$this->customData[$field][$currencyCode]['group_' . $groupId . '_formated'] =
144149
$this->customData[$field][$currencyCode]['default_formated'];
145150
} else {
146151
$this->customData[$field][$currencyCode]['group_' . $groupId . '_formated'] = $dashedFormat[$groupId];
147152
}
148153
}
149154
}
150-
}
155+
}

0 commit comments

Comments
 (0)