Project

General

Profile

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

Max Milbers, 09/07/2011 11:22 AM

1 1 Max Milbers
h1. Developing a module or plugin for Virtuemart 2
2
3
When you want to develop your own extension for virtuemart, then this hints should you help to get started:
4
5
Use
6
@if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');@
7
to load the configuration object in your extension. Then use
8
9 5 Max Milbers
@$config = VmConfig::loadConfig();@
10 1 Max Milbers
11
to load the configuration values, you can then easily access them with
12
13
@VmConfig::get('yourVariable','default');@
14
15 2 Max Milbers
After loading the VmConfig you should always use the vm path constants to access files
16
17
@JPATH_VM_SITE = JPATH_ROOT.DS.'components'.DS.'com_virtuemart' );
18
JPATH_VM_ADMINISTRATOR = JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart' );@
19
20
For performance reasons you should always use the 
21
22
@if (!class_exists( 'MyClass' )) require (JPATH_VM_ADMINISTRATOR.DS....)@
23
24
construction, dont use require_once
25 1 Max Milbers
26
When you want to access the js used in vm then load them with
27
28 4 Max Milbers
@$config->jQuery();
29
$config->jVm();@
30 1 Max Milbers
31
or for the  css use
32 4 Max Milbers
@$config->cssSite();@
33 1 Max Milbers
34 5 Max Milbers
For shipment, payment, or other plugin development please look here [[Plugin system]] or for modules here [[Modules system]]