I am trying to compare magento version so I can check if the current version is greater then 1.6 use the code otherwise don't.
I can get the magento version by using Mage::getVersion()
and it returns 1.7.0.2
(a string) but how do I compare it so that my code won't break the page when installed on another magento whose version lower then this? Is there any other way better than this. solution must be from within magento.
In order to check the Magento version, you need to log into your Magento Admin Panel. Once you scroll down the page, you will see the Magento version in the bottom (footer) right corner.
You can check using Magento admin panel, Click On Sales Tab from left panel, If Archive is display in your sub navigation, Its enterprise feature.
Magento offers two versions of its platform – Magento community edition, a free open source version and Magento Enterprise edition a paid premium version allowing businesses to leverage Magento's full set of features.
You can use the version_compare
function.
$magentoVersion = Mage::getVersion();
if (version_compare($magentoVersion, '1.6', '>=')){
//version is 1.6 or greater
}
else {
//version is below 1.6
}
if(version_compare(Mage::getVersion(), '1.7.0.2') > 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With