1

I am trying to make changes in sub item grid details of bundle product.

enter image description here

In magento 1 it was set form __construct method of app\code\core\Mage\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option.php as $this->setTemplate('bundle/product/edit/bundle/option.phtml');

and when i make any change in app\design\adminhtml\default\default\template\bundle\product\edit\bundle\option.phtml it is reflecting properly.

Please note i am not making changes directly in core files this is just for confirmation i am using it.

But when i look into the _construct method of \vendor\magento\module-bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option.php setting of template is not their.

and when i tried to make changes in \vendor\magento\module-bundle\view\adminhtml\templates\product\edit\bundle\option.phtml no changes being reflected.

If I enable a path hint for admin it shows me that it appears from \vendor\magento\module-ui\view\base\ui_component\templates\form\collapsible.xhtml

but their is no as such code which shows for this grid.

Can any one please tell me from where this details comes in magento2.

1

Take a look at Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel::getBundleSelections(). This is the class where the various columns are created ('Is Default', 'Name', 'SKU', etc.).

If you want to add an extra column (which is my guess, it's not very clear from your question what you're trying to achieve), you should hook into this method. However, this method is protected, so if you want to do it the 'Magento 2 Way', you should create a plugin that executes after Magento\Bundle\Ui\DataProvider\Product\Form\Modifier\BundlePanel::modifyMeta, and alters the array.

Beware that this is a very deep nested array, so you should do some digging to find the proper node, but I'm sure you'll figure it out.

  • From where position of element is decided? Suppose if i want to change position of Add products to option button then? and what is the role of option.phtml in magento2 then – Ashish Madankar M2 Professiona Aug 19 '16 at 9:59

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.