Slider Revolution magento extension FAQ

Magento two modules extend same class problem solution for Slider Revolution extension

Extending modules instead of modifying them is a good practice in Magento development. But what will happen if in Magento two modules extend same class? This can occur when two extensions extend same class for own needs. In this case only the last one will get benefit from extending it. And the first one will enjoy its class without extended features.

Because of it one of two Magento extensions that was fighting for its right to extend class will lose. And will cause errors in it. Or it will start working wrong way. That’s bad. Good news that we let you know how to solve it.

For example Magento Slider Revolution extension extends Template Filter class. It needs it to add own directive “revslider” to template processing. So our customers will be able to use {{revslider}} shortcode to add slider to any CMS block or page.

But the other Magento extension CMS Translate extends it too. To add own shortcode {{translate}} for CMS translation feature.

And if both Magento extensions will be installed at the same time. Surprise! Custom shortcode feature will stop working for one of them.

The solution is simple. Instead of Magento two modules extend same class. One module extends original class and other module extends class extended already by first module. So both modules add their functionality. Both work and everyone happy.

To do it in our case you need to replace following line in this file:

/app/code/community/Nwdthemes/Revslider/Model/Template/Filter.php

class Nwdthemes_Revslider_Model_Template_Filter extends Mage_Widget_Model_Template_Filter {
class Nwdthemes_Revslider_Model_Template_Filter extends MB_Translate_Model_Template_Filter {

That’s it.

Just note that after this operation one module becomes dependent of other module. So be aware that if you will disable or remove one module — second one will got error and will stop working. To fix this just rollback update done in this file.

Leave a Reply

Your email address will not be published. Required fields are marked *