I have created two dynamic rows one by DataProvider way and one by ui_component.In Ven\Mod\Ui\DataProvider\Product\Form\Modifier\MyField getting currency symbol with this function.

In dynamic rows children I added:

'children' => [

            static::FIELD_PRICE_NAME => $this->getPriceFieldConfig(30)


and defined function as:

protected function getPriceFieldConfig($sortOrder)
return [
    'arguments' => [
        'data' => [
            'config' => [
                'label' => __('Amount'),
                'componentType' => Field::NAME,
                'component' => 'Magento_Catalog/js/components/custom-options-component',
                'formElement' => Input::NAME,
                'dataScope' => static::FIELD_PRICE_NAME,
                'dataType' => Number::NAME,
                'addbefore' => $this->getCurrencySymbol(),
                'addbeforePool' => $this->productOptionsPrice->prefixesToOptionArray(),
                'sortOrder' => $sortOrder,
                'validation' => [
                    'validate-number' => true

and defined

'addbefore' => $this->getCurrencySymbol(),

function as:

protected function getCurrencySymbol()
    return $this->storeManager->getStore()->getBaseCurrency()->getCurrencySymbol();

Same in screen shot(By DataProvider): enter image description here Below is screen shot of dynamic rows created by ui_component way: enter image description here

I have xml code at Ven/Mod/view/adminhtml/ui_component/product_form.xml as Form fields like:

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="testingproduct">    
           <field name="min_val">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Amount</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="source" xsi:type="string">faq</item>

I want to know how can I get currency symbol in Amount field dynamic row created by DataProvider way into the Amount field created using ui_component.

It will be highly appreciated if you can give code example. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.