0

I have a problem where a newly installed module is not working due to a conflict.

The result of n98-magerun dev:module:rewrite:conflicts:

module conflict

How would I solve this problem? Is there any particular way of re-writting those classes?

1

Amasty has a great tool on fixing conflicts on rewrites, and provide the code for that after Link :

  • Go to

Admin panel -> System -> Amasty Extensions -> Extensions & Notifications -> Troubleshooter

  • Look for the conflicts that relate to Amasty conflicting extension and click Fix.
  • Flush the cache, and check the performance. In case a problem remains and the extension is not working, click Rollback and try out other offered solutions.
  • I tried using this tool, it didn't work tho. Magerun was still showing a conflict :/ – Greg Oct 15 '18 at 13:33
  • Try to change the helper path after extends or make modifications to the config xml rewrite tag. – Ylgen Guxholli Oct 15 '18 at 13:43
  • I managed to solve my problem! See my answer. Although, thank you for your interest. +1 from me. – Greg Oct 15 '18 at 14:28
  • 1
    Glad you fixed that sir. – Ylgen Guxholli Oct 15 '18 at 14:35
0

I managed to get it fixed by using if condition and chaining them together.


I left the Amasty_Methods to extend core class

app/code/local/Amasty/Methods/Helper/Payment/Data.php

class Amasty_Methods_Helper_Payment_Data extends Mage_Payment_Helper_Data
{

Then edited the other Amasty module called Amasty_Payrestriction to extend the Amasty_Methods (Or core class if they module is disabled)

app/code/local/Amasty/Payrestriction/Helper/Payment/Data.php

if (Mage::helper('core')->isModuleEnabled('Amasty_Methods')) {
  class Amasty_Payrestriction_Helper_Payment_Data_Temp extends Amasty_Methods_Helper_Payment_Data {}
}
else {
  class Amasty_Payrestriction_Helper_Payment_Data_Temp extends Mage_Payment_Helper_Data {}
}

class Amasty_Payrestriction_Helper_Payment_Data extends Amasty_Payrestriction_Helper_Payment_Data_Temp
{

At last, I edited the SagePay module to extend the Amasty_Payrestriction class or core class if this is disabled.

app/code/local/Ebizmarts/SagePaySuite/Helper/Payment/Data.php

if (Mage::helper('core')->isModuleEnabled('Amasty_Payrestriction')) {
    class Ebizmarts_SagePaySuite_Helper_Payment_Data_Temp extends Amasty_Payrestriction_Helper_Payment_Data {}
}  
else {
    class Ebizmarts_SagePaySuite_Helper_Payment_Data_Temp extends Mage_Payment_Helper_Data {}
}

class Ebizmarts_SagePaySuite_Helper_Payment_Data extends Ebizmarts_SagePaySuite_Helper_Payment_Data_Temp {

Conclusion:

At the end, all I did was extending each class in following pattern:

Ebizmarts_SagePaySuite -> Amasty_Payrestriction -> Amasty_Methods -> Mage_Payment_Helper_Data

if any of the modules are disabled or removed, the chain will not break due to the if condition.

I hope someone will find this useful!

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.