Site icon MageComp Blog

How to get Product List in System Configuration in Magento 2

How to get Product list in system configuration

In this competitive market of E-commerce, it’s necessary to deliver something beyond the expectations to your customers. Because having a great user experience encourages your customer to purchase more and more from your store. At MageComp, we do the same we imagine, we build, try and test extension, again and again until we get satisfied to deliver a perfect product to our valuable customers. So, they do not need to worry once they set-n-up.

Recently, one of the customers came with a requirement of highlighting some of the store products by making easy backend selection to serve personalized product experience. And we started coding, at that time we have decided to display product list on system configuration to make an easy selection of products using the multi-select box. Here is another blog series to get Product List in System Configuration in Magento 2.

First we need to add this below code to ‘System.xml’ file available ad below location to add multi select box to system configuration.
app\code\vendor\extension\etc\adminhtml\system.xml

	
    VENDOR\EXTENSION\Model\Config\Productlist

Now create another file ‘Productlist.php’ inside your extension folder with below code to fetch and display products list.

app\code\vendor\extension\Model\Config\Productlist.php

Lastly, Comment below if you face an issue while using this code.
Happy Coding!
Exit mobile version