array(0.0,'int'), 'custom_price_by_letter'=>array(0.0,'bool') ); $this->setConfigParameterable('custom_params',$varsToPush); } // get product param for this plugin on edit function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { if ($field->custom_element != $this->_name) return ''; // $html .=''; $this->parseCustomParams($field); $html ='
'. JText::_('VMCUSTOM_TEXTINPUT') .' '.VmHTML::row('input','VMCUSTOM_TEXTINPUT_SIZE','custom_param['.$row.'][custom_size]',$field->custom_size). '
'. JText::_('VMCUSTOM_TEXTINPUT_PRICE_BY_LETTER_OR_INPUT'). ' '; $html .= ($field->custom_price_by_letter==1)?JText::_('VMCUSTOM_TEXTINPUT_PRICE_BY_LETTER'):JText::_('VMCUSTOM_TEXTINPUT_PRICE_BY_INPUT'); $html .='
'; $retValue .= $html; $row++; return true ; } /** * @ idx plugin index * @see components/com_virtuemart/helpers/vmCustomPlugin::onDisplayProductFE() * @author Patrick Kohl * eg. name="customPlugin['.$idx.'][comment] save the comment in the cart & order */ function plgVmOnDisplayProductVariantFE($field,&$idx,&$group) { // default return if it's not this plugin if ($field->custom_element != $this->_name) return ''; $this->getCustomParams($field); $group->display .= $this->renderByLayout('default',array($field,&$idx,&$group ) ); return true; // return $html; } //function plgVmOnDisplayProductFE( $product, &$idx,&$group){} /** * @see components/com_virtuemart/helpers/vmCustomPlugin::plgVmOnViewCartModule() * @author Patrick Kohl */ function plgVmOnViewCartModule( $product,$row,&$html) { return $this->plgVmOnViewCart($product,$row,$html); } /** * @see components/com_virtuemart/helpers/vmCustomPlugin::plgVmOnViewCart() * @author Patrick Kohl */ function plgVmOnViewCart($product,$row,&$html) { if (empty($product->productCustom->custom_element) or $product->productCustom->custom_element != $this->_name) return ''; if (!$plgParam = $this->GetPluginInCart($product)) return '' ; foreach($plgParam as $k => $item){ if(!empty($item['comment']) ){ if($product->productCustom->virtuemart_customfield_id==$k){ $html .=''.JText::_($product->productCustom->custom_title).' '.$item['comment'].''; } } } return true; } /** * * vendor order display BE */ function plgVmDisplayInOrderBE($item, $row, &$html) { if(!empty($productCustom)){ $item->productCustom = $productCustom; } if (empty($item->productCustom->custom_element) or $item->productCustom->custom_element != $this->_name) return ''; $this->plgVmOnViewCart($item,$row,$html); //same render as cart } /** * * shopper order display FE */ function plgVmDisplayInOrderFE($item, $row, &$html) { if (empty($item->productCustom->custom_element) or $item->productCustom->custom_element != $this->_name) return ''; $this->plgVmOnViewCart($item,$row,$html); //same render as cart } /** * We must reimplement this triggers for joomla 1.7 * vmplugin triggers note by Max Milbers */ public function plgVmOnStoreInstallPluginTable($psType) { //Should the textinput use an own internal variable or store it in the params? //Here is no getVmPluginCreateTableSQL defined // return $this->onStoreInstallPluginTable($psType); } function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){ return $this->declarePluginParams('custom', $name, $id, $data); } function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){ return $this->setOnTablePluginParams($name, $id, $table); } /** * Custom triggers note by Max Milbers */ function plgVmOnDisplayEdit($virtuemart_custom_id,&$customPlugin){ return $this->onDisplayEditBECustom($virtuemart_custom_id,$customPlugin); } public function plgVmCalculateCustomVariant($product, &$productCustomsPrice,$selected){ if ($productCustomsPrice->custom_element !==$this->_name) return ; $customVariant = $this->getCustomVariant($product, $productCustomsPrice,$selected); if (!empty($productCustomsPrice->custom_price)) { //TODO adding % and more We should use here $this->interpreteMathOp // eg. to calculate the price * comment text length if (!empty($customVariant['comment'])) { if ($productCustomsPrice->custom_price_by_letter ==1) { $charcount = strlen ($customVariant['comment']); } else { $charcount = 1.0; } $productCustomsPrice->custom_price = $charcount * $productCustomsPrice->custom_price ; } else { $productCustomsPrice->custom_price = 0.0; } } return true; } public function plgVmDisplayInOrderCustom(&$html,$item, $param,$productCustom, $row ,$view='FE'){ $this->plgVmDisplayInOrderCustom($html,$item, $param,$productCustom, $row ,$view); } public function plgVmCreateOrderLinesCustom(&$html,$item,$productCustom, $row ){ // $this->createOrderLinesCustom($html,$item,$productCustom, $row ); } function plgVmOnSelfCallFE($type,$name,&$render) { $render->html = ''; } } // No closing tag