diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertCurrencySymbolCategoryFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertCurrencySymbolCategoryFormActionGroup.xml new file mode 100644 index 0000000000000..1816eb7a93a21 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAssertCurrencySymbolCategoryFormActionGroup.xml @@ -0,0 +1,25 @@ + + + + + + + Check display currency symbol in category form + + + + + + + + {{baseCurrency}} + currencySymbol + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCatalogNavigateToCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCatalogNavigateToCategoryPageActionGroup.xml new file mode 100644 index 0000000000000..605b86f72cd68 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCatalogNavigateToCategoryPageActionGroup.xml @@ -0,0 +1,19 @@ + + + + + + + Navigate to Category Page + + + + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryDisplaySettingsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryDisplaySettingsSection.xml index daa00eb0a27b7..6070f29ba316a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryDisplaySettingsSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryDisplaySettingsSection.xml @@ -11,5 +11,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCheckCategoryFormWithChangedBaseCurrencyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCheckCategoryFormWithChangedBaseCurrencyTest.xml new file mode 100644 index 0000000000000..02c96fc006c9c --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCheckCategoryFormWithChangedBaseCurrencyTest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + <description value="Check category form with base currency which is different from USD"/> + <severity value="MINOR"/> + <group value="category"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + <!--Set Base Currency to Euro--> + <magentoCLI command="config:set {{SetCurrencyEURBaseConfig.path}} {{SetCurrencyEURBaseConfig.value}}" stepKey="setCurrencyBaseEUR"/> + <magentoCLI command="config:set {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForEUR.value}}" stepKey="setAllowedCurrencyEURandUSD"/> + <magentoCLI command="config:set {{SetDefaultCurrencyEURConfig.path}} {{SetDefaultCurrencyEURConfig.value}}" stepKey="setCurrencyDefaultEUR"/> + </before> + <after> + <!--Reset configurations--> + <magentoCLI command="config:set {{SetCurrencyUSDBaseConfig.path}} {{SetCurrencyUSDBaseConfig.value}}" stepKey="setCurrencyBaseUSD"/> + <magentoCLI command="config:set {{SetDefaultCurrencyUSDConfig.path}} {{SetDefaultCurrencyUSDConfig.value}}" stepKey="setCurrencyDefaultUSD"/> + <magentoCLI command="config:set {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}}" stepKey="setAllowedCurrencyUSD"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="AdminCatalogNavigateToCategoryPageActionGroup" stepKey="navigateToCategoryPage"/> + <actionGroup ref="AdminAssertCurrencySymbolCategoryFormActionGroup" stepKey="assertCurrencySymbol"> + <argument name="baseCurrency" value="€"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Ui/Component/Form/Field/FilterPriceRange.php b/app/code/Magento/Catalog/Ui/Component/Form/Field/FilterPriceRange.php new file mode 100644 index 0000000000000..c2c1ab23de6e7 --- /dev/null +++ b/app/code/Magento/Catalog/Ui/Component/Form/Field/FilterPriceRange.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Catalog\Ui\Component\Form\Field; + +use Magento\Framework\View\Element\UiComponent\ContextInterface; +use Magento\Framework\View\Element\UiComponentFactory; +use Magento\Ui\Component\Form\Field; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\Exception\LocalizedException; + +/*** + * Render Filter Price Range Field + * + * Class FilterPriceRange + */ +class FilterPriceRange extends Field +{ + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * FilterPriceRange constructor. + * + * @param ContextInterface $context + * @param UiComponentFactory $uiComponentFactory + * @param StoreManagerInterface $storeManager + * @param array $components + * @param array $data + */ + public function __construct( + ContextInterface $context, + UiComponentFactory $uiComponentFactory, + StoreManagerInterface $storeManager, + array $components = [], + array $data = [] + ) { + $this->storeManager = $storeManager; + parent::__construct($context, $uiComponentFactory, $components, $data); + } + + /** + * Add Currency Symbol To Field + * + * @return void + * @throws LocalizedException + */ + public function prepare() + { + parent::prepare(); + $config = $this->getData('config'); + $config['addbefore'] = $this->storeManager->getStore()->getBaseCurrency()->getCurrencySymbol(); + $this->setData('config', $config); + } +} diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml index f2afef1215017..a395bf0064499 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml @@ -340,7 +340,7 @@ <item name="breakLine" xsi:type="boolean">true</item> </item> </argument> - <field name="filter_price_range" formElement="input"> + <field name="filter_price_range" formElement="input" class="Magento\Catalog\Ui\Component\Form\Field\FilterPriceRange"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="source" xsi:type="string">category</item> @@ -354,7 +354,6 @@ <additionalClasses> <class name="admin__field-small">true</class> </additionalClasses> - <addBefore>$</addBefore> <label translate="true">Layered Navigation Price Step</label> </settings> </field>