Developing a module or plugin for Virtuemart 2 » History » Version 2
Max Milbers, 02/28/2011 06:09 PM
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 | @VmConfig::loadConfig();@ |
||
10 | |||
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 | @VmConfig::jQuery(); |
||
29 | VmConfig::jPrice();@ |
||
30 | |||
31 | or for the css use |
||
32 | @VmConfig::cssSite();@ |
||
33 | |||
34 | For shipment or payment plugin development please look here [[Plugin system]] |