I'm extending catalog product edit page for this I have extended the Edit.php file from vendor/magento-catalog/block/adminhtml/product. My Changes is applying, but when i save the product it's not saving.

Same functionality working in first released Magento 2 ver 1.0.0 beta, but it's not working in recently released both MEE and MCE (ver 2.0.0 and 2.0.2).

For this I have written code as below.


<?xml version="1.0"?>
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Learning_Custom" setup_version="1.0.0">
            <module name="Magento_Catalog"/>


namespace Learning\Custom\Block\Adminhtml\Product;

use \Magento\Catalog\Block\Adminhtml\Product\Edit;

class ProductEdit extends Edit

     * @var string
    protected $_template = 'catalog/product/edit.phtml';



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<preference for="Magento\Catalog\Block\Adminhtml\Product\Edit" type="Learning\Custom\Block\Adminhtml\Product\ProductEdit"/>



<h1> Hi I'm extending product edit page</h1>
//below is the product edit.phtml file coding here i'm not posting.

I have cleared the cache and I have ran php bin/magento setup:static-content:deploy. But still no luck.

Could you please suggest me on this?

  • This file name Learning/Custom/Block/Adminhtml/Product/Edit.php should be Learning/Custom/Block/Adminhtml/Product/ProductEdit.php – Marius Feb 11 '16 at 9:14
  • @Marius, it's a typing mistake. now see my thread is updated. – Bojjaiah Feb 11 '16 at 9:21
  • try putting in $_template = 'Learning_Custom::catalog/product/edit.phtml' – Marius Feb 11 '16 at 9:53
  • but standard way of overriding template files - devdocs? – prasad maganti Feb 11 '16 at 9:59

do you have the dependency defined ont the catalog module in your module.xml? This is important to ensure that your configuration overrides the catalog configuration:


You also might want to clean your var/generation folder. Depending on how the Product Block is instantiated this might also be an Issue

| improve this answer | |
  • Yes previously I have declared (sequence) but not posted here now see I have updated my thread. And I have cleared as you instructed to clear cache, var/generation, pub/static/adminhtml/Learning and var/view_preproccessed, but no luck. If I comment my extending it's working other wise it's not working. Could you please suggest me on this? – Bojjaiah Feb 11 '16 at 8:53
  • 1
    so you replace the edit.phtml template?. You are missing some logic from here then: github.com/magento/magento2/blob/develop/app/code/Magento/…. specially the javascript to init the form – David Verholen Feb 11 '16 at 9:31
  • @DavidVerholen, I decided just copy the entire code from above link and past from my edit.phtml file and added my custom code, now working fine. Here I have a question? Is you are given link code is Enterprise Edition or Community Edition? why because I'm working on EE. – Bojjaiah Feb 11 '16 at 10:08
  • 1
    it's the community edition and actually from the develop branch so this is not stable code. The EE code should be the same since EE is, as far as I know, only added modules. But if you copy the code, you should copy it from the stable version(this is for 2.0.2): github.com/magento/magento2/blob/2.0.2/app/code/Magento/Catalog/… – David Verholen Feb 11 '16 at 10:14
  • @DavidVerholen, Ok. When I copied the code from your given link the only the difference between those two files(EE and CE) are "Magento_Catalog/catalog/type-switcher" and "Magento_Catalog/catalog/type-events". and added last javascript <script type="text/x-magento-init"> { "*": { "Magento_Catalog/js/product/weight-handler": {}, "Magento_Catalog/catalog/apply-to-type-switcher": {} } } </script> what is means? is there any difference b/w? – Bojjaiah Feb 11 '16 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.