0

enter image description here

I have "New Add Product" button at Sales->Order->Create New Order

which I added through plugin. My di is at: etc/adminhtml

As

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Items">
    <plugin name="vendor-module-order-create-items-block" type="Vendor\Module\Plugin\Order\Create\Items" sortOrder="100" />
</type>
</config>

My plugin class is:

class Items
{
public function afterGetButtonsHtml(\Magento\Sales\Block\Adminhtml\Order\Create\Items $subject, $result)
{
    $url = 'http://www.google.com';
    $result .= $subject->getLayout()->createBlock(
            \Magento\Backend\Block\Widget\Button::class
        )->setData(
            ['label'=>'New Add Products', 'type'=>'button', 'id'=> 'add_new_products', 'class' => 'action-secondary action-add', 'on_click'=>"window.location.href='" . $url . "'"]
        )->toHtml();
    return $result;
}
}

I want to create popup like this on 'New Add Products' button click (This is in M1) enter image description here

I need to know how to add popup code in plugin class? as there are many solutions available but mostly are executed by template files.

  • which type of pop-up you are trying to create? – Dhiren Vasoya Nov 13 '18 at 14:24
  • Please see updated question. – Ajwad Syed Nov 14 '18 at 5:25

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.