cancel
Showing results for 
Search instead for 
Did you mean: 

Allow easy selection of products/categories/customers/... in custom backend forms

0 Kudos

Allow easy selection of products/categories/customers/... in custom backend forms

Feature request from bgalileo, posted on GitHub Jan 14, 2015

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.

8 Comments
Not applicable
Status changed to: Investigating
 
Not applicable

Comment from bgalileo, posted on GitHub Jan 14, 2015

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.

Not applicable

Comment from verklov, posted on GitHub Jan 22, 2015

@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!

Not applicable

Comment from bgalileo, posted on GitHub Jan 25, 2015

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

Not applicable

Comment from verklov, posted on GitHub Jan 26, 2015

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

Not applicable

Comment from quynhvv, posted on GitHub Feb 17, 2016

Hi guys, How we can make a chooser button in a custom form in back-end to choose the categories?

Not applicable

Comment from nobuttsalex, posted on GitHub Apr 27, 2016

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. m2categoriesselector

Not applicable

Comment from GianniPDF, posted on GitHub Jun 10, 2016

@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