Project

General

Profile

Developing a module or plugin for Virtuemart 2 » History » Revision 5

Revision 4 (Max Milbers, 04/05/2011 12:26 PM) → Revision 5/16 (Max Milbers, 09/07/2011 11:22 AM)

h1. Developing a module or plugin for Virtuemart 2 

 When you want to develop your own extension for virtuemart, then this hints should you help to get started: 

 Use 
 @if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');@ 
 to load the configuration object in your extension. Then use 

 @$config = VmConfig::loadConfig();@ VmConfig::getInstance();@ 

 to load the configuration values, you can then easily access them with 

 @VmConfig::get('yourVariable','default');@ 

 After loading the VmConfig you should always use the vm path constants to access files 

 @JPATH_VM_SITE = JPATH_ROOT.DS.'components'.DS.'com_virtuemart' ); 
 JPATH_VM_ADMINISTRATOR = JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart' );@ 

 For performance reasons you should always use the  

 @if (!class_exists( 'MyClass' )) require (JPATH_VM_ADMINISTRATOR.DS....)@ 

 construction, dont use require_once 

 When you want to access the js used in vm then load them with 

 @$config->jQuery(); 
 $config->jVm();@ 

 or for the    css use 
 @$config->cssSite();@ 

 For shipment, payment, shipment or other payment plugin development please look here [[Plugin system]] or for modules here [[Modules system]]