OXID Community Forum

> International Forums > Developers > How to check if module is active in CE 4.9 and CE 4.8
Login
FAQ Members List Calendar Search Today's Posts Mark Forums Read

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


Reply
 
Thread Tools Search this Thread Display Modes
#Top   #1  
Old 07-05-2017, 08:35 AM
kRaath kRaath is offline
Junior Member
Join Date: Jun 2017
Posts: 8
kRaath is on a distinguished road
Red face 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?
Reply With Quote
#Top   #2  
Old 07-05-2017, 09:09 AM
vanilla thunder's Avatar
vanilla thunder vanilla thunder is offline
Marco's Sidekick
Join Date: Nov 2010
Posts: 6,431
vanilla thunder is on a distinguished road
Default Re: How to check if module is active in CE 4.9 and CE 4.8

Hi,

if your module extends a globally available class like oxViewConfig, you can use php function method_exists()
Code:
[{if $oViewConf|method_exists:'your_custom_method' }] ... [{/if}]
or
Code:
[{if method_exists($oViewConf,'your_custom_method') }] ... [{/if}]
Reply With Quote
#Top   #3  
Old 07-05-2017, 10:51 AM
kRaath kRaath is offline
Junior Member
Join Date: Jun 2017
Posts: 8
kRaath is on a distinguished road
Default AW: Re: How to check if module is active in CE 4.9 and CE 4.8

how i am trying to include widgets.
Quote:
[{if $oViewConf->isModuleActive ('ekomiprc',null,null)}]
[{oxid_include_widget cl="ekomiPRCMiniStarsWidget" oxid=$oDetailsProduct->oxarticles__oxid->value}]
[{/if}]
This works fine in CE 4.10 But not in lesser versions.

This is my widget class:

Quote:
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() {
parent::render();

$this->reviewsCountPage = 0;

$oxid = $this->getViewParameter('oxid');

$oArticle = oxNew("oxarticle");
$oArticle->load($oxid);

$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?
Reply With Quote
#Top   #4  
Old 07-05-2017, 11:15 AM
vanilla thunder's Avatar
vanilla thunder vanilla thunder is offline
Marco's Sidekick
Join Date: Nov 2010
Posts: 6,431
vanilla thunder is on a distinguished road
Default Re: How to check if module is active in CE 4.9 and CE 4.8

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
Reply With Quote
#Top   #5  
Old 07-05-2017, 11:42 AM
kRaath kRaath is offline
Junior Member
Join Date: Jun 2017
Posts: 8
kRaath is on a distinguished road
Default AW: Re: How to check if module is active in CE 4.9 and CE 4.8

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

Quote:
[{ if class_exists('ekomiPRCMiniStarsWidget')}]
[{oxid_include_widget cl="ekomiPRCMiniStarsWidget" oxid=$oDetailsProduct->oxarticles__oxid->value}]
[{/if}]
Thanks for your support.
Reply With Quote
Reply

Bookmarks

Tags
active, check, ismoduleactive, module

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Nicht Sichtbar
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
oe PayPal module - check out without a PayPal account option tmikla Modules 0 07-04-2014 10:48 AM
problem mit: vt Displaying Active Discounts (module for OXID eSales) Mannitu Module 9 07-01-2013 05:57 PM
Top Articles of active category? 2melonsmedia Newbies 1 06-03-2012 04:17 PM
How to Display 'Active to' Date Tokyoj Newbies 1 11-23-2010 09:39 AM
Active top level category obsidian Templates und Design 0 06-16-2009 03:46 PM

All times are GMT +1. The time now is 06:24 AM.