L
L
lagudal2020-09-08 09:27:09
Magento
lagudal, 2020-09-08 09:27:09

How are module files generally rewritten in Magento 2 theme?

For example, there is a commercial module from amasty - in my particular case it is Amasty promo banners.
If I need to rewrite functionality in a phtml template, I copy the template file to my theme - myTheme/templates/template.phtml. and here I am already making the changes I need.
But now I need to make changes to the php files of the module - for example, these are Block/Container.php, Helper/Data.php , Model/Rule.php.
How do I properly rewrite these files for my theme only?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
necrodeflorator, 2020-09-08
@necrodeflorator

Did you study at the first magician?
In the second, you need to write around plugins for method override. To do this, you need to write your own module and write in di.xml what you want to override.
In the case of amasti, without damage, you can transfer the module to the code and fix what you need, one fig they don’t fix their modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question