0 Class 'VmModel' not found error after upgrading to version 3.6.0 10113

Started by sylwekb, September 24, 2019, 09:01:48 AM

Previous topic - Next topic

sylwekb

Hello
After upgrading to the Virtuemart version 3.6.0 10113 an error appears for the Shopmania datafeed file

0 Class 'VmModel' not found

How can you fix this?

Datafeed file attached txt format.

Joomla! 3.9.11, php 7.3.5

Milbo


require_once 'administrator/components/com_virtuemart/helpers/config.php';
require_once 'administrator/components/com_virtuemart/models/category.php';
require_once 'administrator/components/com_virtuemart/models/product.php';
require_once 'administrator/components/com_virtuemart/models/media.php';
require_once 'administrator/components/com_virtuemart/models/currency.php';

if(file_exists('administrator/components/com_virtuemart/models/shipmentmethod.php') && JPluginHelper::isEnabled("vmshipment", "weight_countries")) {
  require_once 'administrator/components/com_virtuemart/models/shipmentmethod.php'; 
  $hasShipping = true;
}

// Load config
VmConfig::loadConfig();


This is not good done. Remove the whole thing and just use


if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');

VmConfig::loadConfig();
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


Milbo

line 116 should have
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');

VmConfig::loadConfig();

JPATH_ROOT is in your case I thin JPATH_BASE
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

Quote from: Milbo on September 25, 2019, 14:30:26 PM
line 116 should have
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');

VmConfig::loadConfig();

JPATH_ROOT is in your case I thin JPATH_BASE

The use of the VmConfig::loadConfig(); is loading several plugins.
If that is called from another plugin without setting the param $exeTrig=false, then it can cause recursion.

I am not sure what the call of the importVMPlugins does there, but seems like is not the right place to be called, from a function that is supposed to load the config settings.
Also although you only need the plugins of type 'vmuserfield', in the event trigger, other types are loaded as well.