I Installed Third party module under app/code folder. I created another module under same app/code directory to override the third party module. I specified
<preference for="[Third party Name Space]\Block\File" type="[Name Space]\[My Module]\Block\File" />
in di.xml but still I cannot override the Block file of third party module.
-
What's the issue you are facing?Rakesh Jesadiya– Rakesh Jesadiya2018年10月06日 17:17:10 +00:00Commented Oct 6, 2018 at 17:17
-
I cant able to override third party module's block file. I followed this answer too magento.stackexchange.com/a/210100/63813Quasar M– Quasar M2018年10月06日 17:19:42 +00:00Commented Oct 6, 2018 at 17:19
-
I created custom module and enabled to override that third party module and I specified <preference for="[Third party Name Space]\Block\File" type="[Name Space][My Module]\Block\File" /> in di.xml, but still the block file is rendering from third party module instead of from my custom module.Quasar M– Quasar M2018年10月06日 17:26:01 +00:00Commented Oct 6, 2018 at 17:26
1 Answer 1
Overriding also depends upon the module sequence. So you can check in app/etc/config.php if your module is after than the 3rd party module or not. And if not then you can add the sequence in your etc/module.xml to load your module after the 3rd party module. For getting the detail overview of overriding you can check this link https://devdocs.magento.com/guides/v2.2/extension-dev-guide/build/module-load-order.html
-
Of course, I added the sequence to depend third party module in my custom module's module.xml, but still the block file is rendering from third party module.Quasar M– Quasar M2018年10月07日 11:44:31 +00:00Commented Oct 7, 2018 at 11:44