Skip to content

Commit

Permalink
Merge pull request #762 from Nosto/hotfix/5.4.2
Browse files Browse the repository at this point in the history
Hotfix/5.4.2
  • Loading branch information
olsi-qose authored Jan 14, 2022
2 parents f0a58e3 + 75b55c2 commit 56cb5d4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

### 5.4.2
* Send all active currencies formating to Nosto only when multi-currency is enabled

### 5.4.1
* Fix product availability building for products with OOS threshold

Expand Down
22 changes: 21 additions & 1 deletion Model/Meta/Account/Settings/Currencies/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@
use Magento\Store\Model\Store;
use Nosto\Model\Format;
use Nosto\Tagging\Logger\Logger as NostoLogger;
use Nosto\Tagging\Helper\Currency as NostoHelperCurrency;

class Builder
{
/** @var NostoLogger */
private $logger;

/** @var ManagerInterface */
private $eventManager;

/** @var CurrencyFactory */
private $currencyFactory;

/** @var LocaleResolver */
private $localeResolver;

/** @var NostoHelperCurrency */
private $nostoCurrencyHelper;

/* List of zero decimal currencies in compliance with ISO-4217 */
const ZERO_DECIMAL_CURRENCIES = [
'XOF',
Expand All @@ -77,17 +89,20 @@ class Builder
* @param NostoLogger $logger
* @param ManagerInterface $eventManager
* @param CurrencyFactory $currencyFactory
* @param NostoHelperCurrency $nostoCurrencyHelper
* @param LocaleResolver $localeResolver
*/
public function __construct(
NostoLogger $logger,
ManagerInterface $eventManager,
CurrencyFactory $currencyFactory,
NostoHelperCurrency $nostoCurrencyHelper,
LocaleResolver $localeResolver
) {
$this->logger = $logger;
$this->eventManager = $eventManager;
$this->currencyFactory = $currencyFactory;
$this->nostoCurrencyHelper = $nostoCurrencyHelper;
$this->localeResolver = $localeResolver;
}

Expand All @@ -110,7 +125,12 @@ public function build(Store $store)
$groupSymbol = $this->buildGroupSymbol($localeData, $defaultSet);
$precision = $this->getDecimalPrecision($priceFormat);

$currencyCodes = $store->getAvailableCurrencyCodes(true);
// Get other active currencies when multicurrency is enabled
if ($this->nostoCurrencyHelper->exchangeRatesInUse($store)) {
$currencyCodes = $store->getAvailableCurrencyCodes(true);
} else {
$currencyCodes = [$store->getBaseCurrencyCode()];
}
if (is_array($currencyCodes) && !empty($currencyCodes)) {
foreach ($currencyCodes as $currencyCode) {
$finalPrecision = $this->isZeroDecimalCurrency($currencyCode) ? 0 : $precision;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nosto/module-nostotagging",
"description": "Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.",
"type": "magento2-module",
"version": "5.4.1",
"version": "5.4.2",
"require-dev": {
"phpmd/phpmd": "^2.5",
"sebastian/phpcpd": "*",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
<!--suppress XmlUnboundNsPrefix -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Nosto_Tagging" setup_version="5.4.1"/>
<module name="Nosto_Tagging" setup_version="5.4.2"/>
</config>

0 comments on commit 56cb5d4

Please sign in to comment.