Project

General

Profile

Product Plugins » History » Revision 2

Revision 1 (Patrick Kohl, 10/08/2011 04:01 PM) → Revision 2/10 (Patrick Kohl, 10/08/2011 04:53 PM)

h1. Product Plugins 

 h2. for user   

 The product plugin is installed as a standard joomla plugin 

 To see it you must publish it in joomla extention after installation. 

 After you do that, you can find it in the customfields 

 on edit Choice :  
 *Custom Custom Field Type* Type : plugin 

 After choicing the plugin you can setup the defaut value depending on your plugin. 

 h2. for developper. 

 h3. Language files : 

 XML install file must use the name in this form plg_vmcustom_YOURPLUGINNAME 

 EG. for textinput french and english 
     <languages> 
         <language tag="en-GB">en-GB.plg_vmcustom_textinput.ini</language> 
         <language tag="fr-FR">fr-FR.plg_vmcustom_textinput.ini</language> 
     </languages> 

 the constructor include directly the language file to simplify using JTEXT 

 Try to always use this convention name in the ini files : 
 VMCUSTOM_YOURPLUGINNAME_STRING="my string in english" 

 EG. for texinput plugin , string : size 
 VMCUSTOM_TEXTINPUT_INPUT_SIZE="Size of input" 

 h3. Write your plugin : 

 _List of function to write in your plugin_ 

 *onProductEdit($field,$param,$row, $product_id);* 

	 render the plugin with param    to display on product edit customfields TAB 
	 (called by customfields inputTypePlugin) 

 *onDisplayProductFE( $field, $param, $product, $idx);* 

	 display the plugin on product FE 
	 return $html 

 *onViewCartModule( $product,$custom_param,$productCustom, $row);* 
	 display the product plugin on cart module 
	 return $html 
	
 *onViewCart($product, $param,$productCustom, $row);* 
	 display the product plugin on cart 
	 return $html 
	
 *onViewCartOrder($product, $param,$productCustom, $row)* 
	 handel $param before adding it in the order 
	 return $param; 
	
	
 *onViewOrderFE($item, $param,$productCustom, $row);* 
	 display the plugin in order for customers 
	 $item is the order item line 
	 Eg. to Get the statut ( $item->order_status == 'S'    ) 
	
 *onViewOrderBE($item, $param,$productCustom, $row);* 
	 display the plugin in order for vendor 
	 $item is the order item line 

	
 *modifyPrice( $product, $field,$param,$selected )* 
	 overide the defaut price modifation by plugin 
	 you have to rewrite it in your plugin to do other calculations 
	
	 _you must return $field->custom_price at end to include your changes or the price varaint is set to 0;_ TODO 

 h3. Use plugin parameters : 

 TODO