cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Product Creation Form with Modifications on a Custom Module's URL/route

Displaying Product Creation Form with Modifications on a Custom Module's URL/route

I can currently hide or disable fields from magento create product form using modifier class referenced in a custom module's layout file but i dont want that to happen, instead i want the create product form to be shown on a custom module's url with disabled or hidden fields & the default product creation form module/url should be shown as is without any alterations.

 

How can i achieve this?

3 REPLIES 3

Re: Displaying Product Creation Form with Modifications on a Custom Module's URL/route


@raza19 wrote:

I can currently hide or disable fields from Magento create product form using modifier class referenced in a custom module's layout file but I don't want that to happen, instead, I want the Create Product form to be shown on a custom module's URL with disabled or hidden fields & the default product creation form module/url should be shown as is without any alterations. Subway Listens

 

How can I achieve this?


To display the product creation form with modifications on a custom module’s URL/route, you can create a custom controller and action that extends the default product creation controller and action. Here are the steps to do this:

  1. Create a custom controller and action that extends the default product creation controller and action.
  2. In the custom controller and action, you can modify the product creation form as needed.
  3. Create a custom layout file for the custom controller and action that references the modified product creation form.
  4. In the custom layout file, specify the custom URL/route for the custom controller and action.

Here is an example of how you can create a custom controller and action that extends the default product creation controller and action: 

namespace Vendor\Module\Controller\Adminhtml\Product;

use Magento\Backend\App\Action\Context;
use Magento\Catalog\Controller\Adminhtml\Product\NewAction as DefaultNewAction;

class NewAction extends DefaultNewAction
{
    public function execute()
    {
        // Modify the product creation form as needed
        // ...

        // Call the parent execute method to display the product creation form
        parent::execute();
    }
}

In this example, we are creating a custom controller and action that extends the default product creation controller and action. We are then modifying the product creation form as needed and calling the parent execute method to display the product creation form.

Re: Displaying Product Creation Form with Modifications on a Custom Module's URL/route

Great insights! I always appreciate posts like this.
Thank you and good luck.

 

 

Learn More About TellCampero Guest Experience Surveys

Re: Displaying Product Creation Form with Modifications on a Custom Module's URL/route

This is so helpful! The information is clear, concise, and exactly what I was searching for. Thank you for making it easy to understand! Mymilestonecard activation