Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

Is there a clean way to make a difference code wise between EE and CE?
The problem.
I'm updating an extension so it will work nicely on ce-1.9.
The extension is not for EE, but it seams to work on that also.
For the update I need to create an upgrade script that should be executed only if installed on CE-1.9 (or EE 1.14).
I cannot simply check

version_compare(Mage::getVersion, '1.9', '>=');

because this will be triggered in EE 1.9+ and I don't want that.

Right now I'm using this:

$isEE = Mage::helper('core')->isModuleEnabled('Enterprise_Enterprise');

but it seams kind of ugly.

Any other ways to check?

share|improve this question
    
This is how I've done it previously, although I seem to remember Professional included some Enterprise elements - but if you're checking version too, you're probably good to go there. This was the reference I used at the time: gist.github.com/jayelkaake/1541793 –  Douglas Radburn Jul 28 at 9:04
    
@DouglasRadburn I don't care about professional anymore because it's discontinued. Glad to know someone does it the same. Please put your comment as an answer, and If nothing else comes up in the next 2 days I'l accept it. –  Marius Jul 28 at 9:07

1 Answer 1

up vote 5 down vote accepted

Since CE 1.7 you have Mage::getEdition() that gives this information:

/**
 * Magento edition constants
 */
const EDITION_COMMUNITY    = 'Community';
const EDITION_ENTERPRISE   = 'Enterprise';
const EDITION_PROFESSIONAL = 'Professional';
const EDITION_GO           = 'Go';

/**
 * Current Magento edition.
 *
 * @var string
 * @static
 */
static private $_currentEdition = self::EDITION_COMMUNITY;



/**
 * Get current Magento edition
 *
 * @static
 * @return string
 */
public static function getEdition()
{
   return self::$_currentEdition;
}
share|improve this answer
1  
Thanks. I was looking for that. That's the second time today my search skills fail. "Today is not a good day for science". –  Marius Jul 28 at 10:40
    
So you nee to check if the method exists first and then call it. If you care about CE 1.6 –  Amasty Jul 28 at 12:49
    
@Amasty. Yep. that's true. But I don't offer support for my extension on versions less than 1.7 so this should be ok. –  Marius Jul 28 at 14:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.