Product Plugins » History » Version 2
Patrick Kohl, 10/08/2011 04:53 PM
| 1 | 1 | Patrick Kohl | h1. Product Plugins |
|---|---|---|---|
| 2 | |||
| 3 | h2. for user |
||
| 4 | |||
| 5 | The product plugin is installed as a standard joomla plugin |
||
| 6 | |||
| 7 | To see it you must publish it in joomla extention after installation. |
||
| 8 | |||
| 9 | 2 | Patrick Kohl | After you do that, you can find it in the customfields on edit Choice : |
| 10 | *Custom Field Type* : plugin |
||
| 11 | 1 | Patrick Kohl | |
| 12 | After choicing the plugin you can setup the defaut value depending on your plugin. |
||
| 13 | |||
| 14 | h2. for developper. |
||
| 15 | |||
| 16 | h3. Language files : |
||
| 17 | |||
| 18 | XML install file must use the name in this form plg_vmcustom_YOURPLUGINNAME |
||
| 19 | |||
| 20 | EG. for textinput french and english |
||
| 21 | <languages> |
||
| 22 | <language tag="en-GB">en-GB.plg_vmcustom_textinput.ini</language> |
||
| 23 | <language tag="fr-FR">fr-FR.plg_vmcustom_textinput.ini</language> |
||
| 24 | </languages> |
||
| 25 | |||
| 26 | the constructor include directly the language file to simplify using JTEXT |
||
| 27 | |||
| 28 | Try to always use this convention name in the ini files : |
||
| 29 | VMCUSTOM_YOURPLUGINNAME_STRING="my string in english" |
||
| 30 | |||
| 31 | EG. for texinput plugin , string : size |
||
| 32 | VMCUSTOM_TEXTINPUT_INPUT_SIZE="Size of input" |
||
| 33 | |||
| 34 | h3. Write your plugin : |
||
| 35 | |||
| 36 | 2 | Patrick Kohl | _List of function to write in your plugin_ |
| 37 | |||
| 38 | *onProductEdit($field,$param,$row, $product_id);* |
||
| 39 | |||
| 40 | render the plugin with param to display on product edit customfields TAB |
||
| 41 | (called by customfields inputTypePlugin) |
||
| 42 | |||
| 43 | *onDisplayProductFE( $field, $param, $product, $idx);* |
||
| 44 | |||
| 45 | display the plugin on product FE |
||
| 46 | return $html |
||
| 47 | |||
| 48 | *onViewCartModule( $product,$custom_param,$productCustom, $row);* |
||
| 49 | display the product plugin on cart module |
||
| 50 | return $html |
||
| 51 | |||
| 52 | *onViewCart($product, $param,$productCustom, $row);* |
||
| 53 | display the product plugin on cart |
||
| 54 | return $html |
||
| 55 | |||
| 56 | *onViewCartOrder($product, $param,$productCustom, $row)* |
||
| 57 | handel $param before adding it in the order |
||
| 58 | return $param; |
||
| 59 | |||
| 60 | |||
| 61 | *onViewOrderFE($item, $param,$productCustom, $row);* |
||
| 62 | display the plugin in order for customers |
||
| 63 | $item is the order item line |
||
| 64 | Eg. to Get the statut ( $item->order_status == 'S' ) |
||
| 65 | |||
| 66 | *onViewOrderBE($item, $param,$productCustom, $row);* |
||
| 67 | display the plugin in order for vendor |
||
| 68 | $item is the order item line |
||
| 69 | |||
| 70 | |||
| 71 | *modifyPrice( $product, $field,$param,$selected )* |
||
| 72 | overide the defaut price modifation by plugin |
||
| 73 | you have to rewrite it in your plugin to do other calculations |
||
| 74 | |||
| 75 | _you must return $field->custom_price at end to include your changes or the price varaint is set to 0;_ |
||
| 76 | 1 | Patrick Kohl | |
| 77 | h3. Use plugin parameters : |
||
| 78 | |||
| 79 | TODO |