How would I add an IF statement to check if the opencart version is greater than 1.5.1.3?
This is defined in the index.php as:
// Version
define('VERSION', '1.5.0');
I have tried: if((int)VERSION >= '1.5.1.3'){
although when I convert this into an int it becomes empty.
Also I tried this with the same effect:
$this->data['oc_version'] = (int)str_replace('.', '', VERSION);
if($this->data['oc_version'] >= 1513){
Do I need to convert this into an int to correctly perform greater/less than calculations?
if(version_compare(VERSION, '1.5.1.3', '>')) {
// CODE HERE IF HIGHER
} else {
// CODE HERE IF LOWER
}
Though the 1.5.1.3 branch actually goes up to 1.5.1.3.1 so I'm guessing you want it to be that
I tried this recently and couldnt get it working as above, perhaps its a PHP version thing but I got it working with:
if(version_compare(VERSION, '1.5.1.3') > 0) {
// CODE HERE IF HIGHER
} else {
// CODE HERE IF LOWER
}
Hope that helps someone else. Got the code from here: http://us2.php.net/manual/en/function.version-compare.php