News:

Looking for documentation? Take a look on our wiki

Main Menu

How to use virtuemart models in my custom components?

Started by BillyMontoya, December 08, 2015, 11:42:33 AM

Previous topic - Next topic

BillyMontoya

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?

GJC Web Design

if (!class_exists( 'VmConfig' ))
require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php'); // make sure DS is defined in your comp
e.g.
defined('DS') or define('DS', DIRECTORY_SEPARATOR);

$model = VmModel::getModel('Manufacturer');
$manufacturers = $model->getManufacturers(true, true,true);

QuoteI am using Joomla 3.4.1 and virtuemart 3.0.6.2

both way out of date and insucure
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation