hello, i have 2 custom modules and all is extend from core class module-checkout \Magento\Checkout\Block\Onepage\Success, the issue if i install two modules together only one modules that can show custom view success.phtml, the other one is always use default magento 2 success.phtml, please anyone give me advice
You need to set a dependency on the module using an etc/module.xml file.
You can set dependency via <sequence> tag in module.xml file.
A second way, Extend block with module block class instead of Core Checkout Block and your changes will be display based on final module.
hello, i already try add <module name="myVendor_moduleB"/> in moduleA module.xml and than i extends moduleA block at moduleB block with Success extends \myVendor\moduleA\Block\Checkout\Success but still not working, is this right approach?
Hello @first_last8,
Please add your method/function on that third party class and also keep your override method on site so whenever that third-party extension will be disabled at that time that class is overridden by your module.
--
If my answer is useful, please Accept as Solution & give Kudos
what mean third party class? should i make new module to extend core class?
i need all moduleA and moduleB enabled, if only one of moduleA or moduleB enabled they work normal, i think its because two block rewrites same core block, correct me if im wrong.
can you give me example? so i can figure out what you mean. thanks before
Hello @first_last8,
Need to override class this Vendor\moduleA\Block\Checkout\Success
which is already override by Module_Abc which is third party
Now, Please add your logic on Module_Abc's override class and also add logic for your class Module_Xyz also so for now your logic will work from third party class and working as excepted
In future, suppose Module_Abc will be disabled then that logic takes form Module_Xyz class so it's working as smoothly
--
If my answer is useful, please Accept as Solution & give Kudos