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?
@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:
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.
Great insights! I always appreciate posts like this.
Thank you and good luck.
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