cancel
Showing results for 
Search instead for 
Did you mean: 

In the admin area, edit product page, I can't add a button near the Save one

In the admin area, edit product page, I can't add a button near the Save one

No errors but the button isn't showed.
Here the code:
[...]/view/adminhtml/ui_component/product_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="buttons" xsi:type="array">
            <item name="button-company-test-sync-qty" xsi:type="string">Company\Module\Block\Adminhtml\Product\Edit\SyncQtyButton</item>
        </item>
    </argument>
</form>

 

[...]/Block/AdminHtml/Product/Edit/SyncQtyButton.php

<?php 
namespace Company\Module\Block\Adminhtml\Product\Edit;

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

class SyncQtyButton extends Generic
{
    public function getButtonData()
    {
        return [
            'label' => __('Update Qty'),
            'on_click' => "alert('it works')",
            'sort_order' => 1
        ];
    }
}


Cache disabled and I emptied these folders:

  • generated
  • pub/static
  • var/view_preprocessed/pub/static/

with no results.

 

Magento is in developer mode.

 

I really don't know what else I can do.