How to add custom block to existing tab of product at admin side Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Add new custom tab with grid selection in product detail page admin : Magento 2Magento2 Add block to theme for custom phtml fileAdd new tab in product edit page in Magento 2.1Magento 2: How to edit existing product tabHow I can add a static block on product description page after fotorama end?Assign phtml code to a block (made on admin side)Magento 2: How to move product info media block to my custom tab on product pageMagento 2.2: Add Customer Attribute to Custom Tab in AdminMagento2: How to call custom block in phtml filehow to get current products custom attribute value in block(phtml) to display in products details page magento2?

What computer would be fastest for Mathematica Home Edition?

Cold is to Refrigerator as warm is to?

Unable to start mainnet node docker container

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Need a suitable toxic chemical for a murder plot in my novel

How does modal jazz use chord progressions?

If the nonce is 32 bits why the proof of it is difficult?

New Order #5: where Fibonacci and Beatty meet at Wythoff

Passing functions in C++

Are my PIs rude or am I just being too sensitive?

Stars Make Stars

Do working physicists consider Newtonian mechanics to be "falsified"?

Why is "Captain Marvel" translated as male in Portugal?

grandmas drink with lemon juice

Autumning in love

Using "nakedly" instead of "with nothing on"

Two different pronunciation of "понял"

Active filter with series inductor and resistor - do these exist?

What's the point in a preamp?

How to set letter above or below the symbol?

Direct Experience of Meditation

How can I protect witches in combat who wear limited clothing?

What would be Julian Assange's expected punishment, on the current English criminal law?

When communicating altitude with a '9' in it, should it be pronounced "nine hundred" or "niner hundred"?



How to add custom block to existing tab of product at admin side



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Add new custom tab with grid selection in product detail page admin : Magento 2Magento2 Add block to theme for custom phtml fileAdd new tab in product edit page in Magento 2.1Magento 2: How to edit existing product tabHow I can add a static block on product description page after fotorama end?Assign phtml code to a block (made on admin side)Magento 2: How to move product info media block to my custom tab on product pageMagento 2.2: Add Customer Attribute to Custom Tab in AdminMagento2: How to call custom block in phtml filehow to get current products custom attribute value in block(phtml) to display in products details page magento2?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to add custom messages to my custom created attributes on the product page by using Block and Phtml.

My problem can be illustrated as following:

enter image description here










share|improve this question






















  • you mean cms block? that would be super hacky. I do not recommend this

    – Philipp Sander
    Apr 11 at 6:16











  • I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

    – iqbal malik
    Apr 11 at 6:29











  • what do you mean by dynamic?

    – Philipp Sander
    Apr 11 at 6:42











  • Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

    – iqbal malik
    Apr 11 at 6:44

















0















I want to add custom messages to my custom created attributes on the product page by using Block and Phtml.

My problem can be illustrated as following:

enter image description here










share|improve this question






















  • you mean cms block? that would be super hacky. I do not recommend this

    – Philipp Sander
    Apr 11 at 6:16











  • I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

    – iqbal malik
    Apr 11 at 6:29











  • what do you mean by dynamic?

    – Philipp Sander
    Apr 11 at 6:42











  • Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

    – iqbal malik
    Apr 11 at 6:44













0












0








0








I want to add custom messages to my custom created attributes on the product page by using Block and Phtml.

My problem can be illustrated as following:

enter image description here










share|improve this question














I want to add custom messages to my custom created attributes on the product page by using Block and Phtml.

My problem can be illustrated as following:

enter image description here







magento2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 11 at 6:08









iqbal malikiqbal malik

14412




14412












  • you mean cms block? that would be super hacky. I do not recommend this

    – Philipp Sander
    Apr 11 at 6:16











  • I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

    – iqbal malik
    Apr 11 at 6:29











  • what do you mean by dynamic?

    – Philipp Sander
    Apr 11 at 6:42











  • Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

    – iqbal malik
    Apr 11 at 6:44

















  • you mean cms block? that would be super hacky. I do not recommend this

    – Philipp Sander
    Apr 11 at 6:16











  • I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

    – iqbal malik
    Apr 11 at 6:29











  • what do you mean by dynamic?

    – Philipp Sander
    Apr 11 at 6:42











  • Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

    – iqbal malik
    Apr 11 at 6:44
















you mean cms block? that would be super hacky. I do not recommend this

– Philipp Sander
Apr 11 at 6:16





you mean cms block? that would be super hacky. I do not recommend this

– Philipp Sander
Apr 11 at 6:16













I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

– iqbal malik
Apr 11 at 6:29





I just need to show a dynamic message using phtml after my Custom Attribute field. Please tell me the recommendation to achieve this.

– iqbal malik
Apr 11 at 6:29













what do you mean by dynamic?

– Philipp Sander
Apr 11 at 6:42





what do you mean by dynamic?

– Philipp Sander
Apr 11 at 6:42













Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

– iqbal malik
Apr 11 at 6:44





Dynamic means if the current value is available then the message will show otherwise the message will be hidden.

– iqbal malik
Apr 11 at 6:44










1 Answer
1






active

oldest

votes


















0














If not mistaken you can achieve it by adding custom input type in a module



first we need to add install script
Vendor/Module/Setup/InstallData.php :



class InstallData implements InstallDataInterface

private $eavSetupFactory;


public function __construct(EavSetupFactory $eavSetupFactory)

$this->eavSetupFactory = $eavSetupFactory;


public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

$setup->startSetup();
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'attribute_id',
[
'type' => 'text',
'backend' => '',
'frontend' => 'VendorModuleBlockAdminhtmlProductCustomField',
'label' => 'Custom attribute',
'input' => 'text',
'class' => '',
'source' => '',
'global' => 0,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => null,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => false,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'General',
]
);
$setup->endSetup();




next we need to create our renderer for custom input:
Vendor/Module/Block/Adminhtml/Product/CustomField.php



namespace VendorModuleBlockAdminhtmlProduct;


use MagentoBackendBlockTemplateContext;
use MagentoConfigBlockSystemConfigFormField;
use MagentoFrameworkDataFormElementAbstractElement;

class CustomField extends Field

public function __construct(
Context $context,
array $data = []
)
parent::__construct($context, $data);


public function render(AbstractElement $element)

$html = '';
// you can modify your html output as you see fit. probably will work with parent::_decorateRowHtml but here you can see exactly how it's done.
return $this->_decorateRowHtml($element, $html);


public function _decorateRowHtml($element, $html)
return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';




with this you can add javascript to watch for input change and if you need that text is loaded dynamic then you will need to add route and call your url.



Vendor/Module/etc/Adminhtml/routes.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="customattribute" frontName="customattribute">
<module name="Vendor_Module" before="Magento_Adminhtml" />
</route>
</router>
</config>


now we need to add controller:
Vendor/Module/Controller/Adminhtml/Catalog/Product/Dynamic.php



namespace VendorModuleControllerAdminhtmlCatalogProduct;

class Dynamic extends MagentoBackendAppAction


public function __construct(
MagentoBackendAppActionContext $context,
)
parent::__construct($context);

public function execute()
// do what is needed and output your html with echo




so if you need to call your url you can add following to render function CustomField.php:



$html.="<script>
require([
'jquery',
'prototype',
], function(jQuery)
function do_something()

new Ajax.Request('".$this->getUrl('customattribute/catalog/product/dynamic')."',
loaderArea: true,
asynchronous: true,
parameters: params,
onSuccess: function(transport)
//do something with output
return true;

);


jQuery('my_input').change(function ()
do_something();
);
);
</script>";





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269640%2fhow-to-add-custom-block-to-existing-tab-of-product-at-admin-side%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    If not mistaken you can achieve it by adding custom input type in a module



    first we need to add install script
    Vendor/Module/Setup/InstallData.php :



    class InstallData implements InstallDataInterface

    private $eavSetupFactory;


    public function __construct(EavSetupFactory $eavSetupFactory)

    $this->eavSetupFactory = $eavSetupFactory;


    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

    $setup->startSetup();
    $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
    $eavSetup->addAttribute(
    MagentoCatalogModelProduct::ENTITY,
    'attribute_id',
    [
    'type' => 'text',
    'backend' => '',
    'frontend' => 'VendorModuleBlockAdminhtmlProductCustomField',
    'label' => 'Custom attribute',
    'input' => 'text',
    'class' => '',
    'source' => '',
    'global' => 0,
    'visible' => true,
    'required' => false,
    'user_defined' => true,
    'default' => null,
    'searchable' => false,
    'filterable' => false,
    'comparable' => false,
    'visible_on_front' => false,
    'used_in_product_listing' => false,
    'unique' => false,
    'apply_to' => '',
    'system' => 1,
    'group' => 'General',
    ]
    );
    $setup->endSetup();




    next we need to create our renderer for custom input:
    Vendor/Module/Block/Adminhtml/Product/CustomField.php



    namespace VendorModuleBlockAdminhtmlProduct;


    use MagentoBackendBlockTemplateContext;
    use MagentoConfigBlockSystemConfigFormField;
    use MagentoFrameworkDataFormElementAbstractElement;

    class CustomField extends Field

    public function __construct(
    Context $context,
    array $data = []
    )
    parent::__construct($context, $data);


    public function render(AbstractElement $element)

    $html = '';
    // you can modify your html output as you see fit. probably will work with parent::_decorateRowHtml but here you can see exactly how it's done.
    return $this->_decorateRowHtml($element, $html);


    public function _decorateRowHtml($element, $html)
    return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';




    with this you can add javascript to watch for input change and if you need that text is loaded dynamic then you will need to add route and call your url.



    Vendor/Module/etc/Adminhtml/routes.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
    <route id="customattribute" frontName="customattribute">
    <module name="Vendor_Module" before="Magento_Adminhtml" />
    </route>
    </router>
    </config>


    now we need to add controller:
    Vendor/Module/Controller/Adminhtml/Catalog/Product/Dynamic.php



    namespace VendorModuleControllerAdminhtmlCatalogProduct;

    class Dynamic extends MagentoBackendAppAction


    public function __construct(
    MagentoBackendAppActionContext $context,
    )
    parent::__construct($context);

    public function execute()
    // do what is needed and output your html with echo




    so if you need to call your url you can add following to render function CustomField.php:



    $html.="<script>
    require([
    'jquery',
    'prototype',
    ], function(jQuery)
    function do_something()

    new Ajax.Request('".$this->getUrl('customattribute/catalog/product/dynamic')."',
    loaderArea: true,
    asynchronous: true,
    parameters: params,
    onSuccess: function(transport)
    //do something with output
    return true;

    );


    jQuery('my_input').change(function ()
    do_something();
    );
    );
    </script>";





    share|improve this answer



























      0














      If not mistaken you can achieve it by adding custom input type in a module



      first we need to add install script
      Vendor/Module/Setup/InstallData.php :



      class InstallData implements InstallDataInterface

      private $eavSetupFactory;


      public function __construct(EavSetupFactory $eavSetupFactory)

      $this->eavSetupFactory = $eavSetupFactory;


      public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

      $setup->startSetup();
      $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
      $eavSetup->addAttribute(
      MagentoCatalogModelProduct::ENTITY,
      'attribute_id',
      [
      'type' => 'text',
      'backend' => '',
      'frontend' => 'VendorModuleBlockAdminhtmlProductCustomField',
      'label' => 'Custom attribute',
      'input' => 'text',
      'class' => '',
      'source' => '',
      'global' => 0,
      'visible' => true,
      'required' => false,
      'user_defined' => true,
      'default' => null,
      'searchable' => false,
      'filterable' => false,
      'comparable' => false,
      'visible_on_front' => false,
      'used_in_product_listing' => false,
      'unique' => false,
      'apply_to' => '',
      'system' => 1,
      'group' => 'General',
      ]
      );
      $setup->endSetup();




      next we need to create our renderer for custom input:
      Vendor/Module/Block/Adminhtml/Product/CustomField.php



      namespace VendorModuleBlockAdminhtmlProduct;


      use MagentoBackendBlockTemplateContext;
      use MagentoConfigBlockSystemConfigFormField;
      use MagentoFrameworkDataFormElementAbstractElement;

      class CustomField extends Field

      public function __construct(
      Context $context,
      array $data = []
      )
      parent::__construct($context, $data);


      public function render(AbstractElement $element)

      $html = '';
      // you can modify your html output as you see fit. probably will work with parent::_decorateRowHtml but here you can see exactly how it's done.
      return $this->_decorateRowHtml($element, $html);


      public function _decorateRowHtml($element, $html)
      return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';




      with this you can add javascript to watch for input change and if you need that text is loaded dynamic then you will need to add route and call your url.



      Vendor/Module/etc/Adminhtml/routes.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
      <router id="admin">
      <route id="customattribute" frontName="customattribute">
      <module name="Vendor_Module" before="Magento_Adminhtml" />
      </route>
      </router>
      </config>


      now we need to add controller:
      Vendor/Module/Controller/Adminhtml/Catalog/Product/Dynamic.php



      namespace VendorModuleControllerAdminhtmlCatalogProduct;

      class Dynamic extends MagentoBackendAppAction


      public function __construct(
      MagentoBackendAppActionContext $context,
      )
      parent::__construct($context);

      public function execute()
      // do what is needed and output your html with echo




      so if you need to call your url you can add following to render function CustomField.php:



      $html.="<script>
      require([
      'jquery',
      'prototype',
      ], function(jQuery)
      function do_something()

      new Ajax.Request('".$this->getUrl('customattribute/catalog/product/dynamic')."',
      loaderArea: true,
      asynchronous: true,
      parameters: params,
      onSuccess: function(transport)
      //do something with output
      return true;

      );


      jQuery('my_input').change(function ()
      do_something();
      );
      );
      </script>";





      share|improve this answer

























        0












        0








        0







        If not mistaken you can achieve it by adding custom input type in a module



        first we need to add install script
        Vendor/Module/Setup/InstallData.php :



        class InstallData implements InstallDataInterface

        private $eavSetupFactory;


        public function __construct(EavSetupFactory $eavSetupFactory)

        $this->eavSetupFactory = $eavSetupFactory;


        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

        $setup->startSetup();
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute(
        MagentoCatalogModelProduct::ENTITY,
        'attribute_id',
        [
        'type' => 'text',
        'backend' => '',
        'frontend' => 'VendorModuleBlockAdminhtmlProductCustomField',
        'label' => 'Custom attribute',
        'input' => 'text',
        'class' => '',
        'source' => '',
        'global' => 0,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'default' => null,
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => false,
        'used_in_product_listing' => false,
        'unique' => false,
        'apply_to' => '',
        'system' => 1,
        'group' => 'General',
        ]
        );
        $setup->endSetup();




        next we need to create our renderer for custom input:
        Vendor/Module/Block/Adminhtml/Product/CustomField.php



        namespace VendorModuleBlockAdminhtmlProduct;


        use MagentoBackendBlockTemplateContext;
        use MagentoConfigBlockSystemConfigFormField;
        use MagentoFrameworkDataFormElementAbstractElement;

        class CustomField extends Field

        public function __construct(
        Context $context,
        array $data = []
        )
        parent::__construct($context, $data);


        public function render(AbstractElement $element)

        $html = '';
        // you can modify your html output as you see fit. probably will work with parent::_decorateRowHtml but here you can see exactly how it's done.
        return $this->_decorateRowHtml($element, $html);


        public function _decorateRowHtml($element, $html)
        return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';




        with this you can add javascript to watch for input change and if you need that text is loaded dynamic then you will need to add route and call your url.



        Vendor/Module/etc/Adminhtml/routes.xml



        <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
        <router id="admin">
        <route id="customattribute" frontName="customattribute">
        <module name="Vendor_Module" before="Magento_Adminhtml" />
        </route>
        </router>
        </config>


        now we need to add controller:
        Vendor/Module/Controller/Adminhtml/Catalog/Product/Dynamic.php



        namespace VendorModuleControllerAdminhtmlCatalogProduct;

        class Dynamic extends MagentoBackendAppAction


        public function __construct(
        MagentoBackendAppActionContext $context,
        )
        parent::__construct($context);

        public function execute()
        // do what is needed and output your html with echo




        so if you need to call your url you can add following to render function CustomField.php:



        $html.="<script>
        require([
        'jquery',
        'prototype',
        ], function(jQuery)
        function do_something()

        new Ajax.Request('".$this->getUrl('customattribute/catalog/product/dynamic')."',
        loaderArea: true,
        asynchronous: true,
        parameters: params,
        onSuccess: function(transport)
        //do something with output
        return true;

        );


        jQuery('my_input').change(function ()
        do_something();
        );
        );
        </script>";





        share|improve this answer













        If not mistaken you can achieve it by adding custom input type in a module



        first we need to add install script
        Vendor/Module/Setup/InstallData.php :



        class InstallData implements InstallDataInterface

        private $eavSetupFactory;


        public function __construct(EavSetupFactory $eavSetupFactory)

        $this->eavSetupFactory = $eavSetupFactory;


        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

        $setup->startSetup();
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute(
        MagentoCatalogModelProduct::ENTITY,
        'attribute_id',
        [
        'type' => 'text',
        'backend' => '',
        'frontend' => 'VendorModuleBlockAdminhtmlProductCustomField',
        'label' => 'Custom attribute',
        'input' => 'text',
        'class' => '',
        'source' => '',
        'global' => 0,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'default' => null,
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => false,
        'used_in_product_listing' => false,
        'unique' => false,
        'apply_to' => '',
        'system' => 1,
        'group' => 'General',
        ]
        );
        $setup->endSetup();




        next we need to create our renderer for custom input:
        Vendor/Module/Block/Adminhtml/Product/CustomField.php



        namespace VendorModuleBlockAdminhtmlProduct;


        use MagentoBackendBlockTemplateContext;
        use MagentoConfigBlockSystemConfigFormField;
        use MagentoFrameworkDataFormElementAbstractElement;

        class CustomField extends Field

        public function __construct(
        Context $context,
        array $data = []
        )
        parent::__construct($context, $data);


        public function render(AbstractElement $element)

        $html = '';
        // you can modify your html output as you see fit. probably will work with parent::_decorateRowHtml but here you can see exactly how it's done.
        return $this->_decorateRowHtml($element, $html);


        public function _decorateRowHtml($element, $html)
        return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';




        with this you can add javascript to watch for input change and if you need that text is loaded dynamic then you will need to add route and call your url.



        Vendor/Module/etc/Adminhtml/routes.xml



        <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
        <router id="admin">
        <route id="customattribute" frontName="customattribute">
        <module name="Vendor_Module" before="Magento_Adminhtml" />
        </route>
        </router>
        </config>


        now we need to add controller:
        Vendor/Module/Controller/Adminhtml/Catalog/Product/Dynamic.php



        namespace VendorModuleControllerAdminhtmlCatalogProduct;

        class Dynamic extends MagentoBackendAppAction


        public function __construct(
        MagentoBackendAppActionContext $context,
        )
        parent::__construct($context);

        public function execute()
        // do what is needed and output your html with echo




        so if you need to call your url you can add following to render function CustomField.php:



        $html.="<script>
        require([
        'jquery',
        'prototype',
        ], function(jQuery)
        function do_something()

        new Ajax.Request('".$this->getUrl('customattribute/catalog/product/dynamic')."',
        loaderArea: true,
        asynchronous: true,
        parameters: params,
        onSuccess: function(transport)
        //do something with output
        return true;

        );


        jQuery('my_input').change(function ()
        do_something();
        );
        );
        </script>";






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 11 at 10:32









        Naberd ZendiNaberd Zendi

        333




        333



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269640%2fhow-to-add-custom-block-to-existing-tab-of-product-at-admin-side%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            三茅街道4182Guuntc Dn precexpngmageondP