How to fix Smartaddons modules after Virtuemart Update

How to fix Smartaddons modules after Virtuemart Update

blog Hits: 1904
Recently we found out that after updating Virtuemart to 3.6 , some SmartAddons modules like 
 
  • SJ Listing Tabs for VirtueMart
  • SJ Super Category for Virtuemart
  • SJ Categories for VirtueMart
  • SJ Deals for VirtueMart
  • SJ Filter for VirtueMart
  • and ...
have problem in backend setting. In fact in module setting for section [Select Category] you see this error :
 
Maybe your component (Virtuemart) has been installed incorrectly. Please sure your component work properly. If you still get errors, please contact us via our forum or ticket system
 
There is no specific solution in smartaddons forum yet but we present a simple way to fix that. All above modules has is a file in path : 
 
core\fields\sjvmcategories.php
 
that using a variable with name JPATH_VM_ADMINISTRATOR which is not available in new version of virtuemart. So you need to simply change (near line 46 ):

if (!class_exists('VmModel')) {
                if (defined('JPATH_VM_ADMINISTRATOR') && file_exists(JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php')) {
                    require JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php';
                } else {
                    $this->error = 'Could not find VmModel helper';
                    return false;
                }
            }​
 
with below codes :
 
if (!class_exists('VmModel')) {
                if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php')) {
                    require_once(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php');
                } else {
                    $this->error = 'Could not find VmModel helper';
                    return false;
                }
            }
 
 Save the file and refresh module backend. the problem should be fixed!
Print
Cron Job Starts