0

In Previous Magento released versions (2.0.*) I have successfully extended and it's working fine. When comes to Magento 2.1.0 the same functionality not working. I have tried below code. If I went to wrong through me right direction.

Here I have directly wrote core file (later I will convert to local).

My Code

root/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit.phtml

 ...
     <div style="width: 100%;height: 20px;">
            Welcome to Magento 2
        </div>
    ...
    core files code
    ..

Previous versions my code is

Training/Learning/etc/di.xml

<?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="Training\Learning\Block\Adminhtml\Product\Edit" />
</config>

Training/Learning/Block/Adminhtml/Product/Edit.php

<?php

namespace Training\Learning\Block\Adminhtml\Product;

class Edit extends \Magento\Catalog\Block\Adminhtml\Product\Edit
{
    protected $_template = 'Training_Learning::catalog/product/edit.phtml';
}

Training/Learning/view/adminhtml/template/catalog/product/Edit.php

...
         <div style="width: 100%;height: 20px;">
                Welcome to Magento 2
            </div>
        ...
        core files code
        ..

It's working fine in Magento 2.0.* versions.

Any help on this?

  • Magento 2.1 move traditional form to ui_component form. What you exactly need that why you overwrite whole form class? – Sohel Rana Jul 4 '16 at 13:33
  • @SohelRana, I Want to send Product information to Other API. for that I want to put button on product edit page. – Bojjaiah Jul 4 '16 at 13:40
  • only you need to add header button like save, reset etc? – Sohel Rana Jul 4 '16 at 13:43
  • @SohelRana, No, I want to insert before Enable Product field. – Bojjaiah Jul 4 '16 at 13:45
  • 1
    Need some investigation, I will be back if find something positive for you – Sohel Rana Jul 4 '16 at 14:12

Your Answer

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

Browse other questions tagged or ask your own question.