0

I'm working on Magento 2.3.2 and am trying to override a block in adminhtml.

I overrode the template file perfectly fine, but it seems layout updates are being ignored?

This is the class that gets displayed with template hints with block class hints enabled:

Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped\Interceptor

The template path shows as my theme.

The theme's directory for overriding the template is:

app/design/adminhtml/Theme/Vendor/Magento_GroupedProduct

Which contains a folder for Block classes, a folder for templates and the last being for layout.

I copied the layout file from the module-grouped-product folder into my layout folder and made a change:

<block class="Vendor\Module\Block\FieldsetGrouped" 
       name="product.composite.fieldset.grouped" 
       before="product.composite.fieldset.options" 
       template="Magento_GroupedProduct::catalog/product/composite/fieldset/grouped.phtml" />

If I go to app/code/Vendor/Module/Block I can see the FieldsetGrouped class I made. However, after a full php bin/magento command list, still no changes.

I also copied the Block class into the Magento_GroupedProduct folder to see if it would work that way and it didn't seem to make a difference.

The area I'm specifically trying to update is the pop-up you get when clicking "configure" on grouped products when creating an order and adding products:

enter image description here

How do I tell Magento to listen to my xml update?

Thanks,

2
  • Was trying to see where this configure link and I cannot see it.. would you be able to add steps to reach this part of the system? – Herve Tribouilloy Jun 19 '20 at 9:18
  • @HerveTribouilloy add a configurable/bundle/kit product and then that configure link should appear – treyBake Jun 23 '20 at 10:05
0

When working with theme you still have to use referenceBlock and referenceContainer tags to edit existing block or container.

This should resolve the problem:

<referenceBlock class="Vendor\Module\Block\FieldsetGrouped" 
   name="product.composite.fieldset.grouped" 
   before="product.composite.fieldset.options" 
   template="Magento_GroupedProduct::catalog/product/composite/fieldset/grouped.phtml" />

Don't forget to clear cache.

As a side note I think you are bit confused in what you are trying to do. If I am correct you are trying to replace class of a block in a theme. Why not change the class in module layout instructions? This will get messy pretty quickly.

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.