Allow easy selection of products/categories/customers/... in custom backend forms
In Magento 1, there is no easy way to add a user-friendly product, category or customer selection widget to a custom form. There are ways to add the product, category, cms page and cms block chooser widgets to your form, but the process is neither well-documented nor obvious, and a customer chooser widget simply doesn't exist.
Since you often need to link information with specific customers, products or categories in custom modules, it should be easy to add a form element which allows the user to select one or multiple product/category/user IDs via the corresponding grids, which are then submitted together with the form.
Ideally, there would be an easy way to load any grid in a lightbox, let the user select one or multiple entries and then save the selected IDs in a hidden form element, but I don't know whether that's feasible.
@bgalileo, could you please provide some specific use case for us? We can hardly understand what are your steps and what you expect to achieve. Thank you!
Scenario: I'm writing a module which allows defining customer-specific prices for products. So I needed to create a backend form where backend users select a customer, select a product and enter a price. To achieve that, I had to:
- Create two subclasses of Mage_Adminhtml_Block_Widget_Grid which load the appropriate collections and set a rowClickCallback on those grids.
- Create to more actions in my controller for those two grids.
- Create a phtml file and add some JS to it which handles the row clicks.
If you want to enable backend users to change the selected product/customer later, even more custom JS is required.
I think that such a common task shouldn't require that much manual work. Instead, there should be an easier way to add a product/customer/… selector to a Mage_Adminhtml_Block_Widget_Form, like the following module provides: https://github.com/Jarlssen/Jarlssen_ChooserWidget
Got your point @bgalileo. Thank you for the clarification and additional information provided! We created the ticket for this improvement in the product backlog and will process it according to the priorities.
Internal ticket: MAGETWO-33049
Hi guys, How we can make a chooser button in a custom form in back-end to choose the categories?
Yes I am wanting to do the same, need to create a widget where multiple categories can be selected. I want to include the same category selector that is on the create product form. It must be possible to do it with the functionality that is already in M2 but cannot find how to use it.

@nobuttsalex I managed to de that with $categories = $fieldsetData->addField( 'categories', 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category', [ 'name' => 'categories', 'label' => __('Categories'), 'required' => TRUE, ] );
and adding < css src="Magento_Catalog::catalog/category-selector.css"/ > to your layout.
but having troubles trying to add the SKU Chooser like the one in Cart price rules
Thank you for your submission.
We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.
Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).
We are closing this GitHub ticket and have moved your request to the new forum.