Skip to content

Commit

Permalink
[shopsys] switch domain default currencies (#1542)
Browse files Browse the repository at this point in the history
* switch domain default currencies

- all domains now use EUR
- the only exception is second domain that uses CZK
  • Loading branch information
vitek-rostislav authored Mar 18, 2020
1 parent fb3fa6f commit 837c860
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions src/DataFixtures/Demo/CurrencyDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
public function load(ObjectManager $manager)
{
/**
* The "CZK" currency is created in database migration.
* The "CZK" and "EUR" currencies are created in database migrations.
* @see \Shopsys\FrameworkBundle\Migrations\Version20180603135342
*/
$currencyCzk = $this->currencyFacade->getById(1);
Expand All @@ -62,15 +62,7 @@ public function load(ObjectManager $manager)
$currencyCzk = $this->currencyFacade->edit($currencyCzk->getId(), $currencyData);
$this->addReference(self::CURRENCY_CZK, $currencyCzk);

if (count($this->domain->getAll()) > 1) {
$currencyData = $this->currencyDataFactory->create();
$currencyData->name = 'Euro';
$currencyData->code = Currency::CODE_EUR;
$currencyData->exchangeRate = '25';
$currencyData->minFractionDigits = Currency::DEFAULT_MIN_FRACTION_DIGITS;
$currencyData->roundingType = Currency::ROUNDING_TYPE_HUNDREDTHS;
$currencyEuro = $this->currencyFacade->create($currencyData);
$this->addReference(self::CURRENCY_EUR, $currencyEuro);
}
$currencyEur = $this->currencyFacade->getById(2);
$this->addReference(self::CURRENCY_EUR, $currencyEur);
}
}
4 changes: 2 additions & 2 deletions src/DataFixtures/Demo/SettingValueDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ protected function setDomainDefaultCurrency(int $domainId): void
{
if ($domainId === Domain::SECOND_DOMAIN_ID) {
/** @var \Shopsys\FrameworkBundle\Model\Pricing\Currency\Currency $defaultCurrency */
$defaultCurrency = $this->getReference(CurrencyDataFixture::CURRENCY_EUR);
$defaultCurrency = $this->getReference(CurrencyDataFixture::CURRENCY_CZK);
} else {
/** @var \Shopsys\FrameworkBundle\Model\Pricing\Currency\Currency $defaultCurrency */
$defaultCurrency = $this->getReference(CurrencyDataFixture::CURRENCY_CZK);
$defaultCurrency = $this->getReference(CurrencyDataFixture::CURRENCY_EUR);
}
$this->setting->setForDomain(PricingSetting::DEFAULT_DOMAIN_CURRENCY, $defaultCurrency->getId(), $domainId);
}
Expand Down

0 comments on commit 837c860

Please sign in to comment.