VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: devsaurin on March 25, 2015, 18:33:03 PM

Title: How to use virtuemart models in my custom components?
Post by: devsaurin on March 25, 2015, 18:33:03 PM
I have developed a custom component to import different types of data in virtuemart. I am facing trouble to load virtuemart module in my custom component. I am using Joomla 3.4.1 and virtuemart 3.0.6.2

I have tried several ways to load model to my component.
I have tried following

JLoader::import('joomla.application.component.model');
JLoader::import( 'manufacturer', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' );
$model = JModel::getInstance( 'Manufacturer', 'VirtueMartModel' );

is there any way to get model?
Title: Re: How to use virtuemart models in my custom components?
Post by: Milbo on March 26, 2015, 09:16:36 AM
Quote from: devsaurin on March 25, 2015, 18:33:03 PM
JLoader::import('joomla.application.component.model');
JLoader::import( 'manufacturer', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' );
$model = JModel::getInstance( 'Manufacturer', 'VirtueMartModel' );
eeeaks, that looks ugly.


Of course there is ( I was so tempted so say no)

http://docs.virtuemart.net/ 
http://dev.virtuemart.net/projects/virtuemart/wiki

Did you ever took a look in our code. It is not too much to ask for, or? Writing for VM is not writing for joomla! Almost anything is replaced and we will extend that way. Of course you can write the joomla way, but then your stuff wont work on WP