Question

Here I set two dynamic fields in one configuration but second dynamic field does not work enter image description here

My system.xml file

<?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="ccc" translate="label" sortOrder="10">
            <label>Checkout Restriction</label>
        </tab>
        <section id="restriction" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>Restriction</label>
            <tab>ccc</tab>
            <resource>Ccc_CheckoutRestriction::restriction_config</resource>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                <label>General Configuration</label>
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Limit Cart Module Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="min_qty_allow" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Minimun Qty Allowed</label>
                    <backend_model>Ccc\CheckoutRestriction\Block\Adminhtml\Config\Backend\ArraySerialized</backend_model>
                    <frontend_model>Ccc\CheckoutRestriction\Block\Adminhtml\MinqtyAllow</frontend_model>
                </field>
                <field id="min_msg" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Add Minimum Quantity Alert Message</label>
                </field>
                 <field id="max_qty_allow" translate="label" sortOrder="4" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Maximun Qty Allowed</label>
                    <backend_model>Ccc\CheckoutRestriction\Block\Adminhtml\Config\Backend\ArraySerialized</backend_model>
                    <frontend_model>Ccc\CheckoutRestriction\Block\Adminhtml\MaxqtyAllow</frontend_model>
                </field>
                <field id="max_msg" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Add Maximun Quantity Alert Message</label>
                </field>
                 
            </group>
        </section>
    </system>
</config>
Was it helpful?

Solution

Seems like something is missing in your backend or frontend model Please check this file - Ccc\CheckoutRestriction\Block\Adminhtml\MinqtyAllow
Compare with - Ccc\CheckoutRestriction\Block\Adminhtml\MaxqtyAllow
Your XML file looks perfect.
Please check/compare the code of your block model files with each other -

     <backend_model>Ccc\CheckoutRestriction\Block\Adminhtml\Config\Backend\ArraySerialized</backend_model>
     <frontend_model>Ccc\CheckoutRestriction\Block\Adminhtml\MaxqtyAllow</frontend_model>

You will find some mis-match there, if not then please share the code of all 4 block model class files, so that we can find the difference in that.
I hope it will work for you.
Best of Luck.
Thanks,
Vibhore

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top