magento-2 configure custom field product price in admin

49 Views Asked by At

I want new tab, group in admin custom field product sku, price, sale price and a button update price. where admin can change above custom price dynamically enter image description here

I write code in Namespace/ModuleName/etc/adminhtml/system.xml. Help me how can make it dynamically.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="irshad_custom" translate="label" sortOrder="10">
            <label>Custom Tab</label>
        </tab>
        <section id="test_section" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>Price Configuration</label>
            <tab>irshad_custom</tab>
            <resource>Irshad_Ahmad::config_ahmad</resource>
            <group id="custom_settings" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Manage Configuration</label>
                <field id="enable" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="product_sku" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Product SKU</label>
                    <comment>Manage multiple squ with comma separated</comment>
                    <field id="enable">1</field>
                </field>
                <field id="price" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Price</label>
                    <validate>required-entry</validate>
                    <comment>Please store price</comment>
                    <field id="enable">1</field>
                </field>
                <field id="sell_price" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Sell Price</label>
                    <validate>required-entry</validate>
                    <comment>Please store Sell price</comment>
                    <field id="enable">1</field>
                </field>
                <field id="update_price" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Update Price</label>
                    <validate>required-entry</validate>
                </field>
                <field id="update_button" translate="label" type="button" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Update</label>
                </field>
            </group>
        </section>
    </system>
</config>
0

There are 0 best solutions below