How to check if module is active in CE 4.9 and CE 4.8

Hello, i developed a module in CE 4.10. I used isModuleActive function to check either module is active or not.
When i tested the module in CE 4.9. isModuleActive not worked properly.
And isModuleActive function not exist less than CE 4.9.0.

Is there any work around to check the module is active or not in all of the OXID CE versions?


if your module extends a globally available class like oxViewConfig, you can use php function method_exists()

[{if $oViewConf|method_exists:'your_custom_method' }] ... [{/if}]


[{if method_exists($oViewConf,'your_custom_method') }] ... [{/if}]

how i am trying to include widgets.

[{if $oViewConf->isModuleActive (‘ekomiprc’,null,null)}]
[{oxid_include_widget cl=“ekomiPRCMiniStarsWidget” oxid=$oDetailsProduct->oxarticles__oxid->value}]

This works fine in CE 4.10 But not in lesser versions.

This is my widget class:

class ekomiPRCMainWidget extends oxWidget {

 * Names of components (classes) that are initiated and executed
 * before any other regular operation.
 * @TODO: Enter components You need for the widget to be loaded. As example ... array('oxcmp_cur' => 1, ...);
 * @var array
protected $_aComponentNames = array('oxcmp_user' => 1);
 * Widget template name.
 * @var string
protected $_sThisTemplate = 'ekomiprcmainwidget.tpl';
protected $reviewsModel = null;
 * Reviews limit per request
protected $_oArticle;
const REVIEWS_LIMIT = 5;
protected $reviewsCountPage;
 * Executes parent::render().
 * Returns name of template file to render.
 * @return string current template file name
public function render() {
    $this->reviewsCountPage = 0;
    $oxid = $this->getViewParameter('oxid');
    $oArticle = oxNew("oxarticle");
    $this->_oArticle = $oArticle;
    $this->reviewsModel = new ekomiPRCReviewsModel($this->getArticleNumber());
     * Populate prcReviews
    $this->reviewsModel->populateReviewsData($range = '1w');
    return $this->_sThisTemplate;

Where i have to extend the oxViewConfig class?

How do you insert your own code into templates? With a template block? Then you do not need to check if module is active, because blocks are loaded only if module is active

THanks alot, i solved the issue by checking the class_exist function.

[{ if class_exists(‘ekomiPRCMiniStarsWidget’)}]
[{oxid_include_widget cl=“ekomiPRCMiniStarsWidget” oxid=$oDetailsProduct->oxarticles__oxid->value}]

Thanks for your support. :slight_smile: