Is there any way to disable a third party extension for one of the store views. Since, all the store views are using same theme, I can not do it through xml file in layout folder.
-
is this extension theme related ?– Rajeev K TomyCommented Sep 16, 2015 at 6:42
-
what is this extension meant for? Probably you need to see system.xml and add few checks in controllers etc to limit it store wise.– MTMCommented Sep 16, 2015 at 6:44
-
The extension is related to payment method which does not let the customers from wholesales group make an order in the wholesales website due to invalid vat Id error. So, I need to disable any external payment method for this view.– ZinatCommented Sep 16, 2015 at 8:12
5 Answers
No this option is not available in Magento.
This is because, enabling/disabling an extension can only be performed GLOBALLY. It has no dependency on stores/websites that uses in the application.
If you want to have such features, then you need to add such functionality in the extension itself. But you need a through understanding of this extension in order to do this.
For an example, add this code in the helper class of the extension.
File : Data.php
of the extension.
protected $_disabledStores = array('your_store_code');
public function isModuleEnable()
{
if (in_array(Mage::app()->getStore()->getCode(), $this->_disabledStores)) {
return false;
}
return true;
}
Update your store code in which you need to disable the extension at $_disabledStores
and then check
if (!Mage::helper('extensionHelperGroupName')->isModuleEnable()) {
return $this;
}
in every section of the extension where you need to disable certain functionality. Hope that helps
EDIT
If you go to System > Configuration > Advanced
, you can see the whole list of modules there. If you select the correct store configuration and then disble the module in store view scope, that extension will not be used in layouts. But this disbling is not a GLOBAL disabling.
But it may work in your case. Try it. Dont forget to clear cache.
since Magento offers theme fallback (read all about it here: http://www.classyllama.com/blog/depth-look-magento-theme-fallback) it should be easy to just define a separate layout XML for each store.
Right now your System > Configuration > Design
settings look something like this
Per store fill out a different value for layout
like this
Now you can have a structure for your template files like this
|- RWD
| |- default
| | |- layout
| | |- |- layout xml files
| | |- template
| | |- |- all the template folders
| |- store1
| | |- layout
| | |- |- local.xml or some other fallback xml
| |- store2
| | |- layout
| | |- |- local.xml or some other fallback xml
| |- store3
| | |- layout
| | |- |- local.xml or some other fallback xml
Now you can make changes per store to your layout while the theme and templating files stay the same
You can disable extension by the system configuration for particular store.
System -> Configuration -> Advanced (left side)
You can select your particular store from current configuration scope (top left) and disabled your extension.
This will only disable your extension output in front area for your particular store and will work for other.
Your extension will be enable for both store but output at front will be disable for one store.
Magento Mage_Core_Helper_Abstract
has one (two?) built in mehtods you can use to seperate loaded code between storeviews.
/**
* Check is module exists and enabled in global config.
*
* @param string $moduleName the full module name, example Mage_Core
* @return boolean
*/
public function isModuleEnabled($moduleName = null)
...
$isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
return false;
}
return true;
...
and
/**
* Check whether or not the module output is enabled in Configuration
*
* @param string $moduleName Full module name
* @return boolean
*/
public function isModuleOutputEnabled($moduleName = null)
...
if (!$this->isModuleEnabled($moduleName)) {
return false;
}
if (Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName)) {
return false;
}
return true;
...
This should (?) be enough to use code based on storeview ...
if (!Mage::helper('my_helper')->isModuleOutputEnabled() {
# in case of rewrites
return parrent::someMethod();
}
Don not use isModuleEnabled
, it just checkot if modules <active>
XML node is set to true
or 1
. Also avoid direct use auf Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName)
because your module can be disabled from XML.