VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: welrachid on January 10, 2016, 12:35:30 PM

Title: importing vmstatic classes etc.
Post by: welrachid on January 10, 2016, 12:35:30 PM
Hi
Im currently developing a component that will interact with external system and import ST's to the userprofile.

To do this i would like to be able to use the VMModel::getModel('user');

But im running into an issue where it does not recognize the class vmmodel at all.
I tried importing shopfunctions(f).php with no result.

Is there a certain file i can import that will get me all the "environment" of vm?
I dont want to use sql directly because of updates to vm will probably at some point make my sql crash. Therefore i want to use the User model to do the actual creation of new ST's

thanks!
Title: Re: importing vmstatic classes etc.
Post by: GJC Web Design on January 10, 2016, 22:12:24 PM
from inside Joomla? something like?


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

$model = VmModel::getModel('User');
$users = $model->getUser();
Title: Re: importing vmstatic classes etc.
Post by: welrachid on January 10, 2016, 22:57:09 PM
Thank you. Exactly what i needed.