How to fix Smartaddons modules after Virtuemart Update

How to fix Smartaddons modules after Virtuemart Update

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!

Comments (9)

This comment was minimized by the moderator on the site

Almost working - after replace top menu (in admin) is missing - no posibility to save, close - there is no icon, so can't check is it working.
Can you help me?

Cezary
This comment was minimized by the moderator on the site

Hi, the replacement is related to Frontend not backend, did you full refresh (CTRL+F5) the backend?

Super User
This comment was minimized by the moderator on the site


			if (!class_exists('VmModel')) {
				if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php')) {
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vobject.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmecho.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmlanguage.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php';
				} else...


			if (!class_exists('VmModel')) {
				if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php')) {
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vobject.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmecho.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmlanguage.php';
					require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/vmmodel.php';
				} else {
					$this->error = 'Could not find VmModel helper';
					return false;
				}
			}
			//if (defined('JPATH_VM_ADMINISTRATOR')) {
				JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_virtuemart/tables');
			//}

Read More
mspuz
This comment was minimized by the moderator on the site

Tried your patch but it is not working now. Backend buttons (save, close, etc.) dissapear after change. CSS styles gone. Thanks anyway for the effort. I'm forced to downgrade Virtuemart.

Javier H Eraso
This comment was minimized by the moderator on the site

Hi, If you lost the page style, maybe there is a fatal error because of incorrect replacement.
It's better to check error log of your host.

Super User
This comment was minimized by the moderator on the site

After your suggested replacement I get an error on backend: PHP Fatal error: Class 'vObject' not found in mysite/administrator/components/com_virtuemart/helpers/vmmodel.php on line 24.
All buttons are missing in backend and the module page appears with no CSS styles. Any clue?

Javier Eraso
This comment was minimized by the moderator on the site

Have you searched the Virtuemart Forum?
http://forum.virtuemart.net/index.php?topic=144067.0

Super User
This comment was minimized by the moderator on the site

I had the same issue. I found a work around because the solution given above, didn't work for me. I lost the buttons from the top and could not select the category. It is not a permanent solution, and every time a change is made in the module, the fix has to be done again.
I created an article for a temporary fix on my website.

I am IT pro who owns a bakery, Don't be alarmed if the page has nothing to do with It. I try to post the fixes I made to the website.

Pasquinel Ortiz
This comment was minimized by the moderator on the site

This work for me (VirtueMart 3.8.4):

 if (!class_exists('VmModel')) {
                if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) {
                    require_once(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php');
                    VmConfig::loadConfig();
                } else {
                    $this->error = 'Could not find VmModel helper';
                    return false;
                }
            }

abs134
There are no comments posted here yet

Leave your comments

  1. For auto publish the comment you need to login first.
Attachments (0 / 3)
Share Your Location

Print