0

I am trying to create a new configuration for checking postcodes. Is it possible to add so many postcodes rather than creating one text field So I can pick which ever postcode by using type="select"

1 Answer 1

1

As far as I understand your question, I would suggest you create a select or multi-select field in Configuration. From which you can select whichever postcode you like.

Add code for select/multi-select field in Namespace/Module/etc/adminhtml/system.xml something like,

<!-- For Select Type Configuration -->
<field id="postcode" translate="label" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="1">
   <label>Select Postcode</label>
   <source_model>Namespace\Module\Model\Adminhtml\System\Postcode</source_model>
</field>


<!-- For Multiselect -->
<field id="postcode_multiselect" translate="label" sortOrder="2" type="multiselect" showInDefault="1" showInWebsite="1" showInStore="1">
   <label>Select Beauty Banners</label>
   <source_model>Namespace\Module\Model\Adminhtml\System\Postcode\Multiselect</source_model>
</field>

Created Source Model file to get ToArray function just like implemented in below link, https://magento.stackexchange.com/a/92863/45214

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.